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