]> git.pld-linux.org Git - packages/gitlab-ce.git/blame - gitlab-ce.spec
gitlab-sidekiq/gitlab-unicorn: cleanup unused reload, fix pidfile and status
[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
76dc7c17 19Version: 8.7.5
7db376f0 20Release: 0.13
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
79bdc113 25Patch0: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3774.patch
edff9e13
ER
26URL: https://www.gitlab.com/gitlab-ce/
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
34Source8: gitlab-apache-conf
99acef11 35BuildRequires: cmake
b70ed759 36BuildRequires: gmp-devel
8b1af143 37BuildRequires: libgit2-devel
99acef11
ER
38BuildRequires: libicu-devel
39BuildRequires: libstdc++-devel
40BuildRequires: libxml2-devel
99acef11
ER
41BuildRequires: mysql-devel
42BuildRequires: postgresql-devel
8b1af143 43BuildRequires: rpm-rubyprov
edff9e13 44BuildRequires: ruby-bundler
b70ed759 45BuildRequires: ruby-devel >= 1:2.1.0
99acef11 46BuildRequires: zlib-devel
edff9e13
ER
47Obsoletes: gitlab <= 8.1.4
48Requires(pre): gitlab-shell
49Requires: apache-base
6f80237a 50Requires: git-core >= 2.7.4
0f5b396e 51Requires: nodejs
edff9e13 52Requires: ruby-bundler
1bfc7ca0
ER
53Suggests: mysql
54Suggests: redis-server
edff9e13
ER
55BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
56
a92c651e
ER
57%define _noautoreqfiles redcloth_scan.jar primitives.jar
58
e2b24ef1
G
59%define uname git
60%define gname git
61%define homedir %{_localstatedir}/lib/gitlab
edff9e13
ER
62
63%description
64GitLab Community Edition (CE) is open source software to collaborate
65on code. Create projects and repositories, manage access and do code
66reviews. GitLab CE is on-premises software that you can install and
67use on your server(s).
68
69%prep
1bfc7ca0 70%setup -qn gitlabhq-%{version}
79bdc113 71%patch0 -p1
edff9e13
ER
72
73# Patching config files:
74sed -e "s|# user: git|user: gitlab|" \
75 -e "s|/home/git/repositories|%{homedir}/repositories|" \
76 -e "s|/home/git/gitlab-satellites|%{homedir}/satellites|" \
77 -e "s|/home/git/gitlab-shell|/usr/share/gitlab-shell|" \
78 config/gitlab.yml.example > config/gitlab.yml
79sed -e "s|/home/git/gitlab/tmp/.*/|/run/gitlab/|g" \
80 -e "s|/home/git/gitlab|%{homedir}|g" \
81 -e "s|/usr/share/gitlab/log|%{homedir}/log|g" \
82 -e "s|timeout 30|timeout 300|" \
83 config/unicorn.rb.example > config/unicorn.rb
84sed -e "s|username: git|username: gitlab|" \
85 config/database.yml.mysql > config/database.yml
b262a96c
ER
86
87rm .flayignore
88rm .gitignore
6f80237a 89rm .csscomb.json
b262a96c 90find -name .gitkeep | xargs rm
99acef11 91
edff9e13 92%build
dc27d1e6
ER
93%if %{with gem_cache}
94cachedir="%{_specdir}/cache/%{version}.%{_arch}"
95install -d vendor/bundle
96test -d "$cachedir" && cp -aul "$cachedir"/* vendor/bundle
97%endif
98
edff9e13 99bundle install %{_smp_mflags} \
7470b5a8 100 --verbose \
dc27d1e6
ER
101 --deployment \
102 --without development test aws %{!?with_krb5:kerberos}
edff9e13 103
a92c651e
ER
104# avoid bogus ruby dep
105chmod a-x vendor/bundle/ruby/gems/unicorn-*/bin/unicorn*
106
dc27d1e6
ER
107%if %{with gem_cache}
108install -d "$cachedir"
109cp -aul vendor/bundle/* "$cachedir"
110%endif
111
edff9e13
ER
112%install
113rm -rf $RPM_BUILD_ROOT
114install -d \
115 $RPM_BUILD_ROOT%{homedir}/www \
4c1de6fa 116 $RPM_BUILD_ROOT%{homedir}/public/{assets,uploads} \
edff9e13
ER
117 $RPM_BUILD_ROOT%{_sysconfdir}/gitlab \
118 $RPM_BUILD_ROOT%{_docdir}/gitlab \
119 $RPM_BUILD_ROOT%{homedir}/satellites
120
b262a96c
ER
121# test if we can hardlink -- %{_builddir} and $RPM_BUILD_ROOT on same partition
122if cp -al VERSION $RPM_BUILD_ROOT/VERSION 2>/dev/null; then
123 l=l
124 rm -f $RPM_BUILD_ROOT/VERSION
125fi
126
127cp -a$l . $RPM_BUILD_ROOT%{homedir}
edff9e13 128
fb518a6f
ER
129# rpm cruft from repackaging
130rm -f $RPM_BUILD_ROOT%{homedir}/debug*.list
131
321d2ad5
ER
132# nuke tests
133chmod -R u+w $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/*/test
134rm -r $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/*/test
135
edff9e13
ER
136# Creating links
137ln -fs /run/gitlab $RPM_BUILD_ROOT%{homedir}/pids
138ln -fs /run/gitlab $RPM_BUILD_ROOT%{homedir}/sockets
e4edb538 139rmdir $RPM_BUILD_ROOT%{homedir}/log
edff9e13 140ln -fs %{_localstatedir}/log/gitlab $RPM_BUILD_ROOT%{homedir}/log
1bfc7ca0 141install -d $RPM_BUILD_ROOT%{_localstatedir}/log/gitlab
edff9e13 142
fb518a6f
ER
143move_config() {
144 local source=$1 target=$2
145 mv $RPM_BUILD_ROOT$source $RPM_BUILD_ROOT$target
146 ln -s $target $RPM_BUILD_ROOT$source
147}
148
edff9e13
ER
149# Install config files
150for f in gitlab.yml unicorn.rb database.yml; do
fb518a6f 151 move_config %{homedir}/config/$f %{_sysconfdir}/gitlab/$f
edff9e13
ER
152done
153
c7ba61b6 154install -d $RPM_BUILD_ROOT{%{systemdunitdir},%{systemdtmpfilesdir}} \
7db376f0 155 $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d,httpd/webapps.d}
c7ba61b6 156
c7ba61b6 157cp -p %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-sidekiq.service
7db376f0
ER
158install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/gitlab-sidekiq
159cp -p %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-unicorn.service
160install -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/gitlab-unicorn
161
162cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab.target
163cp -p %{SOURCE7} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/gitlab.conf
164cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/logrotate.d/gitlab.logrotate
165cp -p %{SOURCE8} $RPM_BUILD_ROOT/etc/httpd/webapps.d/gitlab.conf
edff9e13
ER
166
167%clean
168rm -rf "$RPM_BUILD_ROOT"
169
edff9e13
ER
170%post
171if [ $1 -ge 1 ]; then
172 systemctl -q daemon-reload
173 systemd-tmpfiles --create %{systemdtmpfilesdir}/gitlab.conf
174 [ -e %{_localstatedir}/lock/subsys/httpd ] && service httpd reload || :
175fi
176if [ $1 -eq 1 ]; then
177 systemctl -q enable gitlab-unicorn
178 systemctl -q enable gitlab-sidekiq
179 systemctl -q enable gitlab.target
180 systemctl -q start gitlab-unicorn
181 systemctl -q start gitlab-sidekiq
182 systemctl -q start gitlab.target
183 sudo -u gitlab -H git config --global user.name "GitLab"
184 sudo -u gitlab -H git config --global user.email "gitlab@localhost"
185 sudo -u gitlab -H git config --global core.autocrlf input
186 echo "Create and configure database in /etc/gitlab/database.yml"
187 echo "Then run 'sudo -u gitlab bundle exec rake gitlab:setup RAILS_ENV=production'"
188 echo
189else
037664ba
ER
190 systemctl -q try-restart gitlab-unicorn || :
191 systemctl -q try-start gitlab-sidekiq || :
edff9e13
ER
192fi
193
194%postun
195if [ $1 -eq 0 ]; then
196 %userremove gitlab
197 %groupremove gitlab
198fi
199
200%files
201%defattr(644,root,root,755)
202%doc LICENSE
203%dir %{_sysconfdir}/gitlab
204%config(noreplace) %{_sysconfdir}/gitlab/database.yml
205%config(noreplace) %{_sysconfdir}/gitlab/gitlab.yml
206%config(noreplace) %{_sysconfdir}/gitlab/unicorn.rb
c7ba61b6 207%config(noreplace) %{_sysconfdir}/httpd/webapps.d/gitlab.conf
edff9e13 208/etc/logrotate.d/gitlab.logrotate
7db376f0
ER
209%attr(754,root,root) /etc/rc.d/init.d/gitlab-sidekiq
210%attr(754,root,root) /etc/rc.d/init.d/gitlab-unicorn
edff9e13
ER
211%{systemdunitdir}/gitlab-sidekiq.service
212%{systemdunitdir}/gitlab-unicorn.service
213%{systemdunitdir}/gitlab.target
214%{systemdtmpfilesdir}/gitlab.conf
e2b24ef1
G
215%dir %attr(755,%{uname},%{gname}) %{homedir}
216%dir %attr(755,%{uname},%{gname}) %{homedir}/app
217%attr(-,%{uname},%{gname}) %{homedir}/app/*
218%dir %attr(755,%{uname},%{gname}) %{homedir}/bin
219%attr(-,%{uname},%{gname}) %{homedir}/bin/*
220%dir %attr(755,%{uname},%{gname}) %{homedir}/builds
221%dir %attr(755,%{uname},%{gname}) %{homedir}/config
222%attr(-,%{uname},%{gname}) %{homedir}/config/*
223%dir %attr(755,%{uname},%{gname}) %{homedir}/db
224%attr(-,%{uname},%{gname}) %{homedir}/db/*
225%dir %attr(755,%{uname},%{gname}) %{homedir}/doc
226%attr(-,%{uname},%{gname}) %{homedir}/doc/*
227%dir %attr(755,%{uname},%{gname}) %{homedir}/docker
228%attr(-,%{uname},%{gname}) %{homedir}/docker/*
229%dir %attr(755,%{uname},%{gname}) %{homedir}/features
230%attr(-,%{uname},%{gname}) %{homedir}/features/*
231%dir %attr(755,%{uname},%{gname}) %{homedir}/lib
232%attr(-,%{uname},%{gname}) %{homedir}/lib/*
233%dir %attr(755,%{uname},%{gname}) %{homedir}/pids
4c1de6fa 234%dir %{homedir}/public
a14207d0 235%{homedir}/public/ci
4c1de6fa
ER
236%{homedir}/public/*.*
237%attr(-,%{uname},%{gname}) %{homedir}/public/uploads
238%attr(-,%{uname},%{gname}) %{homedir}/public/assets
e2b24ef1
G
239%dir %attr(755,%{uname},%{gname}) %{homedir}/satellites
240%dir %attr(755,%{uname},%{gname}) %{homedir}/scripts
241%attr(-,%{uname},%{gname}) %{homedir}/scripts/*
242%dir %attr(755,%{uname},%{gname}) %{homedir}/sockets
243%dir %attr(755,%{uname},%{gname}) %{homedir}/spec
244%attr(-,%{uname},%{gname}) %{homedir}/spec/*
245%dir %attr(755,%{uname},%{gname}) %{homedir}/tmp
246%attr(-,%{uname},%{gname}) %{homedir}/tmp/*
247%dir %attr(755,%{uname},%{gname}) %{homedir}/www
edff9e13 248
e2b24ef1
G
249%dir %attr(755,%{uname},%{gname}) %{homedir}/.bundle
250%attr(-,%{uname},%{gname}) %{homedir}/.bundle/config
251%attr(-,%{uname},%{gname}) %{homedir}/.foreman
252%attr(-,%{uname},%{gname}) %{homedir}/docker-compose.yml
253%attr(-,%{uname},%{gname}) %{homedir}/.gitattributes
254%attr(-,%{uname},%{gname}) %{homedir}/.*.yml
255%attr(-,%{uname},%{gname}) %{homedir}/.rspec
256%attr(-,%{uname},%{gname}) %{homedir}/.ruby-version
257%attr(-,%{uname},%{gname}) %{homedir}/.simplecov
258%attr(-,%{uname},%{gname}) %{homedir}/CHANGELOG
259%attr(-,%{uname},%{gname}) %{homedir}/GITLAB_WORKHORSE_VERSION
260%attr(-,%{uname},%{gname}) %{homedir}/GITLAB_SHELL_VERSION
261%attr(-,%{uname},%{gname}) %{homedir}/Gemfile*
262%attr(-,%{uname},%{gname}) %{homedir}/LICENSE
263%attr(-,%{uname},%{gname}) %{homedir}/*.md
264%attr(-,%{uname},%{gname}) %{homedir}/Procfile
265%attr(-,%{uname},%{gname}) %{homedir}/Rakefile
266%attr(-,%{uname},%{gname}) %{homedir}/VERSION
267%attr(-,%{uname},%{gname}) %{homedir}/config.ru
268%attr(-,%{uname},%{gname}) %{homedir}/fixtures
580f84c4 269
e4edb538 270%{homedir}/log
e2b24ef1 271%dir %attr(771,root,%{gname}) /var/log/gitlab
e4edb538 272
580f84c4
ER
273%defattr(-,root,root,-)
274%dir %{homedir}/vendor
275%{homedir}/vendor/*
This page took 0.115131 seconds and 4 git commands to generate.