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