]>
Commit | Line | Data |
---|---|---|
1bfc7ca0 ER |
1 | # NOTE: |
2 | # This package uses Bundler to download and install all gems in deployment | |
3 | # mode (i.e. into isolated directory inside application). That's not PLD Linux | |
4 | # way how it should be done, but GitLab has too many dependencies that it will | |
5 | # be too difficult to maintain them via distro packages. | |
8f15c340 ER |
6 | # |
7 | # install notes: https://gitlab.com/gitlab-org/gitlab-ce/blob/v8.6.3/doc/install/installation.md | |
8 | # | |
1bfc7ca0 ER |
9 | # TODO |
10 | # - [timfel-krb5-auth] doesn't build with heimdal (https://github.com/timfel/krb5-auth/issues/8) | |
11 | # | |
12 | # | |
13 | # Conditional build: | |
14 | %bcond_with krb5 # build with kerberos support | |
e1281e41 | 15 | %bcond_with gem_cache # build from local gem cache only (avoids network) |
1bfc7ca0 | 16 | |
edff9e13 ER |
17 | Summary: A Web interface to create projects and repositories, manage access and do code reviews |
18 | Name: gitlab-ce | |
3af24041 | 19 | Version: 8.6.6 |
edff9e13 ER |
20 | Release: 0.1 |
21 | License: MIT | |
22 | Group: Applications/WWW | |
3af24041 | 23 | # md5 deliberately omitted until this package is useful |
1bfc7ca0 | 24 | Source0: https://github.com/gitlabhq/gitlabhq/archive/v%{version}/%{name}-%{version}.tar.gz |
edff9e13 ER |
25 | URL: https://www.gitlab.com/gitlab-ce/ |
26 | Source1: gitlab.target | |
27 | Source2: gitlab-sidekiq.service | |
28 | Source3: gitlab-unicorn.service | |
29 | Source4: gitlab.logrotate | |
30 | Source5: gitlab.tmpfiles.d | |
31 | Source6: gitlab-apache-conf | |
b70ed759 | 32 | BuildRequires: gmp-devel |
edff9e13 | 33 | BuildRequires: ruby-bundler |
b70ed759 | 34 | BuildRequires: ruby-devel >= 1:2.1.0 |
edff9e13 ER |
35 | Obsoletes: gitlab <= 8.1.4 |
36 | Requires(pre): gitlab-shell | |
37 | Requires: apache-base | |
6f80237a | 38 | Requires: git-core >= 2.7.4 |
edff9e13 | 39 | Requires: ruby-bundler |
1bfc7ca0 ER |
40 | Suggests: mysql |
41 | Suggests: redis-server | |
edff9e13 ER |
42 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
43 | ||
44 | %define gitlab_uid 65434 | |
45 | %define gitlab_gid 65434 | |
46 | ||
47 | %define homedir %{_localstatedir}/lib/gitlab | |
48 | ||
49 | %description | |
50 | GitLab Community Edition (CE) is open source software to collaborate | |
51 | on code. Create projects and repositories, manage access and do code | |
52 | reviews. GitLab CE is on-premises software that you can install and | |
53 | use on your server(s). | |
54 | ||
55 | %prep | |
1bfc7ca0 | 56 | %setup -qn gitlabhq-%{version} |
edff9e13 ER |
57 | |
58 | # Patching config files: | |
59 | sed -e "s|# user: git|user: gitlab|" \ | |
60 | -e "s|/home/git/repositories|%{homedir}/repositories|" \ | |
61 | -e "s|/home/git/gitlab-satellites|%{homedir}/satellites|" \ | |
62 | -e "s|/home/git/gitlab-shell|/usr/share/gitlab-shell|" \ | |
63 | config/gitlab.yml.example > config/gitlab.yml | |
64 | sed -e "s|/home/git/gitlab/tmp/.*/|/run/gitlab/|g" \ | |
65 | -e "s|/home/git/gitlab|%{homedir}|g" \ | |
66 | -e "s|/usr/share/gitlab/log|%{homedir}/log|g" \ | |
67 | -e "s|timeout 30|timeout 300|" \ | |
68 | config/unicorn.rb.example > config/unicorn.rb | |
69 | sed -e "s|username: git|username: gitlab|" \ | |
70 | config/database.yml.mysql > config/database.yml | |
b262a96c ER |
71 | |
72 | rm .flayignore | |
73 | rm .gitignore | |
6f80237a | 74 | rm .csscomb.json |
b262a96c | 75 | find -name .gitkeep | xargs rm |
edff9e13 ER |
76 | |
77 | %build | |
edff9e13 | 78 | bundle install %{_smp_mflags} \ |
7470b5a8 | 79 | --verbose \ |
e1281e41 | 80 | %{?with_gem_cache:--local} \ |
7470b5a8 | 81 | %{?debug:--no-cache --no-prune} \ |
1bfc7ca0 | 82 | --deployment --without development test aws %{!?with_krb5:kerberos} |
edff9e13 ER |
83 | |
84 | %install | |
85 | rm -rf $RPM_BUILD_ROOT | |
86 | install -d \ | |
87 | $RPM_BUILD_ROOT%{homedir}/www \ | |
88 | $RPM_BUILD_ROOT%{homedir}/public/uploads \ | |
89 | $RPM_BUILD_ROOT%{_sysconfdir}/gitlab \ | |
90 | $RPM_BUILD_ROOT%{_docdir}/gitlab \ | |
91 | $RPM_BUILD_ROOT%{homedir}/satellites | |
92 | ||
b262a96c ER |
93 | # test if we can hardlink -- %{_builddir} and $RPM_BUILD_ROOT on same partition |
94 | if cp -al VERSION $RPM_BUILD_ROOT/VERSION 2>/dev/null; then | |
95 | l=l | |
96 | rm -f $RPM_BUILD_ROOT/VERSION | |
97 | fi | |
98 | ||
99 | cp -a$l . $RPM_BUILD_ROOT%{homedir} | |
edff9e13 ER |
100 | |
101 | # Creating links | |
102 | ln -fs /run/gitlab $RPM_BUILD_ROOT%{homedir}/pids | |
103 | ln -fs /run/gitlab $RPM_BUILD_ROOT%{homedir}/sockets | |
104 | ln -fs %{_localstatedir}/log/gitlab $RPM_BUILD_ROOT%{homedir}/log | |
1bfc7ca0 | 105 | install -d $RPM_BUILD_ROOT%{_localstatedir}/log/gitlab |
edff9e13 ER |
106 | |
107 | # Install config files | |
108 | for f in gitlab.yml unicorn.rb database.yml; do | |
109 | install -m0644 config/$f $RPM_BUILD_ROOT%{_sysconfdir}/gitlab/$f | |
1bfc7ca0 | 110 | [ -f "$RPM_BUILD_ROOT%{homedir}/config/$f" ] && rm $RPM_BUILD_ROOT%{homedir}/config/$f |
edff9e13 ER |
111 | ln -fs %{_sysconfdir}/gitlab/$f $RPM_BUILD_ROOT%{homedir}/config/ |
112 | done | |
113 | ||
114 | # Install systemd service files | |
115 | install -D %{S:1} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab.target | |
116 | install -D %{S:2} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-sidekiq.service | |
117 | install -D %{S:3} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-unicorn.service | |
118 | install -D %{S:4} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/gitlab.logrotate | |
119 | install -D %{S:5} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/gitlab.conf | |
120 | install -D %{S:6} $RPM_BUILD_ROOT%{_sysconfdir}/httpd/httpd.d/gitlab.conf | |
121 | ||
122 | %clean | |
123 | rm -rf "$RPM_BUILD_ROOT" | |
124 | ||
125 | %pre | |
126 | if [ $1 -ge 1 ]; then | |
127 | %groupadd gitlab -g %{gitlab_gid} | |
128 | %useradd -u %{gitlab_uid} -c 'Gitlab user' -d %{homedir} -g gitlab -s /bin/bash gitlab | |
129 | fi | |
130 | ||
131 | %post | |
132 | if [ $1 -ge 1 ]; then | |
133 | systemctl -q daemon-reload | |
134 | systemd-tmpfiles --create %{systemdtmpfilesdir}/gitlab.conf | |
135 | [ -e %{_localstatedir}/lock/subsys/httpd ] && service httpd reload || : | |
136 | fi | |
137 | if [ $1 -eq 1 ]; then | |
138 | systemctl -q enable gitlab-unicorn | |
139 | systemctl -q enable gitlab-sidekiq | |
140 | systemctl -q enable gitlab.target | |
141 | systemctl -q start gitlab-unicorn | |
142 | systemctl -q start gitlab-sidekiq | |
143 | systemctl -q start gitlab.target | |
144 | sudo -u gitlab -H git config --global user.name "GitLab" | |
145 | sudo -u gitlab -H git config --global user.email "gitlab@localhost" | |
146 | sudo -u gitlab -H git config --global core.autocrlf input | |
147 | echo "Create and configure database in /etc/gitlab/database.yml" | |
148 | echo "Then run 'sudo -u gitlab bundle exec rake gitlab:setup RAILS_ENV=production'" | |
149 | echo | |
150 | else | |
151 | systemctl -q try-restart gitlab-unicorn | |
152 | systemctl -q try-start gitlab-sidekiq | |
153 | fi | |
154 | ||
155 | %postun | |
156 | if [ $1 -eq 0 ]; then | |
157 | %userremove gitlab | |
158 | %groupremove gitlab | |
159 | fi | |
160 | ||
161 | %files | |
162 | %defattr(644,root,root,755) | |
163 | %doc LICENSE | |
164 | %dir %{_sysconfdir}/gitlab | |
165 | %config(noreplace) %{_sysconfdir}/gitlab/database.yml | |
166 | %config(noreplace) %{_sysconfdir}/gitlab/gitlab.yml | |
167 | %config(noreplace) %{_sysconfdir}/gitlab/unicorn.rb | |
168 | %config(noreplace) %{_sysconfdir}/httpd/httpd.d/gitlab.conf | |
169 | /etc/logrotate.d/gitlab.logrotate | |
170 | %{systemdunitdir}/gitlab-sidekiq.service | |
171 | %{systemdunitdir}/gitlab-unicorn.service | |
172 | %{systemdunitdir}/gitlab.target | |
173 | %{systemdtmpfilesdir}/gitlab.conf | |
174 | %dir %attr(755,gitlab,gitlab) %{homedir} | |
175 | %dir %attr(755,gitlab,gitlab) %{homedir}/app | |
176 | %attr(-,gitlab,gitlab) %{homedir}/app/* | |
177 | %dir %attr(755,gitlab,gitlab) %{homedir}/bin | |
178 | %attr(-,gitlab,gitlab) %{homedir}/bin/* | |
179 | %dir %attr(755,gitlab,gitlab) %{homedir}/builds | |
edff9e13 ER |
180 | %dir %attr(755,gitlab,gitlab) %{homedir}/config |
181 | %attr(-,gitlab,gitlab) %{homedir}/config/* | |
182 | %dir %attr(755,gitlab,gitlab) %{homedir}/db | |
183 | %attr(-,gitlab,gitlab) %{homedir}/db/* | |
184 | %dir %attr(755,gitlab,gitlab) %{homedir}/doc | |
185 | %attr(-,gitlab,gitlab) %{homedir}/doc/* | |
186 | %dir %attr(755,gitlab,gitlab) %{homedir}/docker | |
187 | %attr(-,gitlab,gitlab) %{homedir}/docker/* | |
188 | %dir %attr(755,gitlab,gitlab) %{homedir}/features | |
189 | %attr(-,gitlab,gitlab) %{homedir}/features/* | |
190 | %dir %attr(755,gitlab,gitlab) %{homedir}/lib | |
191 | %attr(-,gitlab,gitlab) %{homedir}/lib/* | |
192 | %dir %attr(755,gitlab,gitlab) %{homedir}/log | |
193 | %attr(-,gitlab,gitlab) %{homedir}/log/* | |
edff9e13 ER |
194 | %dir %attr(755,gitlab,gitlab) %{homedir}/pids |
195 | %dir %attr(755,gitlab,gitlab) %{homedir}/public | |
196 | %attr(-,gitlab,gitlab) %{homedir}/public/* | |
197 | %dir %attr(755,gitlab,gitlab) %{homedir}/satellites | |
198 | %dir %attr(755,gitlab,gitlab) %{homedir}/scripts | |
199 | %attr(-,gitlab,gitlab) %{homedir}/scripts/* | |
200 | %dir %attr(755,gitlab,gitlab) %{homedir}/sockets | |
201 | %dir %attr(755,gitlab,gitlab) %{homedir}/spec | |
202 | %attr(-,gitlab,gitlab) %{homedir}/spec/* | |
203 | %dir %attr(755,gitlab,gitlab) %{homedir}/tmp | |
204 | %attr(-,gitlab,gitlab) %{homedir}/tmp/* | |
205 | %dir %{homedir}/vendor | |
206 | %{homedir}/vendor/* | |
207 | %dir %attr(755,gitlab,gitlab) %{homedir}/www | |
208 | ||
209 | %dir %attr(755,gitlab,gitlab) %{homedir}/.bundle | |
210 | %attr(-,gitlab,gitlab) %{homedir}/.bundle/config | |
211 | %attr(-,gitlab,gitlab) %{homedir}/.foreman | |
212 | %attr(-,gitlab,gitlab) %{homedir}/docker-compose.yml | |
213 | %attr(-,gitlab,gitlab) %{homedir}/.gitattributes | |
214 | %attr(-,gitlab,gitlab) %{homedir}/.*.yml | |
215 | %attr(-,gitlab,gitlab) %{homedir}/.rspec | |
216 | %attr(-,gitlab,gitlab) %{homedir}/.ruby-version | |
217 | %attr(-,gitlab,gitlab) %{homedir}/.simplecov | |
218 | %attr(-,gitlab,gitlab) %{homedir}/CHANGELOG | |
1bfc7ca0 | 219 | %attr(-,gitlab,gitlab) %{homedir}/GITLAB_WORKHORSE_VERSION |
edff9e13 ER |
220 | %attr(-,gitlab,gitlab) %{homedir}/GITLAB_SHELL_VERSION |
221 | %attr(-,gitlab,gitlab) %{homedir}/Gemfile* | |
222 | %attr(-,gitlab,gitlab) %{homedir}/LICENSE | |
223 | %attr(-,gitlab,gitlab) %{homedir}/*.md | |
224 | %attr(-,gitlab,gitlab) %{homedir}/Procfile | |
225 | %attr(-,gitlab,gitlab) %{homedir}/Rakefile | |
226 | %attr(-,gitlab,gitlab) %{homedir}/VERSION | |
227 | %attr(-,gitlab,gitlab) %{homedir}/config.ru | |
b262a96c | 228 | %attr(-,gitlab,gitlab) %{homedir}/fixtures |