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