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 Source1: gitlab.target
28 Source2: gitlab-sidekiq.service
29 Source3: gitlab-sidekiq.init
30 Source4: gitlab-unicorn.service
31 Source5: gitlab-unicorn.init
32 Source6: gitlab.logrotate
33 Source7: gitlab.tmpfiles.d
34 Source8: gitlab-apache-conf
35 Source9: gitlab-rake.sh
37 URL: https://www.gitlab.com/gitlab-ce/
39 BuildRequires: gmp-devel
40 BuildRequires: libgit2-devel
41 BuildRequires: libicu-devel
42 BuildRequires: libstdc++-devel
43 BuildRequires: libxml2-devel
44 BuildRequires: mysql-devel
45 BuildRequires: postgresql-devel
46 BuildRequires: rpm-rubyprov
47 BuildRequires: ruby-bundler
48 BuildRequires: ruby-devel >= 1:2.1.0
49 BuildRequires: zlib-devel
51 Requires: git-core >= 2.7.4
52 Requires: gitlab-shell >= 2.7.2
54 Requires: ruby-bundler
56 Suggests: redis-server
57 Obsoletes: gitlab <= 8.1.4
58 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
60 %define _noautoreqfiles redcloth_scan.jar primitives.jar
64 %define homedir %{_localstatedir}/lib/gitlab
67 GitLab Community Edition (CE) is open source software to collaborate
68 on code. Create projects and repositories, manage access and do code
69 reviews. GitLab CE is on-premises software that you can install and
70 use on your server(s).
73 %setup -qn gitlabhq-%{version}
74 mv config/gitlab.yml.example config/gitlab.yml
75 mv config/unicorn.rb.example config/unicorn.rb
80 mv config/database.yml.mysql config/database.yml
82 find -name .gitkeep | xargs rm
85 rm -r lib/support/{deploy,init.d}
102 rm bin/pkgr_before_precompile.sh
103 rm docker-compose.yml
106 %if %{with gem_cache}
107 cachedir="%{_specdir}/cache/%{version}.%{_arch}"
108 install -d vendor/bundle
109 test -d "$cachedir" && cp -aul "$cachedir"/* vendor/bundle
112 bundle install %{_smp_mflags} \
115 --without development test aws %{!?with_krb5:kerberos}
117 cp -p config/gitlab.yml{,.production}
118 sed -i -e '/secret_file:/d' config/gitlab.yml
119 bundle exec rake RAILS_ENV=production assets:clean assets:precompile USE_DB=false
120 mv -f config/gitlab.yml{.production,}
122 # avoid bogus ruby dep
123 chmod a-x vendor/bundle/ruby/gems/unicorn-*/bin/unicorn*
125 # remove secrets, log and cache that assets compile initialized
126 rm .gitlab_shell_secret
128 rm config/secrets.yml
129 rm log/production.log
132 %if %{with gem_cache}
133 install -d "$cachedir"
134 cp -aul vendor/bundle/* "$cachedir"
138 rm -rf $RPM_BUILD_ROOT
140 $RPM_BUILD_ROOT%{homedir}/www \
141 $RPM_BUILD_ROOT%{homedir}/public/{assets,uploads} \
142 $RPM_BUILD_ROOT%{homedir}/satellites \
143 $RPM_BUILD_ROOT%{homedir}/tmp/{cache/assets,sessions,backups} \
144 $RPM_BUILD_ROOT%{_sysconfdir}/gitlab \
145 $RPM_BUILD_ROOT%{_docdir}/gitlab \
146 $RPM_BUILD_ROOT%{_localstatedir}/{run,log}/gitlab
148 # test if we can hardlink -- %{_builddir} and $RPM_BUILD_ROOT on same partition
149 if cp -al VERSION $RPM_BUILD_ROOT/VERSION 2>/dev/null; then
151 rm -f $RPM_BUILD_ROOT/VERSION
154 cp -a$l . $RPM_BUILD_ROOT%{homedir}
156 # rpm cruft from repackaging
157 rm -f $RPM_BUILD_ROOT%{homedir}/debug*.list
160 chmod -R u+w $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/*/test
161 rm -r $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/*/test
164 rmdir $RPM_BUILD_ROOT%{homedir}/{log,tmp/{pids,sockets}}
165 ln -s %{_localstatedir}/run/gitlab $RPM_BUILD_ROOT%{homedir}/tmp/pids
166 ln -s %{_localstatedir}/run/gitlab $RPM_BUILD_ROOT%{homedir}/tmp/sockets
167 ln -s %{_localstatedir}/log/gitlab $RPM_BUILD_ROOT%{homedir}/log
170 local source=$1 target=$2
171 mv $RPM_BUILD_ROOT$source $RPM_BUILD_ROOT$target
172 ln -s $target $RPM_BUILD_ROOT$source
175 # Install config files
176 for f in gitlab.yml unicorn.rb database.yml; do
177 move_config %{homedir}/config/$f %{_sysconfdir}/gitlab/$f
180 install -d $RPM_BUILD_ROOT{%{_sbindir},%{systemdunitdir},%{systemdtmpfilesdir}} \
181 $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d,httpd/webapps.d}
183 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-sidekiq.service
184 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/gitlab-sidekiq
185 cp -p %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-unicorn.service
186 install -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/gitlab-unicorn
188 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab.target
189 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/gitlab.conf
190 cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/logrotate.d/gitlab.logrotate
191 cp -p %{SOURCE8} $RPM_BUILD_ROOT/etc/httpd/webapps.d/gitlab.conf
192 cp -p %{SOURCE10} $RPM_BUILD_ROOT%{homedir}/.gitconfig
193 install -p %{SOURCE9} $RPM_BUILD_ROOT%{_sbindir}/gitlab-rake
196 rm -rf "$RPM_BUILD_ROOT"
199 if [ $1 -ge 1 ]; then
200 systemctl -q daemon-reload
201 systemd-tmpfiles --create %{systemdtmpfilesdir}/gitlab.conf
202 [ -e %{_localstatedir}/lock/subsys/httpd ] && service httpd reload || :
204 if [ $1 -eq 1 ]; then
205 systemctl -q enable gitlab-unicorn
206 systemctl -q enable gitlab-sidekiq
207 systemctl -q enable gitlab.target
208 systemctl -q start gitlab-unicorn
209 systemctl -q start gitlab-sidekiq
210 systemctl -q start gitlab.target
211 echo "Create and configure database in /etc/gitlab/database.yml"
212 echo "Then run 'sudo -u gitlab bundle exec rake gitlab:setup RAILS_ENV=production'"
215 systemctl -q try-restart gitlab-unicorn || :
216 systemctl -q try-start gitlab-sidekiq || :
220 if [ $1 -eq 0 ]; then
226 %defattr(644,root,root,755)
228 %config(noreplace) %{_sysconfdir}/gitlab/database.yml
229 %config(noreplace) %{_sysconfdir}/gitlab/gitlab.yml
230 %config(noreplace) %{_sysconfdir}/gitlab/unicorn.rb
231 %config(noreplace) %{_sysconfdir}/httpd/webapps.d/gitlab.conf
232 /etc/logrotate.d/gitlab.logrotate
233 %attr(754,root,root) /etc/rc.d/init.d/gitlab-sidekiq
234 %attr(754,root,root) /etc/rc.d/init.d/gitlab-unicorn
235 %attr(755,root,root) %{_sbindir}/gitlab-rake
236 %{systemdunitdir}/gitlab-sidekiq.service
237 %{systemdunitdir}/gitlab-unicorn.service
238 %{systemdunitdir}/gitlab.target
239 %{systemdtmpfilesdir}/gitlab.conf
240 %dir %attr(755,%{uname},%{gname}) %{homedir}
241 %dir %attr(640,%{uname},%{gname}) %{homedir}/.gitconfig
242 %dir %attr(755,%{uname},%{gname}) %{homedir}/app
243 %attr(-,%{uname},%{gname}) %{homedir}/app/*
244 %dir %attr(755,%{uname},%{gname}) %{homedir}/bin
245 %attr(-,%{uname},%{gname}) %{homedir}/bin/*
246 %dir %attr(755,%{uname},%{gname}) %{homedir}/builds
247 %dir %attr(755,%{uname},%{gname}) %{homedir}/config
248 %attr(-,%{uname},%{gname}) %{homedir}/config/*
249 %dir %attr(755,%{uname},%{gname}) %{homedir}/db
250 %attr(-,%{uname},%{gname}) %{homedir}/db/*
251 %dir %attr(755,%{uname},%{gname}) %{homedir}/doc
252 %attr(-,%{uname},%{gname}) %{homedir}/doc/*
253 %dir %attr(755,%{uname},%{gname}) %{homedir}/lib
254 %attr(-,%{uname},%{gname}) %{homedir}/lib/*
257 %{homedir}/generator_templates
259 %dir %{homedir}/public
261 %{homedir}/public/*.*
262 %attr(-,%{uname},%{gname}) %{homedir}/public/uploads
263 %attr(-,%{uname},%{gname}) %{homedir}/public/assets
264 %dir %attr(755,%{uname},%{gname}) %{homedir}/satellites
266 %dir %attr(755,%{uname},%{gname}) %{homedir}/tmp
267 %attr(-,%{uname},%{gname}) %{homedir}/tmp/backups
268 %attr(-,%{uname},%{gname}) %{homedir}/tmp/cache
269 %attr(-,%{uname},%{gname}) %{homedir}/tmp/sessions
270 %attr(-,%{uname},%{gname}) %{homedir}/tmp/sockets
271 %attr(-,%{uname},%{gname}) %{homedir}/tmp/pids
273 %dir %attr(755,%{uname},%{gname}) %{homedir}/www
275 %dir %attr(750,%{uname},%{gname}) %{homedir}/shared
276 %dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts
277 %dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts/tmp
278 %dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts/tmp/cache
279 %dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts/tmp/uploads
280 %dir %attr(750,%{uname},%{gname}) %{homedir}/shared/lfs-objects
281 %dir %attr(750,%{uname},%{gname}) %{homedir}/shared/registry
283 %dir %attr(755,%{uname},%{gname}) %{homedir}/.bundle
284 %attr(-,%{uname},%{gname}) %{homedir}/.bundle/config
285 %attr(-,%{uname},%{gname}) %{homedir}/.ruby-version
286 %attr(-,%{uname},%{gname}) %{homedir}/CHANGELOG
287 %attr(-,%{uname},%{gname}) %{homedir}/GITLAB_WORKHORSE_VERSION
288 %attr(-,%{uname},%{gname}) %{homedir}/GITLAB_SHELL_VERSION
289 %attr(-,%{uname},%{gname}) %{homedir}/Gemfile*
290 %attr(-,%{uname},%{gname}) %{homedir}/LICENSE
291 %attr(-,%{uname},%{gname}) %{homedir}/*.md
292 %attr(-,%{uname},%{gname}) %{homedir}/Rakefile
293 %attr(-,%{uname},%{gname}) %{homedir}/VERSION
294 %attr(-,%{uname},%{gname}) %{homedir}/config.ru
297 %dir %attr(771,root,%{gname}) %{_localstatedir}/log/gitlab
298 %dir %attr(771,root,%{gname}) %{_localstatedir}/run/gitlab
300 %defattr(-,root,root,-)
301 %dir %{homedir}/vendor