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