]>
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 | 6 | # |
a92c651e | 7 | # install notes: https://gitlab.com/gitlab-org/gitlab-ce/blob/v8.6.6/doc/install/installation.md |
8f15c340 | 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 | |
dc27d1e6 | 15 | %bcond_without gem_cache # use local to speedup gem installation |
1bfc7ca0 | 16 | |
edff9e13 ER |
17 | Summary: A Web interface to create projects and repositories, manage access and do code reviews |
18 | Name: gitlab-ce | |
321d2ad5 | 19 | Version: 8.6.7 |
79bdc113 | 20 | Release: 0.6 |
edff9e13 ER |
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 |
79bdc113 | 25 | Patch0: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3774.patch |
edff9e13 ER |
26 | URL: https://www.gitlab.com/gitlab-ce/ |
27 | Source1: gitlab.target | |
28 | Source2: gitlab-sidekiq.service | |
29 | Source3: gitlab-unicorn.service | |
30 | Source4: gitlab.logrotate | |
31 | Source5: gitlab.tmpfiles.d | |
32 | Source6: gitlab-apache-conf | |
99acef11 | 33 | BuildRequires: cmake |
b70ed759 | 34 | BuildRequires: gmp-devel |
8b1af143 | 35 | BuildRequires: libgit2-devel |
99acef11 ER |
36 | BuildRequires: libicu-devel |
37 | BuildRequires: libstdc++-devel | |
38 | BuildRequires: libxml2-devel | |
99acef11 ER |
39 | BuildRequires: mysql-devel |
40 | BuildRequires: postgresql-devel | |
8b1af143 | 41 | BuildRequires: rpm-rubyprov |
edff9e13 | 42 | BuildRequires: ruby-bundler |
b70ed759 | 43 | BuildRequires: ruby-devel >= 1:2.1.0 |
99acef11 | 44 | BuildRequires: zlib-devel |
edff9e13 ER |
45 | Obsoletes: gitlab <= 8.1.4 |
46 | Requires(pre): gitlab-shell | |
47 | Requires: apache-base | |
6f80237a | 48 | Requires: git-core >= 2.7.4 |
0f5b396e | 49 | Requires: nodejs |
edff9e13 | 50 | Requires: ruby-bundler |
1bfc7ca0 ER |
51 | Suggests: mysql |
52 | Suggests: redis-server | |
edff9e13 ER |
53 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
54 | ||
a92c651e ER |
55 | %define _noautoreqfiles redcloth_scan.jar primitives.jar |
56 | ||
edff9e13 ER |
57 | %define gitlab_uid 65434 |
58 | %define gitlab_gid 65434 | |
59 | ||
60 | %define homedir %{_localstatedir}/lib/gitlab | |
61 | ||
62 | %description | |
63 | GitLab Community Edition (CE) is open source software to collaborate | |
64 | on code. Create projects and repositories, manage access and do code | |
65 | reviews. GitLab CE is on-premises software that you can install and | |
66 | use on your server(s). | |
67 | ||
68 | %prep | |
1bfc7ca0 | 69 | %setup -qn gitlabhq-%{version} |
79bdc113 | 70 | %patch0 -p1 |
edff9e13 ER |
71 | |
72 | # Patching config files: | |
73 | sed -e "s|# user: git|user: gitlab|" \ | |
74 | -e "s|/home/git/repositories|%{homedir}/repositories|" \ | |
75 | -e "s|/home/git/gitlab-satellites|%{homedir}/satellites|" \ | |
76 | -e "s|/home/git/gitlab-shell|/usr/share/gitlab-shell|" \ | |
77 | config/gitlab.yml.example > config/gitlab.yml | |
78 | sed -e "s|/home/git/gitlab/tmp/.*/|/run/gitlab/|g" \ | |
79 | -e "s|/home/git/gitlab|%{homedir}|g" \ | |
80 | -e "s|/usr/share/gitlab/log|%{homedir}/log|g" \ | |
81 | -e "s|timeout 30|timeout 300|" \ | |
82 | config/unicorn.rb.example > config/unicorn.rb | |
83 | sed -e "s|username: git|username: gitlab|" \ | |
84 | config/database.yml.mysql > config/database.yml | |
b262a96c ER |
85 | |
86 | rm .flayignore | |
87 | rm .gitignore | |
6f80237a | 88 | rm .csscomb.json |
b262a96c | 89 | find -name .gitkeep | xargs rm |
99acef11 | 90 | |
edff9e13 | 91 | %build |
dc27d1e6 ER |
92 | %if %{with gem_cache} |
93 | cachedir="%{_specdir}/cache/%{version}.%{_arch}" | |
94 | install -d vendor/bundle | |
95 | test -d "$cachedir" && cp -aul "$cachedir"/* vendor/bundle | |
96 | %endif | |
97 | ||
edff9e13 | 98 | bundle install %{_smp_mflags} \ |
7470b5a8 | 99 | --verbose \ |
dc27d1e6 ER |
100 | --deployment \ |
101 | --without development test aws %{!?with_krb5:kerberos} | |
edff9e13 | 102 | |
a92c651e ER |
103 | # avoid bogus ruby dep |
104 | chmod a-x vendor/bundle/ruby/gems/unicorn-*/bin/unicorn* | |
105 | ||
dc27d1e6 ER |
106 | %if %{with gem_cache} |
107 | install -d "$cachedir" | |
108 | cp -aul vendor/bundle/* "$cachedir" | |
109 | %endif | |
110 | ||
edff9e13 ER |
111 | %install |
112 | rm -rf $RPM_BUILD_ROOT | |
113 | install -d \ | |
114 | $RPM_BUILD_ROOT%{homedir}/www \ | |
115 | $RPM_BUILD_ROOT%{homedir}/public/uploads \ | |
116 | $RPM_BUILD_ROOT%{_sysconfdir}/gitlab \ | |
117 | $RPM_BUILD_ROOT%{_docdir}/gitlab \ | |
118 | $RPM_BUILD_ROOT%{homedir}/satellites | |
119 | ||
b262a96c ER |
120 | # test if we can hardlink -- %{_builddir} and $RPM_BUILD_ROOT on same partition |
121 | if cp -al VERSION $RPM_BUILD_ROOT/VERSION 2>/dev/null; then | |
122 | l=l | |
123 | rm -f $RPM_BUILD_ROOT/VERSION | |
124 | fi | |
125 | ||
126 | cp -a$l . $RPM_BUILD_ROOT%{homedir} | |
edff9e13 | 127 | |
321d2ad5 ER |
128 | # nuke tests |
129 | chmod -R u+w $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/*/test | |
130 | rm -r $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/*/test | |
131 | ||
edff9e13 ER |
132 | # Creating links |
133 | ln -fs /run/gitlab $RPM_BUILD_ROOT%{homedir}/pids | |
134 | ln -fs /run/gitlab $RPM_BUILD_ROOT%{homedir}/sockets | |
e4edb538 | 135 | rmdir $RPM_BUILD_ROOT%{homedir}/log |
edff9e13 | 136 | ln -fs %{_localstatedir}/log/gitlab $RPM_BUILD_ROOT%{homedir}/log |
1bfc7ca0 | 137 | install -d $RPM_BUILD_ROOT%{_localstatedir}/log/gitlab |
edff9e13 ER |
138 | |
139 | # Install config files | |
140 | for f in gitlab.yml unicorn.rb database.yml; do | |
e4edb538 | 141 | cp -p config/$f $RPM_BUILD_ROOT%{_sysconfdir}/gitlab/$f |
1bfc7ca0 | 142 | [ -f "$RPM_BUILD_ROOT%{homedir}/config/$f" ] && rm $RPM_BUILD_ROOT%{homedir}/config/$f |
edff9e13 ER |
143 | ln -fs %{_sysconfdir}/gitlab/$f $RPM_BUILD_ROOT%{homedir}/config/ |
144 | done | |
145 | ||
c7ba61b6 ER |
146 | install -d $RPM_BUILD_ROOT{%{systemdunitdir},%{systemdtmpfilesdir}} \ |
147 | $RPM_BUILD_ROOT/etc/{logrotate.d,httpd/webapps.d} | |
148 | ||
edff9e13 | 149 | # Install systemd service files |
c7ba61b6 ER |
150 | cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab.target |
151 | cp -p %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-sidekiq.service | |
152 | cp -p %{SOURCE3} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-unicorn.service | |
153 | cp -p %{SOURCE5} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/gitlab.conf | |
154 | cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/logrotate.d/gitlab.logrotate | |
155 | cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/httpd/webapps.d/gitlab.conf | |
edff9e13 ER |
156 | |
157 | %clean | |
158 | rm -rf "$RPM_BUILD_ROOT" | |
159 | ||
160 | %pre | |
161 | if [ $1 -ge 1 ]; then | |
162 | %groupadd gitlab -g %{gitlab_gid} | |
163 | %useradd -u %{gitlab_uid} -c 'Gitlab user' -d %{homedir} -g gitlab -s /bin/bash gitlab | |
164 | fi | |
165 | ||
166 | %post | |
167 | if [ $1 -ge 1 ]; then | |
168 | systemctl -q daemon-reload | |
169 | systemd-tmpfiles --create %{systemdtmpfilesdir}/gitlab.conf | |
170 | [ -e %{_localstatedir}/lock/subsys/httpd ] && service httpd reload || : | |
171 | fi | |
172 | if [ $1 -eq 1 ]; then | |
173 | systemctl -q enable gitlab-unicorn | |
174 | systemctl -q enable gitlab-sidekiq | |
175 | systemctl -q enable gitlab.target | |
176 | systemctl -q start gitlab-unicorn | |
177 | systemctl -q start gitlab-sidekiq | |
178 | systemctl -q start gitlab.target | |
179 | sudo -u gitlab -H git config --global user.name "GitLab" | |
180 | sudo -u gitlab -H git config --global user.email "gitlab@localhost" | |
181 | sudo -u gitlab -H git config --global core.autocrlf input | |
182 | echo "Create and configure database in /etc/gitlab/database.yml" | |
183 | echo "Then run 'sudo -u gitlab bundle exec rake gitlab:setup RAILS_ENV=production'" | |
184 | echo | |
185 | else | |
186 | systemctl -q try-restart gitlab-unicorn | |
187 | systemctl -q try-start gitlab-sidekiq | |
188 | fi | |
189 | ||
190 | %postun | |
191 | if [ $1 -eq 0 ]; then | |
192 | %userremove gitlab | |
193 | %groupremove gitlab | |
194 | fi | |
195 | ||
196 | %files | |
197 | %defattr(644,root,root,755) | |
198 | %doc LICENSE | |
199 | %dir %{_sysconfdir}/gitlab | |
200 | %config(noreplace) %{_sysconfdir}/gitlab/database.yml | |
201 | %config(noreplace) %{_sysconfdir}/gitlab/gitlab.yml | |
202 | %config(noreplace) %{_sysconfdir}/gitlab/unicorn.rb | |
c7ba61b6 | 203 | %config(noreplace) %{_sysconfdir}/httpd/webapps.d/gitlab.conf |
edff9e13 ER |
204 | /etc/logrotate.d/gitlab.logrotate |
205 | %{systemdunitdir}/gitlab-sidekiq.service | |
206 | %{systemdunitdir}/gitlab-unicorn.service | |
207 | %{systemdunitdir}/gitlab.target | |
208 | %{systemdtmpfilesdir}/gitlab.conf | |
209 | %dir %attr(755,gitlab,gitlab) %{homedir} | |
210 | %dir %attr(755,gitlab,gitlab) %{homedir}/app | |
211 | %attr(-,gitlab,gitlab) %{homedir}/app/* | |
212 | %dir %attr(755,gitlab,gitlab) %{homedir}/bin | |
213 | %attr(-,gitlab,gitlab) %{homedir}/bin/* | |
214 | %dir %attr(755,gitlab,gitlab) %{homedir}/builds | |
edff9e13 ER |
215 | %dir %attr(755,gitlab,gitlab) %{homedir}/config |
216 | %attr(-,gitlab,gitlab) %{homedir}/config/* | |
217 | %dir %attr(755,gitlab,gitlab) %{homedir}/db | |
218 | %attr(-,gitlab,gitlab) %{homedir}/db/* | |
219 | %dir %attr(755,gitlab,gitlab) %{homedir}/doc | |
220 | %attr(-,gitlab,gitlab) %{homedir}/doc/* | |
221 | %dir %attr(755,gitlab,gitlab) %{homedir}/docker | |
222 | %attr(-,gitlab,gitlab) %{homedir}/docker/* | |
223 | %dir %attr(755,gitlab,gitlab) %{homedir}/features | |
224 | %attr(-,gitlab,gitlab) %{homedir}/features/* | |
225 | %dir %attr(755,gitlab,gitlab) %{homedir}/lib | |
226 | %attr(-,gitlab,gitlab) %{homedir}/lib/* | |
edff9e13 ER |
227 | %dir %attr(755,gitlab,gitlab) %{homedir}/pids |
228 | %dir %attr(755,gitlab,gitlab) %{homedir}/public | |
229 | %attr(-,gitlab,gitlab) %{homedir}/public/* | |
230 | %dir %attr(755,gitlab,gitlab) %{homedir}/satellites | |
231 | %dir %attr(755,gitlab,gitlab) %{homedir}/scripts | |
232 | %attr(-,gitlab,gitlab) %{homedir}/scripts/* | |
233 | %dir %attr(755,gitlab,gitlab) %{homedir}/sockets | |
234 | %dir %attr(755,gitlab,gitlab) %{homedir}/spec | |
235 | %attr(-,gitlab,gitlab) %{homedir}/spec/* | |
236 | %dir %attr(755,gitlab,gitlab) %{homedir}/tmp | |
237 | %attr(-,gitlab,gitlab) %{homedir}/tmp/* | |
edff9e13 ER |
238 | %dir %attr(755,gitlab,gitlab) %{homedir}/www |
239 | ||
240 | %dir %attr(755,gitlab,gitlab) %{homedir}/.bundle | |
241 | %attr(-,gitlab,gitlab) %{homedir}/.bundle/config | |
242 | %attr(-,gitlab,gitlab) %{homedir}/.foreman | |
243 | %attr(-,gitlab,gitlab) %{homedir}/docker-compose.yml | |
244 | %attr(-,gitlab,gitlab) %{homedir}/.gitattributes | |
245 | %attr(-,gitlab,gitlab) %{homedir}/.*.yml | |
246 | %attr(-,gitlab,gitlab) %{homedir}/.rspec | |
247 | %attr(-,gitlab,gitlab) %{homedir}/.ruby-version | |
248 | %attr(-,gitlab,gitlab) %{homedir}/.simplecov | |
249 | %attr(-,gitlab,gitlab) %{homedir}/CHANGELOG | |
1bfc7ca0 | 250 | %attr(-,gitlab,gitlab) %{homedir}/GITLAB_WORKHORSE_VERSION |
edff9e13 ER |
251 | %attr(-,gitlab,gitlab) %{homedir}/GITLAB_SHELL_VERSION |
252 | %attr(-,gitlab,gitlab) %{homedir}/Gemfile* | |
253 | %attr(-,gitlab,gitlab) %{homedir}/LICENSE | |
254 | %attr(-,gitlab,gitlab) %{homedir}/*.md | |
255 | %attr(-,gitlab,gitlab) %{homedir}/Procfile | |
256 | %attr(-,gitlab,gitlab) %{homedir}/Rakefile | |
257 | %attr(-,gitlab,gitlab) %{homedir}/VERSION | |
258 | %attr(-,gitlab,gitlab) %{homedir}/config.ru | |
b262a96c | 259 | %attr(-,gitlab,gitlab) %{homedir}/fixtures |
580f84c4 | 260 | |
e4edb538 ER |
261 | %{homedir}/log |
262 | %dir %attr(771,root,gitlab) /var/log/gitlab | |
263 | ||
580f84c4 ER |
264 | %defattr(-,root,root,-) |
265 | %dir %{homedir}/vendor | |
266 | %{homedir}/vendor/* |