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