procédure générique pour upgrade

This commit is contained in:
Benoît S. 2016-12-09 14:55:05 +01:00
parent 3a01a46f7a
commit 7e5f7a228a

View file

@ -413,7 +413,9 @@ Attention, le fichier `secrets.yml` contient les clés de chiffrements pour les
Le principe des mises à jour est basé sur un `git pull` et un `git checkout`. Le principe des mises à jour est basé sur un `git pull` et un `git checkout`.
## Mise à jour mineure 8.14.0 vers 8.14.1 ## Mise à jour mineure 8.14.x vers 8.14.y
Procédure générique. Il est possible de « sauter » plusieurs versions. Par exemple, de 8.14.0 à 8.14.3.
### Sauvegarde ### Sauvegarde
@ -425,81 +427,32 @@ $ bundle exec rake gitlab:backup:create RAILS_ENV=production
### Mise à jour de GitLab ### Mise à jour de GitLab
~~~
# sudo -iu foo
$ cd gitlab
$ git fetch --all
$ git checkout -- Gemfile.lock db/schema.rb
$ git checkout v8.14.1 -b v8.14.1
$ sed -i -e s'/app_user="git"/app_user="foo"/' \
-e 's/# Provides: .*gitlab$/# Provides: gitlab-foo/' \
lib/support/init.d/gitlab
$ sed -i 's#script_path = "/etc/init.d/gitlab"#script_path = "/etc/init.d/gitlab-foo"#g' lib/tasks/gitlab/check.rake
$ git commit -a -m 'change default user'
~~~
### Mise à jour base de données, Gems et assets
~~~
$ cd ~/gitlab
$ bundle install --without development test mysql aws kerberos --deployment
$ bundle clean
$ bundle exec rake assets:clean assets:precompile cache:clear RAILS_ENV=production
$ git commit -a -m 'upgraded to 8.14.1'
~~~
### Redémarrer GitLab
~~~
# /etc/init.d/gitlab-foo restart
~~~
### Vérifier le statut
~~~
# sudo -iu foo
$ cd gitlab
$ bundle exec rake gitlab:env:info RAILS_ENV=production
$ bundle exec rake gitlab:check RAILS_ENV=production
~~~
Si tout est au vert, la migration s'est bien passée !
## Mise à jour mineure 8.14.1 vers 8.14.2
### Sauvegarde
~~~
# sudo -iu foo
$ cd gitlab
$ bundle exec rake gitlab:backup:create RAILS_ENV=production
~~~
Cela va créer une archive TAR dans `~/gitlab/tmp/backups/`.
### Mise à jour de GitLab
~~~ ~~~
# sudo -iu foo # sudo -iu foo
$ umask 002 $ umask 002
$ cd gitlab $ cd gitlab
$ git fetch --all $ git fetch --all
$ git checkout -- Gemfile.lock db/schema.rb $ git checkout -- Gemfile.lock db/schema.rb
$ git checkout v8.14.2 -b v8.14.2 $ git checkout v8.14.y -b v8.14.y
$ sed -i -e s'/app_user="git"/app_user="foo"/' \ $ sed -i -e s'/app_user="git"/app_user="foo"/' \
-e 's/# Provides: .*gitlab$/# Provides: gitlab-foo/' \ -e 's/# Provides: .*gitlab$/# Provides: gitlab-foo/' \
lib/support/init.d/gitlab lib/support/init.d/gitlab
$ sed -i 's@script_path = "/etc/init.d/gitlab"@script_path = "/etc/init.d/foo"@g' lib/tasks/gitlab/check.rake $ sed -i 's#script_path = "/etc/init.d/gitlab"#script_path = "/etc/init.d/gitlab-foo"#g' lib/tasks/gitlab/check.rake
$ git commit -a -m 'change default user' $ git commit -a -m 'change default user'
~~~ ~~~
### Mise à jour de gitlab-shell
~~~
$ cd ~/gitlab-shell
$ git fetch
$ git checkout v$(cat ~/gitlab/GITLAB_SHELL_VERSION) -b v$(cat ~/gitlab/GITLAB_SHELL_VERSION)
~~~
### Mise à jour de gitlab-workhorse ### Mise à jour de gitlab-workhorse
~~~ ~~~
$ cd ~/gitlab-workhorse $ bundle exec rake "gitlab:workhorse:install[/home/foo/gitlab-workhorse]" RAILS_ENV=production
$ git fetch
$ git checkout v$(cat ~/gitlab/GITLAB_WORKHORSE_VERSION) -b v$(cat ~/gitlab/GITLAB_WORKHORSE_VERSION)
$ make
~~~ ~~~
### Mise à jour base de données, Gems et assets ### Mise à jour base de données, Gems et assets
@ -508,28 +461,15 @@ $ make
$ cd ~/gitlab $ cd ~/gitlab
$ bundle install --without development test mysql aws kerberos --deployment $ bundle install --without development test mysql aws kerberos --deployment
$ bundle clean $ bundle clean
$ bundle exec rake db:migrate RAILS_ENV=production
$ bundle exec rake assets:clean assets:precompile cache:clear RAILS_ENV=production $ bundle exec rake assets:clean assets:precompile cache:clear RAILS_ENV=production
$ git commit -a -m 'upgraded to 8.14.2' $ git commit -a -m 'upgraded to 8.14.y'
~~~ ~~~
### Redémarrer GitLab ### Redémarrer GitLab
~~~ ~~~
# /etc/init.d/gitlab-foo restart # /etc/init.d/gitlab-foo restart
Shutting down GitLab Unicorn
Shutting down GitLab Sidekiq
Shutting down GitLab Workhorse
.
GitLab is not running.
Starting GitLab Unicorn
Starting GitLab Sidekiq
Starting GitLab Workhorse
The GitLab Unicorn web server with pid 8120 is running.
The GitLab Sidekiq job dispatcher with pid 8221 is running.
The GitLab Workhorse with pid 8202 is running.
GitLab and all its components are up and running.
~~~ ~~~
### Vérifier le statut ### Vérifier le statut