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.
7 # install notes: https://gitlab.com/gitlab-org/gitlab-ce/blob/v8.6.6/doc/install/installation.md
10 # - [timfel-krb5-auth] doesn't build with heimdal (https://github.com/timfel/krb5-auth/issues/8)
14 %bcond_with krb5 # build with kerberos support
15 %bcond_without gem_cache # use local to speedup gem installation
17 Summary: A Web interface to create projects and repositories, manage access and do code reviews
22 Group: Applications/WWW
23 # md5 deliberately omitted until this package is useful
24 Source0: https://github.com/gitlabhq/gitlabhq/archive/v%{version}/%{name}-%{version}.tar.gz
25 Patch0: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3774.patch
27 Patch2: bug-14972.patch
28 Source1: gitlab.target
29 Source2: gitlab-sidekiq.service
30 Source3: gitlab-sidekiq.init
31 Source4: gitlab-unicorn.service
32 Source5: gitlab-unicorn.init
33 Source6: gitlab.logrotate
34 Source7: gitlab.tmpfiles.d
35 Source8: gitlab-apache-conf
36 Source9: gitlab-rake.sh
38 URL: https://www.gitlab.com/gitlab-ce/
40 BuildRequires: gmp-devel
41 BuildRequires: libgit2-devel
42 BuildRequires: libicu-devel
43 BuildRequires: libstdc++-devel
44 BuildRequires: libxml2-devel
45 BuildRequires: mysql-devel
46 BuildRequires: postgresql-devel
47 BuildRequires: rpm-rubyprov
48 BuildRequires: ruby-bundler
49 BuildRequires: ruby-devel >= 1:2.1.0
50 BuildRequires: zlib-devel
52 Requires: git-core >= 2.7.4
53 Requires: gitlab-shell >= 2.7.2
55 Requires: ruby-bundler
57 Suggests: redis-server
58 Obsoletes: gitlab <= 8.1.4
59 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
61 %define _noautoreqfiles redcloth_scan.jar primitives.jar
65 %define homedir %{_localstatedir}/lib/gitlab
68 GitLab Community Edition (CE) is open source software to collaborate
69 on code. Create projects and repositories, manage access and do code
70 reviews. GitLab CE is on-premises software that you can install and
71 use on your server(s).
74 %setup -qn gitlabhq-%{version}
75 mv config/gitlab.yml.example config/gitlab.yml
76 mv config/unicorn.rb.example config/unicorn.rb
82 mv config/database.yml.mysql config/database.yml
84 find -name .gitkeep | xargs rm
87 rm -r lib/support/{deploy,init.d}
104 rm bin/pkgr_before_precompile.sh
105 rm docker-compose.yml
108 %if %{with gem_cache}
109 cachedir="%{_specdir}/cache/%{version}.%{_arch}"
110 install -d vendor/bundle
111 test -d "$cachedir" && cp -aul "$cachedir"/* vendor/bundle
114 bundle install %{_smp_mflags} \
117 --without development test aws %{!?with_krb5:kerberos}
119 cp -p config/gitlab.yml{,.production}
120 sed -i -e '/secret_file:/d' config/gitlab.yml
121 bundle exec rake RAILS_ENV=production assets:clean assets:precompile USE_DB=false
122 mv -f config/gitlab.yml{.production,}
124 # avoid bogus ruby dep
125 chmod a-x vendor/bundle/ruby/gems/unicorn-*/bin/unicorn*
127 # remove secrets, log and cache that assets compile initialized
128 rm .gitlab_shell_secret
130 rm config/secrets.yml
131 rm log/production.log
134 %if %{with gem_cache}
135 install -d "$cachedir"
136 cp -aul vendor/bundle/* "$cachedir"
140 rm -rf $RPM_BUILD_ROOT
142 $RPM_BUILD_ROOT%{homedir}/www \
143 $RPM_BUILD_ROOT%{homedir}/public/{assets,uploads} \
144 $RPM_BUILD_ROOT%{homedir}/satellites \
145 $RPM_BUILD_ROOT%{homedir}/tmp/{cache/assets,sessions,backups} \
146 $RPM_BUILD_ROOT%{_sysconfdir}/gitlab \
147 $RPM_BUILD_ROOT%{_docdir}/gitlab \
148 $RPM_BUILD_ROOT%{_localstatedir}/{run,log}/gitlab
150 # test if we can hardlink -- %{_builddir} and $RPM_BUILD_ROOT on same partition
151 if cp -al VERSION $RPM_BUILD_ROOT/VERSION 2>/dev/null; then
153 rm -f $RPM_BUILD_ROOT/VERSION
156 cp -a$l . $RPM_BUILD_ROOT%{homedir}
158 # rpm cruft from repackaging
159 rm -f $RPM_BUILD_ROOT%{homedir}/debug*.list
162 chmod -R u+w $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/*/test
163 rm -r $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/*/test
166 rmdir $RPM_BUILD_ROOT%{homedir}/{log,tmp/{pids,sockets}}
167 ln -s %{_localstatedir}/run/gitlab $RPM_BUILD_ROOT%{homedir}/tmp/pids
168 ln -s %{_localstatedir}/run/gitlab $RPM_BUILD_ROOT%{homedir}/tmp/sockets
169 ln -s %{_localstatedir}/log/gitlab $RPM_BUILD_ROOT%{homedir}/log
172 local source=$1 target=$2
173 mv $RPM_BUILD_ROOT$source $RPM_BUILD_ROOT$target
174 ln -s $target $RPM_BUILD_ROOT$source
177 # Install config files
178 for f in gitlab.yml unicorn.rb database.yml; do
179 move_config %{homedir}/config/$f %{_sysconfdir}/gitlab/$f
182 install -d $RPM_BUILD_ROOT{%{_sbindir},%{systemdunitdir},%{systemdtmpfilesdir}} \
183 $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d,httpd/webapps.d}
185 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-sidekiq.service
186 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/gitlab-sidekiq
187 cp -p %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-unicorn.service
188 install -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/gitlab-unicorn
190 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab.target
191 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/gitlab.conf
192 cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/logrotate.d/gitlab.logrotate
193 cp -p %{SOURCE8} $RPM_BUILD_ROOT/etc/httpd/webapps.d/gitlab.conf
194 cp -p %{SOURCE10} $RPM_BUILD_ROOT%{homedir}/.gitconfig
195 install -p %{SOURCE9} $RPM_BUILD_ROOT%{_sbindir}/gitlab-rake
198 rm -rf "$RPM_BUILD_ROOT"
201 if [ $1 -ge 1 ]; then
202 systemctl -q daemon-reload
203 systemd-tmpfiles --create %{systemdtmpfilesdir}/gitlab.conf
204 [ -e %{_localstatedir}/lock/subsys/httpd ] && service httpd reload || :
206 if [ $1 -eq 1 ]; then
207 systemctl -q enable gitlab-unicorn
208 systemctl -q enable gitlab-sidekiq
209 systemctl -q enable gitlab.target
210 systemctl -q start gitlab-unicorn
211 systemctl -q start gitlab-sidekiq
212 systemctl -q start gitlab.target
213 echo "Create and configure database in /etc/gitlab/database.yml"
214 echo "Then run 'sudo -u gitlab bundle exec rake gitlab:setup RAILS_ENV=production'"
217 systemctl -q try-restart gitlab-unicorn || :
218 systemctl -q try-start gitlab-sidekiq || :
222 if [ $1 -eq 0 ]; then
228 %defattr(644,root,root,755)
230 %config(noreplace) %{_sysconfdir}/gitlab/database.yml
231 %config(noreplace) %{_sysconfdir}/gitlab/gitlab.yml
232 %config(noreplace) %{_sysconfdir}/gitlab/unicorn.rb
233 %config(noreplace) %{_sysconfdir}/httpd/webapps.d/gitlab.conf
234 /etc/logrotate.d/gitlab.logrotate
235 %attr(754,root,root) /etc/rc.d/init.d/gitlab-sidekiq
236 %attr(754,root,root) /etc/rc.d/init.d/gitlab-unicorn
237 %attr(755,root,root) %{_sbindir}/gitlab-rake
238 %{systemdunitdir}/gitlab-sidekiq.service
239 %{systemdunitdir}/gitlab-unicorn.service
240 %{systemdunitdir}/gitlab.target
241 %{systemdtmpfilesdir}/gitlab.conf
242 %dir %attr(755,%{uname},%{gname}) %{homedir}
243 %dir %attr(640,%{uname},%{gname}) %{homedir}/.gitconfig
244 %dir %attr(755,%{uname},%{gname}) %{homedir}/app
245 %attr(-,%{uname},%{gname}) %{homedir}/app/*
246 %dir %attr(755,%{uname},%{gname}) %{homedir}/bin
247 %attr(-,%{uname},%{gname}) %{homedir}/bin/*
248 %dir %attr(755,%{uname},%{gname}) %{homedir}/builds
249 %dir %attr(755,%{uname},%{gname}) %{homedir}/config
250 %attr(-,%{uname},%{gname}) %{homedir}/config/*
251 %dir %attr(755,%{uname},%{gname}) %{homedir}/db
252 %attr(-,%{uname},%{gname}) %{homedir}/db/*
253 %dir %attr(755,%{uname},%{gname}) %{homedir}/doc
254 %attr(-,%{uname},%{gname}) %{homedir}/doc/*
255 %dir %attr(755,%{uname},%{gname}) %{homedir}/lib
256 %attr(-,%{uname},%{gname}) %{homedir}/lib/*
259 %{homedir}/generator_templates
261 %dir %{homedir}/public
263 %{homedir}/public/*.*
264 %attr(-,%{uname},%{gname}) %{homedir}/public/uploads
265 %attr(-,%{uname},%{gname}) %{homedir}/public/assets
266 %dir %attr(755,%{uname},%{gname}) %{homedir}/satellites
268 %dir %attr(755,%{uname},%{gname}) %{homedir}/tmp
269 %attr(-,%{uname},%{gname}) %{homedir}/tmp/backups
270 %attr(-,%{uname},%{gname}) %{homedir}/tmp/cache
271 %attr(-,%{uname},%{gname}) %{homedir}/tmp/sessions
272 %attr(-,%{uname},%{gname}) %{homedir}/tmp/sockets
273 %attr(-,%{uname},%{gname}) %{homedir}/tmp/pids
275 %dir %attr(755,%{uname},%{gname}) %{homedir}/www
277 %dir %attr(750,%{uname},%{gname}) %{homedir}/shared
278 %dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts
279 %dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts/tmp
280 %dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts/tmp/cache
281 %dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts/tmp/uploads
282 %dir %attr(750,%{uname},%{gname}) %{homedir}/shared/lfs-objects
283 %dir %attr(750,%{uname},%{gname}) %{homedir}/shared/registry
285 %dir %attr(755,%{uname},%{gname}) %{homedir}/.bundle
286 %attr(-,%{uname},%{gname}) %{homedir}/.bundle/config
287 %attr(-,%{uname},%{gname}) %{homedir}/.ruby-version
288 %attr(-,%{uname},%{gname}) %{homedir}/CHANGELOG
289 %attr(-,%{uname},%{gname}) %{homedir}/GITLAB_WORKHORSE_VERSION
290 %attr(-,%{uname},%{gname}) %{homedir}/GITLAB_SHELL_VERSION
291 %attr(-,%{uname},%{gname}) %{homedir}/Gemfile*
292 %attr(-,%{uname},%{gname}) %{homedir}/LICENSE
293 %attr(-,%{uname},%{gname}) %{homedir}/*.md
294 %attr(-,%{uname},%{gname}) %{homedir}/Rakefile
295 %attr(-,%{uname},%{gname}) %{homedir}/VERSION
296 %attr(-,%{uname},%{gname}) %{homedir}/config.ru
299 %dir %attr(771,root,%{gname}) %{_localstatedir}/log/gitlab
300 %dir %attr(771,root,%{gname}) %{_localstatedir}/run/gitlab
302 %defattr(-,root,root,-)
303 %dir %{homedir}/vendor