]> git.pld-linux.org Git - packages/gitlab-ce.git/blame - gitlab-ce.spec
webapps integration
[packages/gitlab-ce.git] / gitlab-ce.spec
CommitLineData
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
9a13c814 15%bcond_without gem_cache # use local cache to speedup gem installation
1bfc7ca0 16
f68c6e28 17%define shell_version 3.6.1
ae01e8f0 18%define workhorse_version 0.8.2
edff9e13
ER
19Summary: A Web interface to create projects and repositories, manage access and do code reviews
20Name: gitlab-ce
62e38258 21Version: 8.12.7
cb878643 22Release: 0.78
edff9e13
ER
23License: MIT
24Group: Applications/WWW
3af24041 25# md5 deliberately omitted until this package is useful
1bfc7ca0 26Source0: https://github.com/gitlabhq/gitlabhq/archive/v%{version}/%{name}-%{version}.tar.gz
edff9e13
ER
27Source1: gitlab.target
28Source2: gitlab-sidekiq.service
7db376f0
ER
29Source3: gitlab-sidekiq.init
30Source4: gitlab-unicorn.service
31Source5: gitlab-unicorn.init
32Source6: gitlab.logrotate
33Source7: gitlab.tmpfiles.d
b647c30f 34Source8: apache.conf
6ba051e8 35Source9: gitlab-rake.sh
e29cce1b 36Source10: gitconfig
e62d7f31 37Source11: gitlab-ctl.sh
f802be87 38Source12: clean-vendor.sh
98a1e18d 39Source13: nginx.conf
e62d7f31
ER
40Patch0: 3774.patch
41Patch1: pld.patch
c06de8c3 42URL: https://www.gitlab.com/gitlab-ce/
99acef11 43BuildRequires: cmake
b70ed759 44BuildRequires: gmp-devel
8b1af143 45BuildRequires: libgit2-devel
99acef11
ER
46BuildRequires: libicu-devel
47BuildRequires: libstdc++-devel
48BuildRequires: libxml2-devel
99acef11
ER
49BuildRequires: mysql-devel
50BuildRequires: postgresql-devel
8b1af143 51BuildRequires: rpm-rubyprov
e4654b76 52BuildRequires: rpmbuild(macros) >= 1.647
edff9e13 53BuildRequires: ruby-bundler
b70ed759 54BuildRequires: ruby-devel >= 1:2.1.0
99acef11 55BuildRequires: zlib-devel
e17ca829 56Requires(post,preun): /sbin/chkconfig
cb878643 57Requires: webapps
6f80237a 58Requires: git-core >= 2.7.4
e2b8e51a 59Requires: gitlab-common >= 8.12-2
ae01e8f0
ER
60Requires: gitlab-shell >= %{shell_version}
61Requires: gitlab-workhorse >= %{workhorse_version}
0f5b396e 62Requires: nodejs
e17ca829 63Requires: rc-scripts
edff9e13 64Requires: ruby-bundler
e4654b76 65Requires: systemd-units >= 0.38
1bfc7ca0
ER
66Suggests: mysql
67Suggests: redis-server
63c66c76 68Obsoletes: gitlab <= 8.1.4
edff9e13
ER
69BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
70
a92c651e
ER
71%define _noautoreqfiles redcloth_scan.jar primitives.jar
72
cb878643
ER
73%define uname git
74%define gname git
75%define appdir %{_prefix}/lib/gitlab
76%define vardir %{_localstatedir}/lib/gitlab
77%define cachedir %{_localstatedir}/cache/gitlab
78%define _webapps /etc/webapps
79%define _webapp gitlab
edff9e13
ER
80
81%description
82GitLab Community Edition (CE) is open source software to collaborate
83on code. Create projects and repositories, manage access and do code
84reviews. GitLab CE is on-premises software that you can install and
85use on your server(s).
86
54f50e6d
ER
87%package doc
88Summary: Manual for GitLab
89Summary(fr.UTF-8): Documentation pour GitLab
90Summary(it.UTF-8): Documentazione di GitLab
91Summary(pl.UTF-8): Podręcznik dla GitLab
92Group: Documentation
93# noarch subpackages only when building with rpm5
94%if "%{_rpmversion}" >= "5"
95BuildArch: noarch
96%endif
97
98%description doc
99Documentation for GitLab.
100
edff9e13 101%prep
1bfc7ca0 102%setup -qn gitlabhq-%{version}
c06de8c3
ER
103mv config/gitlab.yml.example config/gitlab.yml
104mv config/unicorn.rb.example config/unicorn.rb
575e60f5 105#%patch0 -p1
c06de8c3 106%patch1 -p1
b262a96c 107
e3e185ca
ER
108# use mysql for now
109mv config/database.yml.mysql config/database.yml
110
d6fb12dc 111find -name .gitkeep | xargs rm
99acef11 112
ae01e8f0
ER
113v=$(cat GITLAB_SHELL_VERSION)
114test "$v" = "%{shell_version}"
115v=$(cat GITLAB_WORKHORSE_VERSION)
116test "$v" = "%{workhorse_version}"
117
62a51cfa 118%build
dc27d1e6
ER
119%if %{with gem_cache}
120cachedir="%{_specdir}/cache/%{version}.%{_arch}"
121install -d vendor/bundle
122test -d "$cachedir" && cp -aul "$cachedir"/* vendor/bundle
123%endif
124
1924cc20
ER
125# enable-gems to workaround https://github.com/ruby-prof/ruby-prof/pull/191
126# until https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6026 is merged
127RUBYOPT=--enable-gems \
edff9e13 128bundle install %{_smp_mflags} \
7470b5a8 129 --verbose \
dc27d1e6
ER
130 --deployment \
131 --without development test aws %{!?with_krb5:kerberos}
edff9e13 132
9a13c814
ER
133# install newer rugged to fix diff view showing garbage
134# https://gitlab.com/gitlab-org/gitlab-ce/issues/14972
56adf52c 135v=0.25.0b7
de0b0023 136test -d vendor/bundle/ruby/gems/rugged-$v || \
f1534eb2 137bundle exec gem install -v $v rugged --no-rdoc --no-ri --verbose
9a13c814 138
575e60f5
ER
139# precompile assets
140# use modified config so it doesn't croak
ea8d688f
ER
141cp -p config/gitlab.yml{,.production}
142sed -i -e '/secret_file:/d' config/gitlab.yml
59a3a088 143sed -i -e 's#/var/lib/gitlab/repositories/#./#' config/gitlab.yml
a5202e18 144bundle exec rake RAILS_ENV=production assets:clean assets:precompile USE_DB=false
ea8d688f 145mv -f config/gitlab.yml{.production,}
a3c02bfc 146
a92c651e
ER
147# avoid bogus ruby dep
148chmod a-x vendor/bundle/ruby/gems/unicorn-*/bin/unicorn*
149
a3c02bfc
ER
150# remove secrets, log and cache that assets compile initialized
151rm .gitlab_shell_secret
5ce23bfa 152cp -f config/secrets.yml{.example,}
a3c02bfc
ER
153rm log/production.log
154rm -r tmp/cache/*
155
dc27d1e6
ER
156%if %{with gem_cache}
157install -d "$cachedir"
158cp -aul vendor/bundle/* "$cachedir"
159%endif
160
edff9e13
ER
161%install
162rm -rf $RPM_BUILD_ROOT
163install -d \
044510e0
ER
164 $RPM_BUILD_ROOT%{appdir}/public/{assets,uploads} \
165 $RPM_BUILD_ROOT%{appdir}/satellites \
166 $RPM_BUILD_ROOT%{appdir}/tmp/{cache/assets,sessions,backups} \
edff9e13 167 $RPM_BUILD_ROOT%{_sysconfdir}/gitlab \
cb878643 168 $RPM_BUILD_ROOT%{_webapps}/%{_webapp} \
6eb5e245 169 $RPM_BUILD_ROOT%{_docdir}/gitlab \
001a6cf5 170 $RPM_BUILD_ROOT%{vardir}/public \
0f95858b 171 $RPM_BUILD_ROOT%{cachedir}/tmp \
e2b8e51a 172 $RPM_BUILD_ROOT%{_localstatedir}/run/gitlab
edff9e13 173
b262a96c
ER
174# test if we can hardlink -- %{_builddir} and $RPM_BUILD_ROOT on same partition
175if cp -al VERSION $RPM_BUILD_ROOT/VERSION 2>/dev/null; then
176 l=l
177 rm -f $RPM_BUILD_ROOT/VERSION
178fi
179
044510e0 180cp -a$l . $RPM_BUILD_ROOT%{appdir}
edff9e13 181
f802be87 182# cleanup unneccessary cruft (gem build files, etc)
044510e0 183sh -x %{SOURCE12} $RPM_BUILD_ROOT%{appdir}
f802be87 184
c5b62b37 185# replace the contents, yet leave it believe it has proper version installed (for gem dependencies)
56adf52c 186v=0.25.0b7
c5b62b37 187ov=0.24.0
044510e0
ER
188rm -r $RPM_BUILD_ROOT%{appdir}/vendor/bundle/ruby/extensions/%{_arch}-linux/rugged-$ov
189mv $RPM_BUILD_ROOT%{appdir}/vendor/bundle/ruby/extensions/%{_arch}-linux/rugged-{$v,$ov}
190rm -r $RPM_BUILD_ROOT%{appdir}/vendor/bundle/ruby/gems/rugged-$ov
191mv $RPM_BUILD_ROOT%{appdir}/vendor/bundle/ruby/gems/rugged-{$v,$ov}
c5b62b37 192
fb518a6f 193# rpm cruft from repackaging
044510e0 194rm -f $RPM_BUILD_ROOT%{appdir}/debug*.list
fb518a6f 195
edff9e13 196# Creating links
044510e0
ER
197rmdir $RPM_BUILD_ROOT%{appdir}/{log,tmp/{pids,sockets}}
198ln -s %{_localstatedir}/run/gitlab $RPM_BUILD_ROOT%{appdir}/tmp/pids
199ln -s %{_localstatedir}/run/gitlab $RPM_BUILD_ROOT%{appdir}/tmp/sockets
200ln -s %{_localstatedir}/log/gitlab $RPM_BUILD_ROOT%{appdir}/log
edff9e13 201
ed85de46
ER
202# move $source to $target leaving symlink in original path
203move_symlink() {
fb518a6f
ER
204 local source=$1 target=$2
205 mv $RPM_BUILD_ROOT$source $RPM_BUILD_ROOT$target
206 ln -s $target $RPM_BUILD_ROOT$source
207}
208
edff9e13 209# Install config files
cc64ce98 210for f in gitlab.yml unicorn.rb database.yml secrets.yml; do
044510e0 211 move_symlink %{appdir}/config/$f %{_sysconfdir}/gitlab/$f
edff9e13 212done
b8aa93cf 213move_symlink %{appdir}/.gitlab_workhorse_secret %{_sysconfdir}/gitlab/.gitlab_workhorse_secret
a1aafd5d 214
ed85de46 215cp -p %{SOURCE10} $RPM_BUILD_ROOT%{_sysconfdir}/gitlab/.gitconfig
bdb8455f 216ln -s %{_sysconfdir}/gitlab/.gitconfig $RPM_BUILD_ROOT%{vardir}/.gitconfig
ed85de46 217
c4379f31 218touch $RPM_BUILD_ROOT%{_sysconfdir}/gitlab/skip-auto-migrations
edff9e13 219
a1aafd5d 220# relocate to /etc as it's updated runtime, see 77cff54
044510e0 221move_symlink %{appdir}/db/schema.rb %{_sysconfdir}/gitlab/schema.rb
a1aafd5d 222
a630f38b 223for a in satellites builds shared tmp public/{uploads,assets}; do
044510e0 224 move_symlink %{appdir}/$a %{vardir}/$a
001a6cf5
ER
225done
226
0f95858b
ER
227move_symlink %{vardir}/tmp/cache %{cachedir}/cache
228move_symlink %{vardir}/shared/artifacts/tmp/cache %{cachedir}/artifacts
229
6ba051e8 230install -d $RPM_BUILD_ROOT{%{_sbindir},%{systemdunitdir},%{systemdtmpfilesdir}} \
7db376f0 231 $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d,httpd/webapps.d}
c7ba61b6 232
c7ba61b6 233cp -p %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-sidekiq.service
7db376f0
ER
234install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/gitlab-sidekiq
235cp -p %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-unicorn.service
236install -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/gitlab-unicorn
237
238cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab.target
239cp -p %{SOURCE7} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/gitlab.conf
e2b8e51a 240cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/logrotate.d/gitlab
cb878643 241cp -p %{SOURCE8} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
6ba051e8 242install -p %{SOURCE9} $RPM_BUILD_ROOT%{_sbindir}/gitlab-rake
e62d7f31 243install -p %{SOURCE11} $RPM_BUILD_ROOT%{_sbindir}/gitlab-ctl
edff9e13
ER
244
245%clean
9a13c814 246rm -rf $RPM_BUILD_ROOT
edff9e13 247
a6fcdc58 248%pre
d5651fee 249if [ "$1" = "2" ]; then
a6fcdc58
ER
250 # Looks like an RPM upgrade
251 gitlab-ctl preinst
252fi
253
edff9e13 254%post
e17ca829
ER
255/sbin/chkconfig --add gitlab-sidekiq
256/sbin/chkconfig --add gitlab-unicorn
257%service gitlab-sidekiq restart
258%service gitlab-unicorn restart
e4654b76 259%systemd_post gitlab-sidekiq.service gitlab-unicorn.service
e17ca829 260
e4654b76
ER
261%banner -e -o %{name} << EOF
262
263Create and configure database in %{_sysconfdir}/gitlab/database.yml
264
265Then run:
266 # gitlab-rake gitlab:setup
267
268EOF
edff9e13 269
a6fcdc58
ER
270%posttrans
271if [ "$1" = "0" ]; then
272 # Looks like an RPM upgrade
273 gitlab-ctl posttrans
274fi
275
e17ca829
ER
276%preun
277if [ "$1" = "0" ]; then
278 %service -q gitlab-sidekiq stop
279 %service -q gitlab-unicorn stop
280 /sbin/chkconfig --del gitlab-sidekiq
281 /sbin/chkconfig --del gitlab-unicorn
282fi
e4654b76 283%systemd_preun gitlab-sidekiq.service gitlab-unicorn.service
e17ca829 284
edff9e13
ER
285%postun
286if [ $1 -eq 0 ]; then
287 %userremove gitlab
288 %groupremove gitlab
289fi
e4654b76 290%systemd_reload
edff9e13 291
cb878643
ER
292%triggerin -- apache < 2.2.0, apache-base
293%webapp_register httpd %{_webapp}
294
295%triggerun -- apache < 2.2.0, apache-base
296%webapp_unregister httpd %{_webapp}
297
edff9e13
ER
298%files
299%defattr(644,root,root,755)
300%doc LICENSE
c4379f31
ER
301%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/gitlab/database.yml
302%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/gitlab/gitlab.yml
303%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/gitlab/unicorn.rb
7e1429dd 304%config(noreplace) %verify(not md5 mtime size) %attr(640,%{uname},%{gname}) %{_sysconfdir}/gitlab/schema.rb
5ce23bfa 305%config(noreplace) %verify(not md5 mtime size) %attr(640,%{uname},%{gname}) %{_sysconfdir}/gitlab/secrets.yml
ed85de46 306%config(noreplace) %verify(not md5 mtime size) %attr(640,%{uname},%{gname}) %{_sysconfdir}/gitlab/.gitconfig
b8aa93cf
ER
307%config(noreplace) %verify(not md5 mtime size) %attr(640,%{uname},%{gname}) %{_sysconfdir}/gitlab/.gitlab_workhorse_secret
308
cb878643
ER
309%dir %attr(750,root,http) %{_webapps}/%{_webapp}
310%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
311
c4379f31 312%ghost %{_sysconfdir}/gitlab/skip-auto-migrations
e2b8e51a 313/etc/logrotate.d/gitlab
7db376f0
ER
314%attr(754,root,root) /etc/rc.d/init.d/gitlab-sidekiq
315%attr(754,root,root) /etc/rc.d/init.d/gitlab-unicorn
6ba051e8 316%attr(755,root,root) %{_sbindir}/gitlab-rake
e62d7f31 317%attr(755,root,root) %{_sbindir}/gitlab-ctl
edff9e13
ER
318%{systemdunitdir}/gitlab-sidekiq.service
319%{systemdunitdir}/gitlab-unicorn.service
320%{systemdunitdir}/gitlab.target
321%{systemdtmpfilesdir}/gitlab.conf
ed85de46 322
044510e0
ER
323%dir %{appdir}
324%dir %{appdir}/bin
325%attr(-,root,root) %{appdir}/bin/*
001a6cf5 326# files
044510e0
ER
327%{appdir}/*.md
328%{appdir}/.bundle
b8aa93cf 329%{appdir}/.gitlab_workhorse_secret
044510e0
ER
330%{appdir}/.ruby-version
331%{appdir}/CHANGELOG
332%{appdir}/GITLAB_SHELL_VERSION
333%{appdir}/GITLAB_WORKHORSE_VERSION
334%{appdir}/Gemfile*
335%{appdir}/LICENSE
336%{appdir}/Rakefile
337%{appdir}/VERSION
338%{appdir}/config.ru
001a6cf5
ER
339
340# dirs
044510e0
ER
341%{appdir}/app
342%{appdir}/builds
343%{appdir}/config
344%{appdir}/db
345%{appdir}/fixtures
346%{appdir}/generator_templates
347%{appdir}/lib
348%{appdir}/log
349%{appdir}/public
350%{appdir}/shared
351%{appdir}/tmp
352%{appdir}/satellites
001a6cf5 353
bdb8455f 354%{vardir}/.gitconfig
001a6cf5 355%dir %attr(755,%{uname},%{gname}) %{vardir}/satellites
a630f38b 356%dir %attr(755,%{uname},%{gname}) %{vardir}/builds
7ae6188a 357%dir %{vardir}/public
001a6cf5
ER
358%attr(-,%{uname},%{gname}) %{vardir}/public/uploads
359%attr(-,%{uname},%{gname}) %{vardir}/public/assets
360%dir %attr(755,%{uname},%{gname}) %{vardir}/tmp
361%attr(-,%{uname},%{gname}) %{vardir}/tmp/backups
0f95858b 362%{vardir}/tmp/cache
001a6cf5
ER
363%attr(-,%{uname},%{gname}) %{vardir}/tmp/sessions
364%attr(-,%{uname},%{gname}) %{vardir}/tmp/sockets
365%attr(-,%{uname},%{gname}) %{vardir}/tmp/pids
366%dir %attr(750,%{uname},%{gname}) %{vardir}/shared
367%dir %attr(750,%{uname},%{gname}) %{vardir}/shared/artifacts
368%dir %attr(750,%{uname},%{gname}) %{vardir}/shared/artifacts/tmp
0f95858b 369%{vardir}/shared/artifacts/tmp/cache
001a6cf5
ER
370%dir %attr(750,%{uname},%{gname}) %{vardir}/shared/artifacts/tmp/uploads
371%dir %attr(750,%{uname},%{gname}) %{vardir}/shared/lfs-objects
372%dir %attr(750,%{uname},%{gname}) %{vardir}/shared/registry
373
0f95858b
ER
374%dir %attr(750,root,%{gname}) %{cachedir}
375%attr(-,%{uname},%{gname}) %{cachedir}/cache
376%dir %attr(750,%{uname},%{gname}) %{cachedir}/artifacts
7ae6188a 377
bab42173 378%dir %attr(771,root,%{gname}) %{_localstatedir}/run/gitlab
e4edb538 379
580f84c4 380%defattr(-,root,root,-)
044510e0
ER
381%dir %{appdir}/vendor
382%{appdir}/vendor/*
54f50e6d
ER
383
384%files doc
385%defattr(644,root,root,755)
044510e0 386%{appdir}/doc
This page took 0.107968 seconds and 4 git commands to generate.