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