Commit fbc2f834437d8d62c1eaddaafcdedaf81149b584
1 parent
65d1973f
Exists in
master
Add steps to deploy gitlab 8.5
- Configure nginx. - Create another admin user in database - Restart gitlab service as last step
Showing
2 changed files
with
57 additions
and
26 deletions
Show diff stats
Vagrantfile
| ... | ... | @@ -13,6 +13,11 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| |
| 13 | 13 | config.vm.provision "shell", keep_color: true, path: 'provision.sh' |
| 14 | 14 | |
| 15 | 15 | #config.vm.network :forwarded_port, guest: 8080, host: 8080 # Gitlab |
| 16 | - config.vm.network :forwarded_port, guest: 8081, host: 8081 # Nginx | |
| 16 | + config.vm.network :forwarded_port, guest: 8081, host: 4567 # Nginx | |
| 17 | + | |
| 18 | + config.vm.provider "virtualbox" do |v| | |
| 19 | + v.memory = 2048 | |
| 20 | + v.cpus = 2 | |
| 21 | + end | |
| 17 | 22 | |
| 18 | 23 | end | ... | ... |
provision.sh
| ... | ... | @@ -80,35 +80,53 @@ enable_start_service gitlab |
| 80 | 80 | sudo -u git bundle exec rake db:setup RAILS_ENV=production && touch /var/lib/gitlab/setup.done |
| 81 | 81 | |
| 82 | 82 | cat << EOF > /etc/nginx/conf.d/gitlab.conf |
| 83 | -upstream gitlab { | |
| 84 | - server 0.0.0.0:8080 fail_timeout=10s; | |
| 83 | +upstream gitlab-workhorse { | |
| 84 | + server unix:/usr/lib/gitlab/tmp/sockets/gitlab-workhorse.socket fail_timeout=10s; | |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | server { |
| 88 | - listen *:8081; | |
| 89 | - server_name localhost:8081; | |
| 90 | - underscores_in_headers on; | |
| 91 | - access_log /var/log/nginx/gitlab.access.log; | |
| 92 | - error_log /var/log/nginx/gitlab.error.log; | |
| 93 | - client_max_body_size 20m; | |
| 94 | - | |
| 95 | - location /gitlab/assets/ { | |
| 96 | - alias /usr/lib/gitlab/public/assets/; | |
| 97 | - } | |
| 88 | + listen *:8081 default_server; | |
| 89 | + large_client_header_buffers 4 32k; | |
| 90 | + server_name gitlab.dev; ## Replace this with something like gitlab.example.com | |
| 91 | + server_tokens off; ## Don't show the nginx version number, a security best practice | |
| 92 | + root /usr/lib/gitlab/public; | |
| 98 | 93 | |
| 99 | - location /gitlab/uploads/ { | |
| 100 | - alias /usr/lib/gitlab/public/uploads/; | |
| 101 | - } | |
| 94 | + client_max_body_size 20m; | |
| 95 | + | |
| 96 | + access_log /var/log/nginx/gitlab_access.log; | |
| 97 | + error_log /var/log/nginx/gitlab_error.log; | |
| 98 | + | |
| 99 | +location / { | |
| 100 | +try_files \$uri \$uri/index.html \$uri.html @gitlab; | |
| 101 | +} | |
| 102 | 102 | |
| 103 | - location / { | |
| 104 | - proxy_pass http://gitlab; | |
| 105 | - proxy_read_timeout 90; | |
| 106 | - proxy_connect_timeout 90; | |
| 103 | +location @gitlab { | |
| 104 | + client_max_body_size 0; | |
| 105 | + gzip off; | |
| 106 | + | |
| 107 | + proxy_read_timeout 300; | |
| 108 | + proxy_connect_timeout 300; | |
| 107 | 109 | proxy_redirect off; |
| 108 | - proxy_set_header Host localhost:8081; | |
| 109 | - proxy_set_header X-Real-IP \$remote_addr; | |
| 110 | - proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; | |
| 110 | + | |
| 111 | + proxy_http_version 1.1; | |
| 112 | + | |
| 113 | + proxy_set_header Host \$http_host; | |
| 114 | + proxy_set_header X-Real-IP \$remote_addr; | |
| 115 | + proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; | |
| 116 | + proxy_set_header X-Forwarded-Proto \$scheme; | |
| 117 | + | |
| 118 | + proxy_pass http://gitlab-workhorse; | |
| 119 | +} | |
| 120 | + | |
| 121 | + location ~ ^/(assets)/ { | |
| 122 | + root /usr/lib/gitlab/public; | |
| 123 | + | |
| 124 | + gzip_static on; # to serve pre-gzipped version | |
| 125 | + expires max; | |
| 126 | + add_header Cache-Control public; | |
| 111 | 127 | } |
| 128 | + | |
| 129 | + error_page 502 /502.html; | |
| 112 | 130 | } |
| 113 | 131 | EOF |
| 114 | 132 | |
| ... | ... | @@ -151,8 +169,9 @@ sudo chmod -R ug-s /var/lib/gitlab-shell/repositories/ |
| 151 | 169 | sudo find /var/lib/gitlab-shell/repositories/ -type d -print0 | sudo xargs -0 chmod g+s |
| 152 | 170 | sudo chmod -R 777 /var/log/gitlab-shell/ |
| 153 | 171 | |
| 154 | -cat << EOF > /usr/lib/gitlab-shell/config.yml | |
| 172 | +rm /usr/lib/gitlab-shell/config.yml | |
| 155 | 173 | |
| 174 | +cat << EOF > /usr/lib/gitlab-shell/config.yml | |
| 156 | 175 | user: git |
| 157 | 176 | gitlab_url: "http://127.0.0.1:8080/gitlab" |
| 158 | 177 | |
| ... | ... | @@ -180,12 +199,19 @@ log_level: INFO |
| 180 | 199 | audit_usernames: false |
| 181 | 200 | EOF |
| 182 | 201 | |
| 202 | +chown -R git.git /var/lib/gitlab-shell/ | |
| 183 | 203 | |
| 184 | - | |
| 185 | -enable_start_service gitlab | |
| 204 | +systemctl restart gitlab | |
| 186 | 205 | |
| 187 | 206 | sudo -u git env PATH=/opt/rh/rh-ruby22/root/usr/bin/:/opt/rh/nodejs010/root/usr/bin/:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin LD_LIBRARY_PATH=/opt/rh/rh-ruby22/root/usr/lib64:/opt/rh/nodejs010/root/lib64/:/opt/rh/v8314/root/usr/lib64/ bundle exec rake db:migrate RAILS_ENV=production |
| 188 | 207 | |
| 189 | 208 | sudo -u git env PATH=/opt/rh/rh-ruby22/root/usr/bin/:/opt/rh/nodejs010/root/usr/bin/:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin LD_LIBRARY_PATH=/opt/rh/rh-ruby22/root/usr/lib64:/opt/rh/nodejs010/root/lib64/:/opt/rh/v8314/root/usr/lib64/ bundle exec rake assets:precompile RAILS_ENV=production |
| 190 | 209 | |
| 210 | +#create new root user | |
| 211 | +sed -i "s|username: 'root'|username: 'devroot'|" /usr/lib/gitlab/db/fixtures/production/001_admin.rb | |
| 212 | + | |
| 213 | +sudo -u git env PATH=/opt/rh/rh-ruby22/root/usr/bin/:/opt/rh/nodejs010/root/usr/bin/:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin LD_LIBRARY_PATH=/opt/rh/rh-ruby22/root/usr/lib64:/opt/rh/nodejs010/root/lib64/:/opt/rh/v8314/root/usr/lib64/ bundle exec rake db:seed_fu RAILS_ENV=production | |
| 214 | + | |
| 191 | 215 | sudo -u git env PATH=/opt/rh/rh-ruby22/root/usr/bin/:/opt/rh/nodejs010/root/usr/bin/:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin LD_LIBRARY_PATH=/opt/rh/rh-ruby22/root/usr/lib64:/opt/rh/nodejs010/root/lib64/:/opt/rh/v8314/root/usr/lib64/ bundle exec rake gitlab:check RAILS_ENV=production |
| 216 | + | |
| 217 | +systemctl restart gitlab | ... | ... |