Commit 3082d2a4be2d70085116b5dc373db40fdee26f10

Authored by Dmitriy Zaporozhets
2 parents 42ef81be 85a4d1ec

Merge branch 'tighten_logrotate' into 'master'

Tighten Logrotate
doc/update/6.6-to-6.7.md 0 → 100644
@@ -0,0 +1,98 @@ @@ -0,0 +1,98 @@
  1 +# From 6.6 to 6.7
  2 +
  3 +### 0. Backup
  4 +
  5 +```bash
  6 +cd /home/git/gitlab
  7 +sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
  8 +```
  9 +
  10 +### 1. Stop server
  11 +
  12 + sudo service gitlab stop
  13 +
  14 +### 2. Get latest code
  15 +
  16 +```bash
  17 +cd /home/git/gitlab
  18 +sudo -u git -H git fetch --all
  19 +```
  20 +
  21 +For Gitlab Community Edition:
  22 +
  23 +```bash
  24 +sudo -u git -H git checkout 6-7-stable
  25 +```
  26 +
  27 +OR
  28 +
  29 +For GitLab Enterprise Edition:
  30 +
  31 +```bash
  32 +sudo -u git -H git checkout 6-7-stable-ee
  33 +```
  34 +
  35 +### 3. Update gitlab-shell (and its config)
  36 +
  37 +```bash
  38 +cd /home/git/gitlab-shell
  39 +sudo -u git -H git fetch
  40 +sudo -u git -H git checkout v1.8.0
  41 +```
  42 +
  43 +### 4. Install libs, migrations, etc.
  44 +
  45 +```bash
  46 +cd /home/git/gitlab
  47 +
  48 +# MySQL installations (note: the line below states '--without ... postgres')
  49 +sudo -u git -H bundle install --without development test postgres --deployment
  50 +
  51 +# PostgreSQL installations (note: the line below states '--without ... mysql')
  52 +sudo -u git -H bundle install --without development test mysql --deployment
  53 +
  54 +
  55 +# Run database migrations
  56 +sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production
  57 +
  58 +# Clean up assets and cache
  59 +sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS_ENV=production
  60 +
  61 +# Update init.d script
  62 +sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
  63 +
  64 +# Update the logrotate configuration (keep logs for 90 days instead of 52 weeks)
  65 +sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
  66 +```
  67 +
  68 +
  69 +### 5. Start application
  70 +
  71 + sudo service gitlab start
  72 + sudo service nginx restart
  73 +
  74 +### 6. Check application status
  75 +
  76 +Check if GitLab and its environment are configured correctly:
  77 +
  78 + sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
  79 +
  80 +To make sure you didn't miss anything run a more thorough check with:
  81 +
  82 + sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
  83 +
  84 +If all items are green, then congratulations upgrade is complete!
  85 +
  86 +## Things went south? Revert to previous version (6.6)
  87 +
  88 +### 1. Revert the code to the previous version
  89 +Follow the [`upgrade guide from 6.5 to 6.6`](6.5-to-6.6.md), except for the database migration
  90 +(The backup is already migrated to the previous version)
  91 +
  92 +### 2. Restore from the backup:
  93 +
  94 +```bash
  95 +cd /home/git/gitlab
  96 +sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production
  97 +```
  98 +If you have more than one backup *.tar file(s) please add `BACKUP=timestamp_of_backup` to the command above.
lib/support/logrotate/gitlab
@@ -2,21 +2,19 @@ @@ -2,21 +2,19 @@
2 # based on: http://stackoverflow.com/a/4883967 2 # based on: http://stackoverflow.com/a/4883967
3 3
4 /home/git/gitlab/log/*.log { 4 /home/git/gitlab/log/*.log {
5 - weekly 5 + daily
6 missingok 6 missingok
7 - rotate 52 7 + rotate 90
8 compress 8 compress
9 - delaycompress  
10 notifempty 9 notifempty
11 copytruncate 10 copytruncate
12 } 11 }
13 12
14 /home/git/gitlab-shell/gitlab-shell.log { 13 /home/git/gitlab-shell/gitlab-shell.log {
15 - weekly 14 + daily
16 missingok 15 missingok
17 - rotate 52 16 + rotate 90
18 compress 17 compress
19 - delaycompress  
20 notifempty 18 notifempty
21 copytruncate 19 copytruncate
22 } 20 }