]> git.pld-linux.org Git - packages/gitlab-ce.git/blame - gitlab-ce.spec
add sysv initscripts scriptlets
[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
dc27d1e6 15%bcond_without gem_cache # use local to speedup gem installation
1bfc7ca0 16
edff9e13
ER
17Summary: A Web interface to create projects and repositories, manage access and do code reviews
18Name: gitlab-ce
e2d7a1f0 19Version: 8.8.1
e62d7f31 20Release: 0.34
edff9e13
ER
21License: MIT
22Group: Applications/WWW
3af24041 23# md5 deliberately omitted until this package is useful
1bfc7ca0 24Source0: https://github.com/gitlabhq/gitlabhq/archive/v%{version}/%{name}-%{version}.tar.gz
edff9e13
ER
25Source1: gitlab.target
26Source2: gitlab-sidekiq.service
7db376f0
ER
27Source3: gitlab-sidekiq.init
28Source4: gitlab-unicorn.service
29Source5: gitlab-unicorn.init
30Source6: gitlab.logrotate
31Source7: gitlab.tmpfiles.d
32Source8: gitlab-apache-conf
6ba051e8 33Source9: gitlab-rake.sh
e29cce1b 34Source10: gitconfig
e62d7f31
ER
35Source11: gitlab-ctl.sh
36Patch0: 3774.patch
37Patch1: pld.patch
38Patch2: bug-14972.patch
c06de8c3 39URL: https://www.gitlab.com/gitlab-ce/
99acef11 40BuildRequires: cmake
b70ed759 41BuildRequires: gmp-devel
8b1af143 42BuildRequires: libgit2-devel
99acef11
ER
43BuildRequires: libicu-devel
44BuildRequires: libstdc++-devel
45BuildRequires: libxml2-devel
99acef11
ER
46BuildRequires: mysql-devel
47BuildRequires: postgresql-devel
8b1af143 48BuildRequires: rpm-rubyprov
e17ca829 49BuildRequires: rpmbuild(macros) >= 1.228
edff9e13 50BuildRequires: ruby-bundler
b70ed759 51BuildRequires: ruby-devel >= 1:2.1.0
99acef11 52BuildRequires: zlib-devel
e17ca829 53Requires(post,preun): /sbin/chkconfig
edff9e13 54Requires: apache-base
6f80237a 55Requires: git-core >= 2.7.4
63c66c76 56Requires: gitlab-shell >= 2.7.2
0f5b396e 57Requires: nodejs
e17ca829 58Requires: rc-scripts
edff9e13 59Requires: ruby-bundler
1bfc7ca0
ER
60Suggests: mysql
61Suggests: redis-server
63c66c76 62Obsoletes: gitlab <= 8.1.4
edff9e13
ER
63BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
64
a92c651e
ER
65%define _noautoreqfiles redcloth_scan.jar primitives.jar
66
e2b24ef1
G
67%define uname git
68%define gname git
69%define homedir %{_localstatedir}/lib/gitlab
edff9e13
ER
70
71%description
72GitLab Community Edition (CE) is open source software to collaborate
73on code. Create projects and repositories, manage access and do code
74reviews. GitLab CE is on-premises software that you can install and
75use on your server(s).
76
77%prep
1bfc7ca0 78%setup -qn gitlabhq-%{version}
c06de8c3
ER
79mv config/gitlab.yml.example config/gitlab.yml
80mv config/unicorn.rb.example config/unicorn.rb
79bdc113 81%patch0 -p1
c06de8c3 82%patch1 -p1
55a3700b 83%patch2 -p1
b262a96c 84
e3e185ca
ER
85# use mysql for now
86mv config/database.yml.mysql config/database.yml
87
d6fb12dc
ER
88find -name .gitkeep | xargs rm
89rm -r docker
90rm -r features
d6fb12dc
ER
91rm -r lib/support/{deploy,init.d}
92rm -r scripts
93rm -r spec
6f80237a 94rm .csscomb.json
d6fb12dc
ER
95rm .flayignore
96rm .foreman
cd662819 97rm .gitattributes
d6fb12dc
ER
98rm .gitignore
99rm .gitlab-ci.yml
100rm .hound.yml
101rm .pkgr.yml
102rm .rspec
103rm .rubocop.yml
104rm .scss-lint.yml
105rm .simplecov
106rm .teatro.yml
107rm Procfile
108rm bin/pkgr_before_precompile.sh
298ba786 109rm docker-compose.yml
99acef11 110
edff9e13 111%build
dc27d1e6
ER
112%if %{with gem_cache}
113cachedir="%{_specdir}/cache/%{version}.%{_arch}"
114install -d vendor/bundle
115test -d "$cachedir" && cp -aul "$cachedir"/* vendor/bundle
116%endif
117
edff9e13 118bundle install %{_smp_mflags} \
7470b5a8 119 --verbose \
dc27d1e6
ER
120 --deployment \
121 --without development test aws %{!?with_krb5:kerberos}
edff9e13 122
ea8d688f
ER
123cp -p config/gitlab.yml{,.production}
124sed -i -e '/secret_file:/d' config/gitlab.yml
a5202e18 125bundle exec rake RAILS_ENV=production assets:clean assets:precompile USE_DB=false
ea8d688f 126mv -f config/gitlab.yml{.production,}
a3c02bfc 127
a92c651e
ER
128# avoid bogus ruby dep
129chmod a-x vendor/bundle/ruby/gems/unicorn-*/bin/unicorn*
130
a3c02bfc
ER
131# remove secrets, log and cache that assets compile initialized
132rm .gitlab_shell_secret
133rm .secret
134rm config/secrets.yml
135rm log/production.log
136rm -r tmp/cache/*
137
dc27d1e6
ER
138%if %{with gem_cache}
139install -d "$cachedir"
140cp -aul vendor/bundle/* "$cachedir"
141%endif
142
edff9e13
ER
143%install
144rm -rf $RPM_BUILD_ROOT
145install -d \
6eb5e245
ER
146 $RPM_BUILD_ROOT%{homedir}/www \
147 $RPM_BUILD_ROOT%{homedir}/public/{assets,uploads} \
148 $RPM_BUILD_ROOT%{homedir}/satellites \
1a7bab8e 149 $RPM_BUILD_ROOT%{homedir}/tmp/{cache/assets,sessions,backups} \
edff9e13 150 $RPM_BUILD_ROOT%{_sysconfdir}/gitlab \
6eb5e245 151 $RPM_BUILD_ROOT%{_docdir}/gitlab \
bab42173 152 $RPM_BUILD_ROOT%{_localstatedir}/{run,log}/gitlab
edff9e13 153
b262a96c
ER
154# test if we can hardlink -- %{_builddir} and $RPM_BUILD_ROOT on same partition
155if cp -al VERSION $RPM_BUILD_ROOT/VERSION 2>/dev/null; then
156 l=l
157 rm -f $RPM_BUILD_ROOT/VERSION
158fi
159
160cp -a$l . $RPM_BUILD_ROOT%{homedir}
edff9e13 161
fb518a6f
ER
162# rpm cruft from repackaging
163rm -f $RPM_BUILD_ROOT%{homedir}/debug*.list
164
321d2ad5
ER
165# nuke tests
166chmod -R u+w $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/*/test
167rm -r $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/*/test
168
edff9e13 169# Creating links
bab42173
ER
170rmdir $RPM_BUILD_ROOT%{homedir}/{log,tmp/{pids,sockets}}
171ln -s %{_localstatedir}/run/gitlab $RPM_BUILD_ROOT%{homedir}/tmp/pids
172ln -s %{_localstatedir}/run/gitlab $RPM_BUILD_ROOT%{homedir}/tmp/sockets
173ln -s %{_localstatedir}/log/gitlab $RPM_BUILD_ROOT%{homedir}/log
edff9e13 174
fb518a6f
ER
175move_config() {
176 local source=$1 target=$2
177 mv $RPM_BUILD_ROOT$source $RPM_BUILD_ROOT$target
178 ln -s $target $RPM_BUILD_ROOT$source
179}
180
edff9e13
ER
181# Install config files
182for f in gitlab.yml unicorn.rb database.yml; do
fb518a6f 183 move_config %{homedir}/config/$f %{_sysconfdir}/gitlab/$f
edff9e13
ER
184done
185
6ba051e8 186install -d $RPM_BUILD_ROOT{%{_sbindir},%{systemdunitdir},%{systemdtmpfilesdir}} \
7db376f0 187 $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d,httpd/webapps.d}
c7ba61b6 188
c7ba61b6 189cp -p %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-sidekiq.service
7db376f0
ER
190install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/gitlab-sidekiq
191cp -p %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-unicorn.service
192install -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/gitlab-unicorn
193
194cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab.target
195cp -p %{SOURCE7} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/gitlab.conf
196cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/logrotate.d/gitlab.logrotate
197cp -p %{SOURCE8} $RPM_BUILD_ROOT/etc/httpd/webapps.d/gitlab.conf
e29cce1b 198cp -p %{SOURCE10} $RPM_BUILD_ROOT%{homedir}/.gitconfig
6ba051e8 199install -p %{SOURCE9} $RPM_BUILD_ROOT%{_sbindir}/gitlab-rake
e62d7f31 200install -p %{SOURCE11} $RPM_BUILD_ROOT%{_sbindir}/gitlab-ctl
edff9e13
ER
201
202%clean
203rm -rf "$RPM_BUILD_ROOT"
204
edff9e13 205%post
e17ca829
ER
206/sbin/chkconfig --add gitlab-sidekiq
207/sbin/chkconfig --add gitlab-unicorn
208%service gitlab-sidekiq restart
209%service gitlab-unicorn restart
210
edff9e13
ER
211if [ $1 -ge 1 ]; then
212 systemctl -q daemon-reload
213 systemd-tmpfiles --create %{systemdtmpfilesdir}/gitlab.conf
214 [ -e %{_localstatedir}/lock/subsys/httpd ] && service httpd reload || :
215fi
216if [ $1 -eq 1 ]; then
217 systemctl -q enable gitlab-unicorn
218 systemctl -q enable gitlab-sidekiq
219 systemctl -q enable gitlab.target
220 systemctl -q start gitlab-unicorn
221 systemctl -q start gitlab-sidekiq
222 systemctl -q start gitlab.target
edff9e13
ER
223 echo "Create and configure database in /etc/gitlab/database.yml"
224 echo "Then run 'sudo -u gitlab bundle exec rake gitlab:setup RAILS_ENV=production'"
225 echo
226else
037664ba
ER
227 systemctl -q try-restart gitlab-unicorn || :
228 systemctl -q try-start gitlab-sidekiq || :
edff9e13
ER
229fi
230
e17ca829
ER
231%preun
232if [ "$1" = "0" ]; then
233 %service -q gitlab-sidekiq stop
234 %service -q gitlab-unicorn stop
235 /sbin/chkconfig --del gitlab-sidekiq
236 /sbin/chkconfig --del gitlab-unicorn
237fi
238
edff9e13
ER
239%postun
240if [ $1 -eq 0 ]; then
241 %userremove gitlab
242 %groupremove gitlab
243fi
244
245%files
246%defattr(644,root,root,755)
247%doc LICENSE
edff9e13
ER
248%config(noreplace) %{_sysconfdir}/gitlab/database.yml
249%config(noreplace) %{_sysconfdir}/gitlab/gitlab.yml
250%config(noreplace) %{_sysconfdir}/gitlab/unicorn.rb
c7ba61b6 251%config(noreplace) %{_sysconfdir}/httpd/webapps.d/gitlab.conf
edff9e13 252/etc/logrotate.d/gitlab.logrotate
7db376f0
ER
253%attr(754,root,root) /etc/rc.d/init.d/gitlab-sidekiq
254%attr(754,root,root) /etc/rc.d/init.d/gitlab-unicorn
6ba051e8 255%attr(755,root,root) %{_sbindir}/gitlab-rake
e62d7f31 256%attr(755,root,root) %{_sbindir}/gitlab-ctl
edff9e13
ER
257%{systemdunitdir}/gitlab-sidekiq.service
258%{systemdunitdir}/gitlab-unicorn.service
259%{systemdunitdir}/gitlab.target
260%{systemdtmpfilesdir}/gitlab.conf
e2b24ef1 261%dir %attr(755,%{uname},%{gname}) %{homedir}
e29cce1b 262%dir %attr(640,%{uname},%{gname}) %{homedir}/.gitconfig
e2b24ef1
G
263%dir %attr(755,%{uname},%{gname}) %{homedir}/app
264%attr(-,%{uname},%{gname}) %{homedir}/app/*
265%dir %attr(755,%{uname},%{gname}) %{homedir}/bin
266%attr(-,%{uname},%{gname}) %{homedir}/bin/*
267%dir %attr(755,%{uname},%{gname}) %{homedir}/builds
268%dir %attr(755,%{uname},%{gname}) %{homedir}/config
269%attr(-,%{uname},%{gname}) %{homedir}/config/*
270%dir %attr(755,%{uname},%{gname}) %{homedir}/db
271%attr(-,%{uname},%{gname}) %{homedir}/db/*
272%dir %attr(755,%{uname},%{gname}) %{homedir}/doc
273%attr(-,%{uname},%{gname}) %{homedir}/doc/*
e2b24ef1
G
274%dir %attr(755,%{uname},%{gname}) %{homedir}/lib
275%attr(-,%{uname},%{gname}) %{homedir}/lib/*
e2d7a1f0 276
c76cceba 277%{homedir}/fixtures
e2d7a1f0
ER
278%{homedir}/generator_templates
279
4c1de6fa 280%dir %{homedir}/public
a14207d0 281%{homedir}/public/ci
4c1de6fa
ER
282%{homedir}/public/*.*
283%attr(-,%{uname},%{gname}) %{homedir}/public/uploads
284%attr(-,%{uname},%{gname}) %{homedir}/public/assets
e2b24ef1 285%dir %attr(755,%{uname},%{gname}) %{homedir}/satellites
bab42173 286
e2b24ef1 287%dir %attr(755,%{uname},%{gname}) %{homedir}/tmp
bab42173
ER
288%attr(-,%{uname},%{gname}) %{homedir}/tmp/backups
289%attr(-,%{uname},%{gname}) %{homedir}/tmp/cache
290%attr(-,%{uname},%{gname}) %{homedir}/tmp/sessions
291%attr(-,%{uname},%{gname}) %{homedir}/tmp/sockets
292%attr(-,%{uname},%{gname}) %{homedir}/tmp/pids
293
e2b24ef1 294%dir %attr(755,%{uname},%{gname}) %{homedir}/www
edff9e13 295
cd662819
ER
296%dir %attr(750,%{uname},%{gname}) %{homedir}/shared
297%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts
298%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts/tmp
299%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts/tmp/cache
300%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts/tmp/uploads
301%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/lfs-objects
a329122f 302%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/registry
cd662819 303
e2b24ef1
G
304%dir %attr(755,%{uname},%{gname}) %{homedir}/.bundle
305%attr(-,%{uname},%{gname}) %{homedir}/.bundle/config
e2b24ef1 306%attr(-,%{uname},%{gname}) %{homedir}/.ruby-version
e2b24ef1
G
307%attr(-,%{uname},%{gname}) %{homedir}/CHANGELOG
308%attr(-,%{uname},%{gname}) %{homedir}/GITLAB_WORKHORSE_VERSION
309%attr(-,%{uname},%{gname}) %{homedir}/GITLAB_SHELL_VERSION
310%attr(-,%{uname},%{gname}) %{homedir}/Gemfile*
311%attr(-,%{uname},%{gname}) %{homedir}/LICENSE
312%attr(-,%{uname},%{gname}) %{homedir}/*.md
e2b24ef1
G
313%attr(-,%{uname},%{gname}) %{homedir}/Rakefile
314%attr(-,%{uname},%{gname}) %{homedir}/VERSION
315%attr(-,%{uname},%{gname}) %{homedir}/config.ru
580f84c4 316
e4edb538 317%{homedir}/log
bab42173
ER
318%dir %attr(771,root,%{gname}) %{_localstatedir}/log/gitlab
319%dir %attr(771,root,%{gname}) %{_localstatedir}/run/gitlab
e4edb538 320
580f84c4
ER
321%defattr(-,root,root,-)
322%dir %{homedir}/vendor
323%{homedir}/vendor/*
This page took 0.154595 seconds and 4 git commands to generate.