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