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