]> git.pld-linux.org Git - packages/gitlab-ce.git/blame - gitlab-ce.spec
add link to rake tasks documentation
[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
e29cce1b 20Release: 0.19.4
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
298ba786 92rm docker-compose.yml
b262a96c 93find -name .gitkeep | xargs rm
298ba786 94rm -r lib/support/{deploy,init.d}
99acef11 95
edff9e13 96%build
dc27d1e6
ER
97%if %{with gem_cache}
98cachedir="%{_specdir}/cache/%{version}.%{_arch}"
99install -d vendor/bundle
100test -d "$cachedir" && cp -aul "$cachedir"/* vendor/bundle
101%endif
102
edff9e13 103bundle install %{_smp_mflags} \
7470b5a8 104 --verbose \
dc27d1e6
ER
105 --deployment \
106 --without development test aws %{!?with_krb5:kerberos}
edff9e13 107
a5202e18 108bundle exec rake RAILS_ENV=production assets:clean assets:precompile USE_DB=false
a3c02bfc 109
a92c651e
ER
110# avoid bogus ruby dep
111chmod a-x vendor/bundle/ruby/gems/unicorn-*/bin/unicorn*
112
a3c02bfc
ER
113# remove secrets, log and cache that assets compile initialized
114rm .gitlab_shell_secret
115rm .secret
116rm config/secrets.yml
117rm log/production.log
118rm -r tmp/cache/*
119
dc27d1e6
ER
120%if %{with gem_cache}
121install -d "$cachedir"
122cp -aul vendor/bundle/* "$cachedir"
123%endif
124
edff9e13
ER
125%install
126rm -rf $RPM_BUILD_ROOT
127install -d \
6eb5e245
ER
128 $RPM_BUILD_ROOT%{homedir}/www \
129 $RPM_BUILD_ROOT%{homedir}/public/{assets,uploads} \
130 $RPM_BUILD_ROOT%{homedir}/satellites \
131 $RPM_BUILD_ROOT%{homedir}/tmp/{cache/assets,sessions} \
edff9e13 132 $RPM_BUILD_ROOT%{_sysconfdir}/gitlab \
6eb5e245 133 $RPM_BUILD_ROOT%{_docdir}/gitlab \
edff9e13 134
b262a96c
ER
135# test if we can hardlink -- %{_builddir} and $RPM_BUILD_ROOT on same partition
136if cp -al VERSION $RPM_BUILD_ROOT/VERSION 2>/dev/null; then
137 l=l
138 rm -f $RPM_BUILD_ROOT/VERSION
139fi
140
141cp -a$l . $RPM_BUILD_ROOT%{homedir}
edff9e13 142
fb518a6f
ER
143# rpm cruft from repackaging
144rm -f $RPM_BUILD_ROOT%{homedir}/debug*.list
145
321d2ad5
ER
146# nuke tests
147chmod -R u+w $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/*/test
148rm -r $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/*/test
149
edff9e13
ER
150# Creating links
151ln -fs /run/gitlab $RPM_BUILD_ROOT%{homedir}/pids
152ln -fs /run/gitlab $RPM_BUILD_ROOT%{homedir}/sockets
e4edb538 153rmdir $RPM_BUILD_ROOT%{homedir}/log
edff9e13 154ln -fs %{_localstatedir}/log/gitlab $RPM_BUILD_ROOT%{homedir}/log
1bfc7ca0 155install -d $RPM_BUILD_ROOT%{_localstatedir}/log/gitlab
edff9e13 156
fb518a6f
ER
157move_config() {
158 local source=$1 target=$2
159 mv $RPM_BUILD_ROOT$source $RPM_BUILD_ROOT$target
160 ln -s $target $RPM_BUILD_ROOT$source
161}
162
edff9e13
ER
163# Install config files
164for f in gitlab.yml unicorn.rb database.yml; do
fb518a6f 165 move_config %{homedir}/config/$f %{_sysconfdir}/gitlab/$f
edff9e13
ER
166done
167
6ba051e8 168install -d $RPM_BUILD_ROOT{%{_sbindir},%{systemdunitdir},%{systemdtmpfilesdir}} \
7db376f0 169 $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d,httpd/webapps.d}
c7ba61b6 170
c7ba61b6 171cp -p %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-sidekiq.service
7db376f0
ER
172install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/gitlab-sidekiq
173cp -p %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-unicorn.service
174install -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/gitlab-unicorn
175
176cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab.target
177cp -p %{SOURCE7} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/gitlab.conf
178cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/logrotate.d/gitlab.logrotate
179cp -p %{SOURCE8} $RPM_BUILD_ROOT/etc/httpd/webapps.d/gitlab.conf
e29cce1b 180cp -p %{SOURCE10} $RPM_BUILD_ROOT%{homedir}/.gitconfig
6ba051e8 181install -p %{SOURCE9} $RPM_BUILD_ROOT%{_sbindir}/gitlab-rake
edff9e13
ER
182
183%clean
184rm -rf "$RPM_BUILD_ROOT"
185
edff9e13
ER
186%post
187if [ $1 -ge 1 ]; then
188 systemctl -q daemon-reload
189 systemd-tmpfiles --create %{systemdtmpfilesdir}/gitlab.conf
190 [ -e %{_localstatedir}/lock/subsys/httpd ] && service httpd reload || :
191fi
192if [ $1 -eq 1 ]; then
193 systemctl -q enable gitlab-unicorn
194 systemctl -q enable gitlab-sidekiq
195 systemctl -q enable gitlab.target
196 systemctl -q start gitlab-unicorn
197 systemctl -q start gitlab-sidekiq
198 systemctl -q start gitlab.target
edff9e13
ER
199 echo "Create and configure database in /etc/gitlab/database.yml"
200 echo "Then run 'sudo -u gitlab bundle exec rake gitlab:setup RAILS_ENV=production'"
201 echo
202else
037664ba
ER
203 systemctl -q try-restart gitlab-unicorn || :
204 systemctl -q try-start gitlab-sidekiq || :
edff9e13
ER
205fi
206
207%postun
208if [ $1 -eq 0 ]; then
209 %userremove gitlab
210 %groupremove gitlab
211fi
212
213%files
214%defattr(644,root,root,755)
215%doc LICENSE
216%dir %{_sysconfdir}/gitlab
217%config(noreplace) %{_sysconfdir}/gitlab/database.yml
218%config(noreplace) %{_sysconfdir}/gitlab/gitlab.yml
219%config(noreplace) %{_sysconfdir}/gitlab/unicorn.rb
c7ba61b6 220%config(noreplace) %{_sysconfdir}/httpd/webapps.d/gitlab.conf
edff9e13 221/etc/logrotate.d/gitlab.logrotate
7db376f0
ER
222%attr(754,root,root) /etc/rc.d/init.d/gitlab-sidekiq
223%attr(754,root,root) /etc/rc.d/init.d/gitlab-unicorn
6ba051e8 224%attr(755,root,root) %{_sbindir}/gitlab-rake
edff9e13
ER
225%{systemdunitdir}/gitlab-sidekiq.service
226%{systemdunitdir}/gitlab-unicorn.service
227%{systemdunitdir}/gitlab.target
228%{systemdtmpfilesdir}/gitlab.conf
e2b24ef1 229%dir %attr(755,%{uname},%{gname}) %{homedir}
e29cce1b 230%dir %attr(640,%{uname},%{gname}) %{homedir}/.gitconfig
e2b24ef1
G
231%dir %attr(755,%{uname},%{gname}) %{homedir}/app
232%attr(-,%{uname},%{gname}) %{homedir}/app/*
233%dir %attr(755,%{uname},%{gname}) %{homedir}/bin
234%attr(-,%{uname},%{gname}) %{homedir}/bin/*
235%dir %attr(755,%{uname},%{gname}) %{homedir}/builds
236%dir %attr(755,%{uname},%{gname}) %{homedir}/config
237%attr(-,%{uname},%{gname}) %{homedir}/config/*
238%dir %attr(755,%{uname},%{gname}) %{homedir}/db
239%attr(-,%{uname},%{gname}) %{homedir}/db/*
240%dir %attr(755,%{uname},%{gname}) %{homedir}/doc
241%attr(-,%{uname},%{gname}) %{homedir}/doc/*
242%dir %attr(755,%{uname},%{gname}) %{homedir}/docker
243%attr(-,%{uname},%{gname}) %{homedir}/docker/*
244%dir %attr(755,%{uname},%{gname}) %{homedir}/features
245%attr(-,%{uname},%{gname}) %{homedir}/features/*
246%dir %attr(755,%{uname},%{gname}) %{homedir}/lib
247%attr(-,%{uname},%{gname}) %{homedir}/lib/*
248%dir %attr(755,%{uname},%{gname}) %{homedir}/pids
4c1de6fa 249%dir %{homedir}/public
a14207d0 250%{homedir}/public/ci
4c1de6fa
ER
251%{homedir}/public/*.*
252%attr(-,%{uname},%{gname}) %{homedir}/public/uploads
253%attr(-,%{uname},%{gname}) %{homedir}/public/assets
e2b24ef1
G
254%dir %attr(755,%{uname},%{gname}) %{homedir}/satellites
255%dir %attr(755,%{uname},%{gname}) %{homedir}/scripts
256%attr(-,%{uname},%{gname}) %{homedir}/scripts/*
257%dir %attr(755,%{uname},%{gname}) %{homedir}/sockets
258%dir %attr(755,%{uname},%{gname}) %{homedir}/spec
259%attr(-,%{uname},%{gname}) %{homedir}/spec/*
260%dir %attr(755,%{uname},%{gname}) %{homedir}/tmp
261%attr(-,%{uname},%{gname}) %{homedir}/tmp/*
262%dir %attr(755,%{uname},%{gname}) %{homedir}/www
edff9e13 263
e2b24ef1
G
264%dir %attr(755,%{uname},%{gname}) %{homedir}/.bundle
265%attr(-,%{uname},%{gname}) %{homedir}/.bundle/config
266%attr(-,%{uname},%{gname}) %{homedir}/.foreman
e2b24ef1
G
267%attr(-,%{uname},%{gname}) %{homedir}/.gitattributes
268%attr(-,%{uname},%{gname}) %{homedir}/.*.yml
269%attr(-,%{uname},%{gname}) %{homedir}/.rspec
270%attr(-,%{uname},%{gname}) %{homedir}/.ruby-version
271%attr(-,%{uname},%{gname}) %{homedir}/.simplecov
272%attr(-,%{uname},%{gname}) %{homedir}/CHANGELOG
273%attr(-,%{uname},%{gname}) %{homedir}/GITLAB_WORKHORSE_VERSION
274%attr(-,%{uname},%{gname}) %{homedir}/GITLAB_SHELL_VERSION
275%attr(-,%{uname},%{gname}) %{homedir}/Gemfile*
276%attr(-,%{uname},%{gname}) %{homedir}/LICENSE
277%attr(-,%{uname},%{gname}) %{homedir}/*.md
278%attr(-,%{uname},%{gname}) %{homedir}/Procfile
279%attr(-,%{uname},%{gname}) %{homedir}/Rakefile
280%attr(-,%{uname},%{gname}) %{homedir}/VERSION
281%attr(-,%{uname},%{gname}) %{homedir}/config.ru
282%attr(-,%{uname},%{gname}) %{homedir}/fixtures
580f84c4 283
e4edb538 284%{homedir}/log
e2b24ef1 285%dir %attr(771,root,%{gname}) /var/log/gitlab
e4edb538 286
580f84c4
ER
287%defattr(-,root,root,-)
288%dir %{homedir}/vendor
289%{homedir}/vendor/*
This page took 0.143798 seconds and 4 git commands to generate.