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