gitlab.spec
4.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
Name: gitlab
Version: 7.6.2
Release: 1%{?dist}
Summary: Software Development Platform
Group: Development/Tools
License: Expat
URL: https://beta.softwarepublico.gov.br/gitlab/softwarepublico/gitlab
Source0: %{name}-%{version}.tar.gz
Patch0: gitlab-7.5.2-jquery-ui-5.patch
BuildArch: noarch
BuildRequires: gitlab-deps
Requires: gitlab-deps, gitlab-shell, git
%description
GitLab
%prep
%setup -q
#%patch0 -p 1
%build
cat > config/gitlab.yml <<EOF
production: &base
gitlab:
host: localhost
port: 80 # Set to 443 if using HTTPS
https: false # Set to true if using HTTPS
email_from: example@example.com
default_projects_limit: 10
default_projects_features:
issues: true
merge_requests: true
wiki: true
snippets: false
visibility_level: "private" # can be "private" | "internal" | "public"
gravatar:
enabled: true
plain_url: "http://cdn.libravatar.org/avatar/%{hash}?s=%{size}&d=identicon"
ssl_url: "https://seccdn.libravatar.org/avatar/%{hash}?s=%{size}&d=identicon"
omniauth:
# Allow login via Twitter, Google, etc. using OmniAuth providers
enabled: false
allow_single_sign_on: false
block_auto_created_users: true
providers:
# - { name: 'google_oauth2', app_id: 'YOUR APP ID',
# app_secret: 'YOUR APP SECRET',
# args: { access_type: 'offline', approval_prompt: '' } }
satellites:
path: /var/lib/gitlab/satellites
timeout: 30
backup:
path: /var/lib/gitlab/backups
gitlab_shell:
path: /usr/lib/gitlab-shell
repos_path: /var/lib/gitlab/repositories/
hooks_path: /usr/lib/gitlab-shell/hooks/
# Git over HTTP
upload_pack: true
receive_pack: true
git:
bin_path: /usr/bin/git
max_size: 20971520 # 20.megabytes
timeout: 10
extra:
## Piwik analytics.
# piwik_url: '_your_piwik_url'
# piwik_site_id: '_your_piwik_site_id'
## Text under sign-in page (Markdown enabled)
# sign_in_text: |
# 
# [Learn more about CompanyName](http://www.companydomain.com/)
EOF
%install
mkdir -p %{buildroot}/etc/gitlab
mv config/gitlab.yml %{buildroot}/etc/gitlab/gitlab.yml
cp config/unicorn.rb.example %{buildroot}/etc/gitlab/unicorn.rb
cp config/database.yml.postgresql %{buildroot}/etc/gitlab/database.yml
sed -i 's/\/home\/\git/\/usr\/lib/' %{buildroot}/etc/gitlab/unicorn.rb
mkdir -p %{buildroot}/usr/lib/gitlab
cp -r app bin config config.ru db doc GITLAB_SHELL_VERSION lib Procfile public Rakefile vendor VERSION %{buildroot}/usr/lib/gitlab/
mv %{buildroot}/usr/lib/gitlab/config/initializers/rack_attack.rb.example %{buildroot}/usr/lib/gitlab/config/initializers/rack_attack.rb
for configfile in gitlab.yml unicorn.rb database.yml; do
ln -s /etc/gitlab/$configfile %{buildroot}/usr/lib/gitlab/config
done
ln -s /var/log/gitlab %{buildroot}/usr/lib/gitlab/log
ln -s /var/lib/gitlab/tmp %{buildroot}/usr/lib/gitlab/tmp
ln -s /var/lib/gitlab/.gitlab_shell_secret %{buildroot}/usr/lib/gitlab/.gitlab_shell_secret
ln -s /var/lib/gitlab/.secret %{buildroot}/usr/lib/gitlab/.secret
ln -s /var/lib/gitlab-assets %{buildroot}/usr/lib/gitlab/public/assets
%post
groupadd git || true
if ! id git; then
adduser --system --home-dir /usr/lib/gitlab --no-create-home --gid git git
fi
if [ -x /usr/bin/postgres ]; then
service postgresql initdb || true
service postgresql start
sudo -u postgres createuser --createdb git || true
fi
mkdir -p /var/log/gitlab
chown -R git:git /var/log/gitlab
mkdir -p /var/lib/gitlab/backups
mkdir -p /var/lib/gitlab/repositories
mkdir -p /var/lib/gitlab/satellites
mkdir -p /var/lib/gitlab/tmp
touch /var/lib/gitlab/.gitconfig
ln -s /var/lib/gitlab/.gitconfig /usr/lib/gitlab/.gitconfig
chown -R git:git /var/lib/gitlab
chmod u+rwx,g=rx,o-rwx /var/lib/gitlab/satellites
if [ /usr/bin/redis-server ]; then
service redis start
fi
sudo -u git -H "/usr/bin/git" config --global user.name "GitLab"
sudo -u git -H "/usr/bin/git" config --global user.email "example@example.com"
sudo -u git -H "/usr/bin/git" config --global core.autocrlf "input"
mkdir -p /var/lib/gitlab-assets
cd /usr/lib/gitlab/
yes yes | sudo -u git bundle exec rake gitlab:setup RAILS_ENV=production
bundle exec rake assets:precompile RAILS_ENV=production
cp /usr/lib/gitlab/lib/support/init.d/gitlab /etc/init.d/gitlab
cp /usr/lib/gitlab/lib/support/init.d/gitlab.default.example /etc/default/gitlab
cp /usr/lib/gitlab/lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
sed -i 's/app_root="\/home\/\$app_user\/gitlab"/app_root="\/usr\/lib\/gitlab"/' /etc/default/gitlab
sed -i 's/\/home\/\git/\/usr\/lib/' /etc/logrotate.d/gitlab
%postun
service gitlab stop
%files
/usr/lib/gitlab
/etc/gitlab
%doc