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