]>
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 ER |
6 | # |
7 | # install notes: https://gitlab.com/gitlab-org/gitlab-ce/blob/v8.6.3/doc/install/installation.md | |
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 | |
e1281e41 | 15 | %bcond_with gem_cache # build from local gem cache only (avoids network) |
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 |
edff9e13 ER |
20 | Release: 0.1 |
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 | |
32 | BuildRequires: ruby-bundler | |
33 | Obsoletes: gitlab <= 8.1.4 | |
34 | Requires(pre): gitlab-shell | |
35 | Requires: apache-base | |
6f80237a | 36 | Requires: git-core >= 2.7.4 |
edff9e13 | 37 | Requires: ruby-bundler |
1bfc7ca0 ER |
38 | Suggests: mysql |
39 | Suggests: redis-server | |
edff9e13 ER |
40 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
41 | ||
42 | %define gitlab_uid 65434 | |
43 | %define gitlab_gid 65434 | |
44 | ||
45 | %define homedir %{_localstatedir}/lib/gitlab | |
46 | ||
47 | %description | |
48 | GitLab Community Edition (CE) is open source software to collaborate | |
49 | on code. Create projects and repositories, manage access and do code | |
50 | reviews. GitLab CE is on-premises software that you can install and | |
51 | use on your server(s). | |
52 | ||
53 | %prep | |
1bfc7ca0 | 54 | %setup -qn gitlabhq-%{version} |
edff9e13 ER |
55 | |
56 | # Patching config files: | |
57 | sed -e "s|# user: git|user: gitlab|" \ | |
58 | -e "s|/home/git/repositories|%{homedir}/repositories|" \ | |
59 | -e "s|/home/git/gitlab-satellites|%{homedir}/satellites|" \ | |
60 | -e "s|/home/git/gitlab-shell|/usr/share/gitlab-shell|" \ | |
61 | config/gitlab.yml.example > config/gitlab.yml | |
62 | sed -e "s|/home/git/gitlab/tmp/.*/|/run/gitlab/|g" \ | |
63 | -e "s|/home/git/gitlab|%{homedir}|g" \ | |
64 | -e "s|/usr/share/gitlab/log|%{homedir}/log|g" \ | |
65 | -e "s|timeout 30|timeout 300|" \ | |
66 | config/unicorn.rb.example > config/unicorn.rb | |
67 | sed -e "s|username: git|username: gitlab|" \ | |
68 | config/database.yml.mysql > config/database.yml | |
b262a96c ER |
69 | |
70 | rm .flayignore | |
71 | rm .gitignore | |
6f80237a | 72 | rm .csscomb.json |
b262a96c | 73 | find -name .gitkeep | xargs rm |
edff9e13 ER |
74 | |
75 | %build | |
edff9e13 | 76 | bundle install %{_smp_mflags} \ |
7470b5a8 | 77 | --verbose \ |
e1281e41 | 78 | %{?with_gem_cache:--local} \ |
7470b5a8 | 79 | %{?debug:--no-cache --no-prune} \ |
1bfc7ca0 | 80 | --deployment --without development test aws %{!?with_krb5:kerberos} |
edff9e13 ER |
81 | |
82 | %install | |
83 | rm -rf $RPM_BUILD_ROOT | |
84 | install -d \ | |
85 | $RPM_BUILD_ROOT%{homedir}/www \ | |
86 | $RPM_BUILD_ROOT%{homedir}/public/uploads \ | |
87 | $RPM_BUILD_ROOT%{_sysconfdir}/gitlab \ | |
88 | $RPM_BUILD_ROOT%{_docdir}/gitlab \ | |
89 | $RPM_BUILD_ROOT%{homedir}/satellites | |
90 | ||
b262a96c ER |
91 | # test if we can hardlink -- %{_builddir} and $RPM_BUILD_ROOT on same partition |
92 | if cp -al VERSION $RPM_BUILD_ROOT/VERSION 2>/dev/null; then | |
93 | l=l | |
94 | rm -f $RPM_BUILD_ROOT/VERSION | |
95 | fi | |
96 | ||
97 | cp -a$l . $RPM_BUILD_ROOT%{homedir} | |
edff9e13 ER |
98 | |
99 | # Creating links | |
100 | ln -fs /run/gitlab $RPM_BUILD_ROOT%{homedir}/pids | |
101 | ln -fs /run/gitlab $RPM_BUILD_ROOT%{homedir}/sockets | |
102 | ln -fs %{_localstatedir}/log/gitlab $RPM_BUILD_ROOT%{homedir}/log | |
1bfc7ca0 | 103 | install -d $RPM_BUILD_ROOT%{_localstatedir}/log/gitlab |
edff9e13 ER |
104 | |
105 | # Install config files | |
106 | for f in gitlab.yml unicorn.rb database.yml; do | |
107 | install -m0644 config/$f $RPM_BUILD_ROOT%{_sysconfdir}/gitlab/$f | |
1bfc7ca0 | 108 | [ -f "$RPM_BUILD_ROOT%{homedir}/config/$f" ] && rm $RPM_BUILD_ROOT%{homedir}/config/$f |
edff9e13 ER |
109 | ln -fs %{_sysconfdir}/gitlab/$f $RPM_BUILD_ROOT%{homedir}/config/ |
110 | done | |
111 | ||
112 | # Install systemd service files | |
113 | install -D %{S:1} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab.target | |
114 | install -D %{S:2} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-sidekiq.service | |
115 | install -D %{S:3} $RPM_BUILD_ROOT%{systemdunitdir}/gitlab-unicorn.service | |
116 | install -D %{S:4} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/gitlab.logrotate | |
117 | install -D %{S:5} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/gitlab.conf | |
118 | install -D %{S:6} $RPM_BUILD_ROOT%{_sysconfdir}/httpd/httpd.d/gitlab.conf | |
119 | ||
120 | %clean | |
121 | rm -rf "$RPM_BUILD_ROOT" | |
122 | ||
123 | %pre | |
124 | if [ $1 -ge 1 ]; then | |
125 | %groupadd gitlab -g %{gitlab_gid} | |
126 | %useradd -u %{gitlab_uid} -c 'Gitlab user' -d %{homedir} -g gitlab -s /bin/bash gitlab | |
127 | fi | |
128 | ||
129 | %post | |
130 | if [ $1 -ge 1 ]; then | |
131 | systemctl -q daemon-reload | |
132 | systemd-tmpfiles --create %{systemdtmpfilesdir}/gitlab.conf | |
133 | [ -e %{_localstatedir}/lock/subsys/httpd ] && service httpd reload || : | |
134 | fi | |
135 | if [ $1 -eq 1 ]; then | |
136 | systemctl -q enable gitlab-unicorn | |
137 | systemctl -q enable gitlab-sidekiq | |
138 | systemctl -q enable gitlab.target | |
139 | systemctl -q start gitlab-unicorn | |
140 | systemctl -q start gitlab-sidekiq | |
141 | systemctl -q start gitlab.target | |
142 | sudo -u gitlab -H git config --global user.name "GitLab" | |
143 | sudo -u gitlab -H git config --global user.email "gitlab@localhost" | |
144 | sudo -u gitlab -H git config --global core.autocrlf input | |
145 | echo "Create and configure database in /etc/gitlab/database.yml" | |
146 | echo "Then run 'sudo -u gitlab bundle exec rake gitlab:setup RAILS_ENV=production'" | |
147 | echo | |
148 | else | |
149 | systemctl -q try-restart gitlab-unicorn | |
150 | systemctl -q try-start gitlab-sidekiq | |
151 | fi | |
152 | ||
153 | %postun | |
154 | if [ $1 -eq 0 ]; then | |
155 | %userremove gitlab | |
156 | %groupremove gitlab | |
157 | fi | |
158 | ||
159 | %files | |
160 | %defattr(644,root,root,755) | |
161 | %doc LICENSE | |
162 | %dir %{_sysconfdir}/gitlab | |
163 | %config(noreplace) %{_sysconfdir}/gitlab/database.yml | |
164 | %config(noreplace) %{_sysconfdir}/gitlab/gitlab.yml | |
165 | %config(noreplace) %{_sysconfdir}/gitlab/unicorn.rb | |
166 | %config(noreplace) %{_sysconfdir}/httpd/httpd.d/gitlab.conf | |
167 | /etc/logrotate.d/gitlab.logrotate | |
168 | %{systemdunitdir}/gitlab-sidekiq.service | |
169 | %{systemdunitdir}/gitlab-unicorn.service | |
170 | %{systemdunitdir}/gitlab.target | |
171 | %{systemdtmpfilesdir}/gitlab.conf | |
172 | %dir %attr(755,gitlab,gitlab) %{homedir} | |
173 | %dir %attr(755,gitlab,gitlab) %{homedir}/app | |
174 | %attr(-,gitlab,gitlab) %{homedir}/app/* | |
175 | %dir %attr(755,gitlab,gitlab) %{homedir}/bin | |
176 | %attr(-,gitlab,gitlab) %{homedir}/bin/* | |
177 | %dir %attr(755,gitlab,gitlab) %{homedir}/builds | |
edff9e13 ER |
178 | %dir %attr(755,gitlab,gitlab) %{homedir}/config |
179 | %attr(-,gitlab,gitlab) %{homedir}/config/* | |
180 | %dir %attr(755,gitlab,gitlab) %{homedir}/db | |
181 | %attr(-,gitlab,gitlab) %{homedir}/db/* | |
182 | %dir %attr(755,gitlab,gitlab) %{homedir}/doc | |
183 | %attr(-,gitlab,gitlab) %{homedir}/doc/* | |
184 | %dir %attr(755,gitlab,gitlab) %{homedir}/docker | |
185 | %attr(-,gitlab,gitlab) %{homedir}/docker/* | |
186 | %dir %attr(755,gitlab,gitlab) %{homedir}/features | |
187 | %attr(-,gitlab,gitlab) %{homedir}/features/* | |
188 | %dir %attr(755,gitlab,gitlab) %{homedir}/lib | |
189 | %attr(-,gitlab,gitlab) %{homedir}/lib/* | |
190 | %dir %attr(755,gitlab,gitlab) %{homedir}/log | |
191 | %attr(-,gitlab,gitlab) %{homedir}/log/* | |
edff9e13 ER |
192 | %dir %attr(755,gitlab,gitlab) %{homedir}/pids |
193 | %dir %attr(755,gitlab,gitlab) %{homedir}/public | |
194 | %attr(-,gitlab,gitlab) %{homedir}/public/* | |
195 | %dir %attr(755,gitlab,gitlab) %{homedir}/satellites | |
196 | %dir %attr(755,gitlab,gitlab) %{homedir}/scripts | |
197 | %attr(-,gitlab,gitlab) %{homedir}/scripts/* | |
198 | %dir %attr(755,gitlab,gitlab) %{homedir}/sockets | |
199 | %dir %attr(755,gitlab,gitlab) %{homedir}/spec | |
200 | %attr(-,gitlab,gitlab) %{homedir}/spec/* | |
201 | %dir %attr(755,gitlab,gitlab) %{homedir}/tmp | |
202 | %attr(-,gitlab,gitlab) %{homedir}/tmp/* | |
203 | %dir %{homedir}/vendor | |
204 | %{homedir}/vendor/* | |
205 | %dir %attr(755,gitlab,gitlab) %{homedir}/www | |
206 | ||
207 | %dir %attr(755,gitlab,gitlab) %{homedir}/.bundle | |
208 | %attr(-,gitlab,gitlab) %{homedir}/.bundle/config | |
209 | %attr(-,gitlab,gitlab) %{homedir}/.foreman | |
210 | %attr(-,gitlab,gitlab) %{homedir}/docker-compose.yml | |
211 | %attr(-,gitlab,gitlab) %{homedir}/.gitattributes | |
212 | %attr(-,gitlab,gitlab) %{homedir}/.*.yml | |
213 | %attr(-,gitlab,gitlab) %{homedir}/.rspec | |
214 | %attr(-,gitlab,gitlab) %{homedir}/.ruby-version | |
215 | %attr(-,gitlab,gitlab) %{homedir}/.simplecov | |
216 | %attr(-,gitlab,gitlab) %{homedir}/CHANGELOG | |
1bfc7ca0 | 217 | %attr(-,gitlab,gitlab) %{homedir}/GITLAB_WORKHORSE_VERSION |
edff9e13 ER |
218 | %attr(-,gitlab,gitlab) %{homedir}/GITLAB_SHELL_VERSION |
219 | %attr(-,gitlab,gitlab) %{homedir}/Gemfile* | |
220 | %attr(-,gitlab,gitlab) %{homedir}/LICENSE | |
221 | %attr(-,gitlab,gitlab) %{homedir}/*.md | |
222 | %attr(-,gitlab,gitlab) %{homedir}/Procfile | |
223 | %attr(-,gitlab,gitlab) %{homedir}/Rakefile | |
224 | %attr(-,gitlab,gitlab) %{homedir}/VERSION | |
225 | %attr(-,gitlab,gitlab) %{homedir}/config.ru | |
b262a96c | 226 | %attr(-,gitlab,gitlab) %{homedir}/fixtures |