]> git.pld-linux.org Git - packages/gitlab-ce.git/blob - gitlab-ce.spec
add tmp/backups dir
[packages/gitlab-ce.git] / gitlab-ce.spec
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.
6 #
7 # install notes: https://gitlab.com/gitlab-org/gitlab-ce/blob/v8.6.6/doc/install/installation.md
8 #
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
15 %bcond_without  gem_cache       # use local to speedup gem installation
16
17 Summary:        A Web interface to create projects and repositories, manage access and do code reviews
18 Name:           gitlab-ce
19 Version:        8.8.1
20 Release:        0.28
21 License:        MIT
22 Group:          Applications/WWW
23 # md5 deliberately omitted until this package is useful
24 Source0:        https://github.com/gitlabhq/gitlabhq/archive/v%{version}/%{name}-%{version}.tar.gz
25 Patch0:         https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3774.patch
26 Patch1:         pld.patch
27 Source1:        gitlab.target
28 Source2:        gitlab-sidekiq.service
29 Source3:        gitlab-sidekiq.init
30 Source4:        gitlab-unicorn.service
31 Source5:        gitlab-unicorn.init
32 Source6:        gitlab.logrotate
33 Source7:        gitlab.tmpfiles.d
34 Source8:        gitlab-apache-conf
35 Source9:        gitlab-rake.sh
36 Source10:       gitconfig
37 URL:            https://www.gitlab.com/gitlab-ce/
38 BuildRequires:  cmake
39 BuildRequires:  gmp-devel
40 BuildRequires:  libgit2-devel
41 BuildRequires:  libicu-devel
42 BuildRequires:  libstdc++-devel
43 BuildRequires:  libxml2-devel
44 BuildRequires:  mysql-devel
45 BuildRequires:  postgresql-devel
46 BuildRequires:  rpm-rubyprov
47 BuildRequires:  ruby-bundler
48 BuildRequires:  ruby-devel >= 1:2.1.0
49 BuildRequires:  zlib-devel
50 Requires:       apache-base
51 Requires:       git-core >= 2.7.4
52 Requires:       gitlab-shell >= 2.7.2
53 Requires:       nodejs
54 Requires:       ruby-bundler
55 Suggests:       mysql
56 Suggests:       redis-server
57 Obsoletes:      gitlab <= 8.1.4
58 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
59
60 %define _noautoreqfiles redcloth_scan.jar primitives.jar
61
62 %define uname git
63 %define gname git
64 %define homedir %{_localstatedir}/lib/gitlab
65
66 %description
67 GitLab Community Edition (CE) is open source software to collaborate
68 on code. Create projects and repositories, manage access and do code
69 reviews. GitLab CE is on-premises software that you can install and
70 use on your server(s).
71
72 %prep
73 %setup -qn gitlabhq-%{version}
74 mv config/gitlab.yml.example config/gitlab.yml
75 mv config/unicorn.rb.example config/unicorn.rb
76 %patch0 -p1
77 %patch1 -p1
78
79 # use mysql for now
80 mv config/database.yml.mysql config/database.yml
81
82 find -name .gitkeep | xargs rm
83 rm -r docker
84 rm -r features
85 rm -r lib/support/{deploy,init.d}
86 rm -r scripts
87 rm -r spec
88 rm .csscomb.json
89 rm .flayignore
90 rm .foreman
91 rm .gitattributes
92 rm .gitignore
93 rm .gitlab-ci.yml
94 rm .hound.yml
95 rm .pkgr.yml
96 rm .rspec
97 rm .rubocop.yml
98 rm .scss-lint.yml
99 rm .simplecov
100 rm .teatro.yml
101 rm Procfile
102 rm bin/pkgr_before_precompile.sh
103 rm docker-compose.yml
104
105 %build
106 %if %{with gem_cache}
107 cachedir="%{_specdir}/cache/%{version}.%{_arch}"
108 install -d vendor/bundle
109 test -d "$cachedir" && cp -aul "$cachedir"/* vendor/bundle
110 %endif
111
112 bundle install %{_smp_mflags} \
113         --verbose \
114         --deployment \
115         --without development test aws %{!?with_krb5:kerberos}
116
117 cp -p config/gitlab.yml{,.production}
118 sed -i -e '/secret_file:/d' config/gitlab.yml
119 bundle exec rake RAILS_ENV=production assets:clean assets:precompile USE_DB=false
120 mv -f config/gitlab.yml{.production,}
121
122 # avoid bogus ruby dep
123 chmod a-x vendor/bundle/ruby/gems/unicorn-*/bin/unicorn*
124
125 # remove secrets, log and cache that assets compile initialized
126 rm .gitlab_shell_secret
127 rm .secret
128 rm config/secrets.yml
129 rm log/production.log
130 rm -r tmp/cache/*
131
132 %if %{with gem_cache}
133 install -d "$cachedir"
134 cp -aul vendor/bundle/* "$cachedir"
135 %endif
136
137 %install
138 rm -rf $RPM_BUILD_ROOT
139 install -d \
140         $RPM_BUILD_ROOT%{homedir}/www \
141         $RPM_BUILD_ROOT%{homedir}/public/{assets,uploads} \
142         $RPM_BUILD_ROOT%{homedir}/satellites \
143         $RPM_BUILD_ROOT%{homedir}/tmp/{cache/assets,sessions,backups} \
144         $RPM_BUILD_ROOT%{_sysconfdir}/gitlab \
145         $RPM_BUILD_ROOT%{_docdir}/gitlab \
146         $RPM_BUILD_ROOT%{_localstatedir}/{run,log}/gitlab
147
148 # test if we can hardlink -- %{_builddir} and $RPM_BUILD_ROOT on same partition
149 if cp -al VERSION $RPM_BUILD_ROOT/VERSION 2>/dev/null; then
150         l=l
151         rm -f $RPM_BUILD_ROOT/VERSION
152 fi
153
154 cp -a$l . $RPM_BUILD_ROOT%{homedir}
155
156 # rpm cruft from repackaging
157 rm -f $RPM_BUILD_ROOT%{homedir}/debug*.list
158
159 # nuke tests
160 chmod -R u+w $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/*/test
161 rm -r $RPM_BUILD_ROOT%{homedir}/vendor/bundle/ruby/gems/*/test
162
163 # Creating links
164 rmdir $RPM_BUILD_ROOT%{homedir}/{log,tmp/{pids,sockets}}
165 ln -s %{_localstatedir}/run/gitlab $RPM_BUILD_ROOT%{homedir}/tmp/pids
166 ln -s %{_localstatedir}/run/gitlab $RPM_BUILD_ROOT%{homedir}/tmp/sockets
167 ln -s %{_localstatedir}/log/gitlab $RPM_BUILD_ROOT%{homedir}/log
168
169 move_config() {
170         local source=$1 target=$2
171         mv $RPM_BUILD_ROOT$source $RPM_BUILD_ROOT$target
172         ln -s $target $RPM_BUILD_ROOT$source
173 }
174
175 # Install config files
176 for f in gitlab.yml unicorn.rb database.yml; do
177         move_config %{homedir}/config/$f %{_sysconfdir}/gitlab/$f
178 done
179
180 install -d $RPM_BUILD_ROOT{%{_sbindir},%{systemdunitdir},%{systemdtmpfilesdir}} \
181         $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d,httpd/webapps.d}
182
183 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-sidekiq.service
184 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/gitlab-sidekiq
185 cp -p %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-unicorn.service
186 install -p %{SOURCE5} $RPM_BUILD_ROOT/etc/rc.d/init.d/gitlab-unicorn
187
188 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab.target
189 cp -p %{SOURCE7} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/gitlab.conf
190 cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/logrotate.d/gitlab.logrotate
191 cp -p %{SOURCE8} $RPM_BUILD_ROOT/etc/httpd/webapps.d/gitlab.conf
192 cp -p %{SOURCE10} $RPM_BUILD_ROOT%{homedir}/.gitconfig
193 install -p %{SOURCE9} $RPM_BUILD_ROOT%{_sbindir}/gitlab-rake
194
195 %clean
196 rm -rf "$RPM_BUILD_ROOT"
197
198 %post
199 if [ $1 -ge 1 ]; then
200         systemctl -q daemon-reload
201         systemd-tmpfiles --create %{systemdtmpfilesdir}/gitlab.conf
202         [ -e %{_localstatedir}/lock/subsys/httpd ] && service httpd reload || :
203 fi
204 if [ $1 -eq 1 ]; then
205         systemctl -q enable gitlab-unicorn
206         systemctl -q enable gitlab-sidekiq
207         systemctl -q enable gitlab.target
208         systemctl -q start gitlab-unicorn
209         systemctl -q start gitlab-sidekiq
210         systemctl -q start gitlab.target
211         echo "Create and configure database in /etc/gitlab/database.yml"
212         echo "Then run 'sudo -u gitlab bundle exec rake gitlab:setup RAILS_ENV=production'"
213         echo
214 else
215         systemctl -q try-restart gitlab-unicorn || :
216         systemctl -q try-start gitlab-sidekiq || :
217 fi
218
219 %postun
220 if [ $1 -eq 0 ]; then
221         %userremove gitlab
222         %groupremove gitlab
223 fi
224
225 %files
226 %defattr(644,root,root,755)
227 %doc LICENSE
228 %config(noreplace) %{_sysconfdir}/gitlab/database.yml
229 %config(noreplace) %{_sysconfdir}/gitlab/gitlab.yml
230 %config(noreplace) %{_sysconfdir}/gitlab/unicorn.rb
231 %config(noreplace) %{_sysconfdir}/httpd/webapps.d/gitlab.conf
232 /etc/logrotate.d/gitlab.logrotate
233 %attr(754,root,root) /etc/rc.d/init.d/gitlab-sidekiq
234 %attr(754,root,root) /etc/rc.d/init.d/gitlab-unicorn
235 %attr(755,root,root) %{_sbindir}/gitlab-rake
236 %{systemdunitdir}/gitlab-sidekiq.service
237 %{systemdunitdir}/gitlab-unicorn.service
238 %{systemdunitdir}/gitlab.target
239 %{systemdtmpfilesdir}/gitlab.conf
240 %dir %attr(755,%{uname},%{gname}) %{homedir}
241 %dir %attr(640,%{uname},%{gname}) %{homedir}/.gitconfig
242 %dir %attr(755,%{uname},%{gname}) %{homedir}/app
243 %attr(-,%{uname},%{gname}) %{homedir}/app/*
244 %dir %attr(755,%{uname},%{gname}) %{homedir}/bin
245 %attr(-,%{uname},%{gname}) %{homedir}/bin/*
246 %dir %attr(755,%{uname},%{gname}) %{homedir}/builds
247 %dir %attr(755,%{uname},%{gname}) %{homedir}/config
248 %attr(-,%{uname},%{gname}) %{homedir}/config/*
249 %dir %attr(755,%{uname},%{gname}) %{homedir}/db
250 %attr(-,%{uname},%{gname}) %{homedir}/db/*
251 %dir %attr(755,%{uname},%{gname}) %{homedir}/doc
252 %attr(-,%{uname},%{gname}) %{homedir}/doc/*
253 %dir %attr(755,%{uname},%{gname}) %{homedir}/lib
254 %attr(-,%{uname},%{gname}) %{homedir}/lib/*
255
256 %{homedir}/fixtures
257 %{homedir}/generator_templates
258
259 %dir %{homedir}/public
260 %{homedir}/public/ci
261 %{homedir}/public/*.*
262 %attr(-,%{uname},%{gname}) %{homedir}/public/uploads
263 %attr(-,%{uname},%{gname}) %{homedir}/public/assets
264 %dir %attr(755,%{uname},%{gname}) %{homedir}/satellites
265
266 %dir %attr(755,%{uname},%{gname}) %{homedir}/tmp
267 %attr(-,%{uname},%{gname}) %{homedir}/tmp/backups
268 %attr(-,%{uname},%{gname}) %{homedir}/tmp/cache
269 %attr(-,%{uname},%{gname}) %{homedir}/tmp/sessions
270 %attr(-,%{uname},%{gname}) %{homedir}/tmp/sockets
271 %attr(-,%{uname},%{gname}) %{homedir}/tmp/pids
272
273 %dir %attr(755,%{uname},%{gname}) %{homedir}/www
274
275 %dir %attr(750,%{uname},%{gname}) %{homedir}/shared
276 %dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts
277 %dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts/tmp
278 %dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts/tmp/cache
279 %dir %attr(750,%{uname},%{gname}) %{homedir}/shared/artifacts/tmp/uploads
280 %dir %attr(750,%{uname},%{gname}) %{homedir}/shared/lfs-objects
281 %dir %attr(750,%{uname},%{gname}) %{homedir}/shared/registry
282
283 %dir %attr(755,%{uname},%{gname}) %{homedir}/.bundle
284 %attr(-,%{uname},%{gname}) %{homedir}/.bundle/config
285 %attr(-,%{uname},%{gname}) %{homedir}/.ruby-version
286 %attr(-,%{uname},%{gname}) %{homedir}/CHANGELOG
287 %attr(-,%{uname},%{gname}) %{homedir}/GITLAB_WORKHORSE_VERSION
288 %attr(-,%{uname},%{gname}) %{homedir}/GITLAB_SHELL_VERSION
289 %attr(-,%{uname},%{gname}) %{homedir}/Gemfile*
290 %attr(-,%{uname},%{gname}) %{homedir}/LICENSE
291 %attr(-,%{uname},%{gname}) %{homedir}/*.md
292 %attr(-,%{uname},%{gname}) %{homedir}/Rakefile
293 %attr(-,%{uname},%{gname}) %{homedir}/VERSION
294 %attr(-,%{uname},%{gname}) %{homedir}/config.ru
295
296 %{homedir}/log
297 %dir %attr(771,root,%{gname}) %{_localstatedir}/log/gitlab
298 %dir %attr(771,root,%{gname}) %{_localstatedir}/run/gitlab
299
300 %defattr(-,root,root,-)
301 %dir %{homedir}/vendor
302 %{homedir}/vendor/*
This page took 0.062553 seconds and 4 git commands to generate.