diff --git a/config/initializers/smtp_settings.rb.sample b/config/initializers/smtp_settings.rb.sample index 333c388f5ff652f9a840bba19c67b615ed12392c..e62ad0f4b7140786303f2496461b4064dfcd1ca8 100644 --- a/config/initializers/smtp_settings.rb.sample +++ b/config/initializers/smtp_settings.rb.sample @@ -1,7 +1,7 @@ # To enable smtp email delivery for your GitLab instance do next: # 1. Change config/environments/production.rb to use smtp # config.action_mailer.delivery_method = :smtp -# 2. Rename this file to smpt_settings.rb +# 2. Rename this file to smtp_settings.rb # 3. Edit settings inside this file # 4. Restart GitLab instance # diff --git a/doc/update/5.1-to-5.2.md b/doc/update/5.1-to-5.2.md index 8f2116837b8d456551d53a0deb179a93bcd0bafd..3f874555f49a298f8ba4759bbcb5a7e2beee2217 100644 --- a/doc/update/5.1-to-5.2.md +++ b/doc/update/5.1-to-5.2.md @@ -1,5 +1,15 @@ # From 5.1 to 5.2 +### 0. Backup + +It's useful to make a backup just in case things go south: +(With MySQL, this may require granting "LOCK TABLES" privileges to the GitLab user on the database version) + +```bash +cd /home/git/gitlab +sudo -u git -H RAILS_ENV=production bundle exec rake gitlab:backup:create +``` + ### 1. Stop server sudo service gitlab stop @@ -20,14 +30,59 @@ sudo -u git -H git fetch sudo -u git -H git checkout v1.4.0 ``` -### 4. Install libs, migrations etc +### 4. Install libs, migrations, etc. ```bash cd /home/git/gitlab + +# MySQL sudo -u git -H bundle install --without development test postgres --deployment + +#PostgreSQL +sudo -u git -H bundle install --without development test mysql --deployment + sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production ``` -### 5. Start application +### 5. Update config files + +* Make `/home/git/gitlab/config/gitlab.yml` same as https://github.com/gitlabhq/gitlabhq/blob/5-2-stable/config/gitlab.yml.example but with your settings. +* Make `/home/git/gitlab/config/puma.rb` same as https://github.com/gitlabhq/gitlabhq/blob/5-2-stable/config/puma.rb.example but with your settings. + +### 6. Update Init script + +```bash +sudo rm /etc/init.d/gitlab +sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlabhq/5-2-stable/lib/support/init.d/gitlab +sudo chmod +x /etc/init.d/gitlab +``` + +### 6. Start application sudo service gitlab start + sudo service nginx restart + +### 7. Check application status + +Check if GitLab and its environment are configured correctly: + + sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production + +To make sure you didn't miss anything run a more thorough check with: + + sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production + +If all items are green, then congratulations upgrade complete! + +## Things went south? Revert to previous version (5.1) + +### 1. Revert the code to the previous version +Follow the [`upgrade guide from 5.0 to 5.1`](5.0-to-5.1.md), except for the database migration +(The backup is already migrated to the previous version) + +### 2. Restore from the backup: + +```bash +cd /home/git/gitlab +sudo -u git -H RAILS_ENV=production bundle exec rake gitlab:backup:restore +``` diff --git a/lib/support/init.d/gitlab b/lib/support/init.d/gitlab index 4c5499bbf23a547e8b9931bc935d9616989c8992..f4ca07b36765700583c9a3a58ebb0ea005adc4c3 100644 --- a/lib/support/init.d/gitlab +++ b/lib/support/init.d/gitlab @@ -2,7 +2,7 @@ # GITLAB # Maintainer: @randx -# App Version: 5.1 +# App Version: 5.2 ### BEGIN INIT INFO # Provides: gitlab @@ -19,6 +19,7 @@ APP_ROOT="/home/git/gitlab" APP_USER="git" DAEMON_OPTS="-C $APP_ROOT/config/puma.rb" PID_PATH="$APP_ROOT/tmp/pids" +SOCKET_PATH="$APP_ROOT/tmp/sockets" WEB_SERVER_PID="$PID_PATH/puma.pid" SIDEKIQ_PID="$PID_PATH/sidekiq.pid" STOP_SIDEKIQ="RAILS_ENV=production bundle exec rake sidekiq:stop" @@ -50,6 +51,7 @@ start() { exit 1 else if [ `whoami` = root ]; then + execute "rm $SOCKET_PATH/gitlab.socket" execute "RAILS_ENV=production bundle exec puma $DAEMON_OPTS" execute "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &" echo "$DESC started" diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake index 5e4a74b6260ad9f9a1fa68e89269c9581fd25014..4c3a607a7131dd9d4b322f34688cdf803c7db557 100644 --- a/lib/tasks/gitlab/check.rake +++ b/lib/tasks/gitlab/check.rake @@ -144,7 +144,7 @@ namespace :gitlab do return end - recipe_content = `curl https://raw.github.com/gitlabhq/gitlab-recipes/master/init.d/gitlab 2>/dev/null` + recipe_content = `curl https://raw.github.com/gitlabhq/gitlabhq/5-2-stable/lib/support/init.d/gitlab 2>/dev/null` script_content = File.read(script_path) if recipe_content == script_content @@ -588,7 +588,7 @@ namespace :gitlab do def check_sidekiq_running print "Running? ... " - if run_and_match("ps aux | grep -i sidekiq", /sidekiq \d\.\d\.\d.+$/) + if run_and_match("ps aux | grep -i sidekiq", /sidekiq \d+\.\d+\.\d+.+$/) puts "yes".green else puts "no".red