]> git.pld-linux.org Git - packages/gitlab-ce.git/blame - gitlab-ce.spec
use local secret_file for compiling assets
[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
ea8d688f 20Release: 0.22
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
ea8d688f
ER
102cp -p config/gitlab.yml{,.production}
103sed -i -e '/secret_file:/d' config/gitlab.yml
a5202e18 104bundle exec rake RAILS_ENV=production assets:clean assets:precompile USE_DB=false
ea8d688f 105mv -f config/gitlab.yml{.production,}
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
e29cce1b 177cp -p %{SOURCE10} $RPM_BUILD_ROOT%{homedir}/.gitconfig
6ba051e8 178install -p %{SOURCE9} $RPM_BUILD_ROOT%{_sbindir}/gitlab-rake
edff9e13
ER
179
180%clean
181rm -rf "$RPM_BUILD_ROOT"
182
edff9e13
ER
183%post
184if [ $1 -ge 1 ]; then
185 systemctl -q daemon-reload
186 systemd-tmpfiles --create %{systemdtmpfilesdir}/gitlab.conf
187 [ -e %{_localstatedir}/lock/subsys/httpd ] && service httpd reload || :
188fi
189if [ $1 -eq 1 ]; then
190 systemctl -q enable gitlab-unicorn
191 systemctl -q enable gitlab-sidekiq
192 systemctl -q enable gitlab.target
193 systemctl -q start gitlab-unicorn
194 systemctl -q start gitlab-sidekiq
195 systemctl -q start gitlab.target
edff9e13
ER
196 echo "Create and configure database in /etc/gitlab/database.yml"
197 echo "Then run 'sudo -u gitlab bundle exec rake gitlab:setup RAILS_ENV=production'"
198 echo
199else
037664ba
ER
200 systemctl -q try-restart gitlab-unicorn || :
201 systemctl -q try-start gitlab-sidekiq || :
edff9e13
ER
202fi
203
204%postun
205if [ $1 -eq 0 ]; then
206 %userremove gitlab
207 %groupremove gitlab
208fi
209
210%files
211%defattr(644,root,root,755)
212%doc LICENSE
edff9e13
ER
213%config(noreplace) %{_sysconfdir}/gitlab/database.yml
214%config(noreplace) %{_sysconfdir}/gitlab/gitlab.yml
215%config(noreplace) %{_sysconfdir}/gitlab/unicorn.rb
c7ba61b6 216%config(noreplace) %{_sysconfdir}/httpd/webapps.d/gitlab.conf
edff9e13 217/etc/logrotate.d/gitlab.logrotate
7db376f0
ER
218%attr(754,root,root) /etc/rc.d/init.d/gitlab-sidekiq
219%attr(754,root,root) /etc/rc.d/init.d/gitlab-unicorn
6ba051e8 220%attr(755,root,root) %{_sbindir}/gitlab-rake
edff9e13
ER
221%{systemdunitdir}/gitlab-sidekiq.service
222%{systemdunitdir}/gitlab-unicorn.service
223%{systemdunitdir}/gitlab.target
224%{systemdtmpfilesdir}/gitlab.conf
e2b24ef1 225%dir %attr(755,%{uname},%{gname}) %{homedir}
e29cce1b 226%dir %attr(640,%{uname},%{gname}) %{homedir}/.gitconfig
e2b24ef1
G
227%dir %attr(755,%{uname},%{gname}) %{homedir}/app
228%attr(-,%{uname},%{gname}) %{homedir}/app/*
229%dir %attr(755,%{uname},%{gname}) %{homedir}/bin
230%attr(-,%{uname},%{gname}) %{homedir}/bin/*
231%dir %attr(755,%{uname},%{gname}) %{homedir}/builds
232%dir %attr(755,%{uname},%{gname}) %{homedir}/config
233%attr(-,%{uname},%{gname}) %{homedir}/config/*
234%dir %attr(755,%{uname},%{gname}) %{homedir}/db
235%attr(-,%{uname},%{gname}) %{homedir}/db/*
236%dir %attr(755,%{uname},%{gname}) %{homedir}/doc
237%attr(-,%{uname},%{gname}) %{homedir}/doc/*
238%dir %attr(755,%{uname},%{gname}) %{homedir}/docker
239%attr(-,%{uname},%{gname}) %{homedir}/docker/*
240%dir %attr(755,%{uname},%{gname}) %{homedir}/features
241%attr(-,%{uname},%{gname}) %{homedir}/features/*
242%dir %attr(755,%{uname},%{gname}) %{homedir}/lib
243%attr(-,%{uname},%{gname}) %{homedir}/lib/*
244%dir %attr(755,%{uname},%{gname}) %{homedir}/pids
4c1de6fa 245%dir %{homedir}/public
a14207d0 246%{homedir}/public/ci
4c1de6fa
ER
247%{homedir}/public/*.*
248%attr(-,%{uname},%{gname}) %{homedir}/public/uploads
249%attr(-,%{uname},%{gname}) %{homedir}/public/assets
e2b24ef1
G
250%dir %attr(755,%{uname},%{gname}) %{homedir}/satellites
251%dir %attr(755,%{uname},%{gname}) %{homedir}/scripts
252%attr(-,%{uname},%{gname}) %{homedir}/scripts/*
253%dir %attr(755,%{uname},%{gname}) %{homedir}/sockets
254%dir %attr(755,%{uname},%{gname}) %{homedir}/spec
255%attr(-,%{uname},%{gname}) %{homedir}/spec/*
256%dir %attr(755,%{uname},%{gname}) %{homedir}/tmp
257%attr(-,%{uname},%{gname}) %{homedir}/tmp/*
258%dir %attr(755,%{uname},%{gname}) %{homedir}/www
edff9e13 259
cd662819
ER
260%dir %attr(750,%{uname},%{gname}) %{homedir}/shared
261%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts
262%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts/tmp
263%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts/tmp/cache
264%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts/tmp/uploads
265%dir %attr(750,%{uname},%{gname}) %{homedir}/shared/lfs-objects
266
e2b24ef1
G
267%dir %attr(755,%{uname},%{gname}) %{homedir}/.bundle
268%attr(-,%{uname},%{gname}) %{homedir}/.bundle/config
269%attr(-,%{uname},%{gname}) %{homedir}/.foreman
e2b24ef1
G
270%attr(-,%{uname},%{gname}) %{homedir}/.*.yml
271%attr(-,%{uname},%{gname}) %{homedir}/.rspec
272%attr(-,%{uname},%{gname}) %{homedir}/.ruby-version
273%attr(-,%{uname},%{gname}) %{homedir}/.simplecov
274%attr(-,%{uname},%{gname}) %{homedir}/CHANGELOG
275%attr(-,%{uname},%{gname}) %{homedir}/GITLAB_WORKHORSE_VERSION
276%attr(-,%{uname},%{gname}) %{homedir}/GITLAB_SHELL_VERSION
277%attr(-,%{uname},%{gname}) %{homedir}/Gemfile*
278%attr(-,%{uname},%{gname}) %{homedir}/LICENSE
279%attr(-,%{uname},%{gname}) %{homedir}/*.md
280%attr(-,%{uname},%{gname}) %{homedir}/Procfile
281%attr(-,%{uname},%{gname}) %{homedir}/Rakefile
282%attr(-,%{uname},%{gname}) %{homedir}/VERSION
283%attr(-,%{uname},%{gname}) %{homedir}/config.ru
284%attr(-,%{uname},%{gname}) %{homedir}/fixtures
580f84c4 285
e4edb538 286%{homedir}/log
e2b24ef1 287%dir %attr(771,root,%{gname}) /var/log/gitlab
e4edb538 288
580f84c4
ER
289%defattr(-,root,root,-)
290%dir %{homedir}/vendor
291%{homedir}/vendor/*
This page took 0.091968 seconds and 4 git commands to generate.