Commit 32abf6e8ffca40eb0878219e083a71117cb30ee9
1 parent
63c8fee9
Exists in
master
WIP: Update gitlab 7.6 to gitlab 8.5
- Add some functions to reuse code - configure pg_hba.conf
Showing
1 changed file
with
37 additions
and
14 deletions
Show diff stats
provision.sh
@@ -2,16 +2,33 @@ | @@ -2,16 +2,33 @@ | ||
2 | 2 | ||
3 | set -x | 3 | set -x |
4 | 4 | ||
5 | +enable_start_gitlab() | ||
6 | +{ | ||
7 | + systemctl enable gitlab | ||
8 | + systemctl start gitlab | ||
9 | +} | ||
10 | + | ||
11 | +package() | ||
12 | +{ | ||
13 | + args=("$@") | ||
14 | + default="install" | ||
15 | + i="0" | ||
16 | + while [[ ! -z "${args[i]// }" ]]; do | ||
17 | + yum $default -y ${args[i]// } | ||
18 | + i=$[$i + 1] | ||
19 | + done | ||
20 | +} | ||
21 | + | ||
5 | # Disable SELINUX (for now) | 22 | # Disable SELINUX (for now) |
6 | sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config | 23 | sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config |
7 | setenforce 0 | 24 | setenforce 0 |
8 | 25 | ||
9 | -yum -y install epel-release | ||
10 | -yum -y install wget postgresql-server nginx | 26 | +package epel-release |
27 | +package wget postgresql-server nginx | ||
11 | 28 | ||
12 | wget -P /etc/yum.repos.d/ https://copr.fedorainfracloud.org/coprs/softwarepublico/v4/repo/epel-7/softwarepublico-v4-epel-7.repo | 29 | wget -P /etc/yum.repos.d/ https://copr.fedorainfracloud.org/coprs/softwarepublico/v4/repo/epel-7/softwarepublico-v4-epel-7.repo |
13 | 30 | ||
14 | -yum -y install gitlab | 31 | +package gitlab |
15 | 32 | ||
16 | ############################################ | 33 | ############################################ |
17 | # Coisas estranhas: | 34 | # Coisas estranhas: |
@@ -62,12 +79,18 @@ yum -y install gitlab | @@ -62,12 +79,18 @@ yum -y install gitlab | ||
62 | 79 | ||
63 | postgresql-setup initdb | 80 | postgresql-setup initdb |
64 | 81 | ||
65 | -#TODO: edit /var/lib/pgsql/data/pg_hba.conf ? | 82 | +cat << EOF > /var/lib/pgsql/data/pg_hba.conf |
83 | +# METHOD can be "trust", "reject", "md5", "password", "gss", "sspi", | ||
66 | 84 | ||
67 | -systemctl enable postgresql redis | ||
68 | -systemctl start postgresql redis | 85 | +# TYPE DATABASE USER ADDRESS METHOD |
86 | +local all all trust | ||
87 | +host all all 127.0.0.1/32 trust | ||
88 | +host all all ::1/128 trust | ||
89 | +EOF | ||
90 | + | ||
91 | +enable_start_gitlab | ||
69 | sudo -u postgres createuser git | 92 | sudo -u postgres createuser git |
70 | -#sudo -u postgres createdb --owner=git gitlabhq_production | 93 | + |
71 | cd /usr/lib/gitlab | 94 | cd /usr/lib/gitlab |
72 | sudo -u git bundle exec rake db:setup RAILS_ENV=production && touch /var/lib/gitlab/setup.done | 95 | sudo -u git bundle exec rake db:setup RAILS_ENV=production && touch /var/lib/gitlab/setup.done |
73 | 96 | ||
@@ -130,8 +153,6 @@ chown -R git:git /var/lib/gitlab-assets | @@ -130,8 +153,6 @@ chown -R git:git /var/lib/gitlab-assets | ||
130 | cd /usr/lib/gitlab && | 153 | cd /usr/lib/gitlab && |
131 | sudo -u git bundle exec rake assets:precompile RAILS_ENV=production | 154 | sudo -u git bundle exec rake assets:precompile RAILS_ENV=production |
132 | 155 | ||
133 | -systemctl enable gitlab | ||
134 | -systemctl start gitlab | ||
135 | 156 | ||
136 | ##### restore backup | 157 | ##### restore backup |
137 | if [ -e /vagrant/*_backup.tar ]; then | 158 | if [ -e /vagrant/*_backup.tar ]; then |
@@ -149,14 +170,16 @@ if [[ -e $backup ]]; then | @@ -149,14 +170,16 @@ if [[ -e $backup ]]; then | ||
149 | chown git.git $backup | 170 | chown git.git $backup |
150 | ln $backup /var/lib/gitlab/backups/ | 171 | ln $backup /var/lib/gitlab/backups/ |
151 | cd /usr/lib/gitlab | 172 | cd /usr/lib/gitlab |
152 | - sudo -u git bundle exec rake gitlab:backup:restore RAILS_ENV=production force=yes | 173 | + #sudo -u git bundle exec rake gitlab:backup:restore RAILS_ENV=production force=yes |
153 | else | 174 | else |
154 | printf "Backup não encontrado" | 175 | printf "Backup não encontrado" |
155 | fi | 176 | fi |
156 | 177 | ||
178 | +printf "Instalando gitlab 8.5" | ||
157 | 179 | ||
158 | -# bootstrap / provision | ||
159 | - | ||
160 | -#sudo su - vagrant | ||
161 | - | 180 | +wget -P /etc/yum.repos.d/ https://copr.fedorainfracloud.org/coprs/softwarepublico/experimental/repo/epel-7/softwarepublico-experimental-epel-7.repo |
162 | 181 | ||
182 | +package centos-release-scl | ||
183 | +package rh-ruby22 | ||
184 | +yum -y update gitlab | ||
185 | +enable_start_gitlab |