Mise-à-jour d’une instance Mastodon vers la version stable v1.2

Mise-à-jour d’une instance Mastodon vers la version stable v1.2

Sommaire

1/ Connexion au serveur.
2/ Arrêt des services Mastodon.
3/ Connexion à l’utilisateur mastodon.
4/ Sauvegarde de rbenv.
5/ Mise-à-jour de Ruby en 2.4.1
6/ Exportation de la base de donnée.
7/ Sauvegarde du répertoire live/, création de l’archive.
8/ Téléchargement de toute les modifications.
9/ Checkout de la branche stable v1.2.
10/ Vérification.
11/ Installation de rails.
12/ Mise-à-jour de Yarn.
13/ Mise-à-jour des assets et de la base de données.
14/ Démarrage des services.
15/ Liens.

Procédure

1/ Connexion au serveur.

[~] ➔ ssh admin@185.26.125.41
admin@185.26.125.41's password:
...
admin@server01mas:~$

2/ Arrêt des services Mastodon.

admin@server01mas:~$ su
Password:
root@server01mas:/home/admin#
root@server01mas:/home/admin# systemctl stop mastodon-web.service mastodon-sidekiq.service mastodon-streaming.service
root@server01mas:/home/admin# exit
exit
admin@server01mas:~$

3/ Connexion à l’utilisateur mastodon.

admin@server01mas:~$ su mastodon
Password:
mastodon@server01mas:/home/admin$ cd
mastodon@server01mas:~$

4/ Sauvegarde de rbenv.

mastodon@server01mas:~$ tar cvfz rbenv.tar.gz .rbenv

5/ Mise-à-jour de Ruby en 2.4.1

mastodon@server01mas:~$ rm .rbenv/ -rf
mastodon@server01mas:~$
mastodon@server01mas:~$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv
mastodon@server01mas:~$
mastodon@server01mas:~$ type rbenv
rbenv is a function
rbenv ()
{
    local command;
    command="$1";
    if [ "$#" -gt 0 ]; then
        shift;
    fi;
    case "$command" in
        rehash | shell)
            eval "$(rbenv "sh-$command" "$@")"
        ;;
        *)
            command rbenv "$command" "$@"
        ;;
    esac
}
mastodon@server01mas:~$
mastodon@server01mas:~$ git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
Cloning into '/home/mastodon/.rbenv/plugins/ruby-build'...
remote: Counting objects: 7484, done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 7484 (delta 5), reused 0 (delta 0), pack-reused 7467
Receiving objects: 100% (7484/7484), 1.51 MiB | 0 bytes/s, done.
Resolving deltas: 100% (4528/4528), done.
Checking connectivity... done.
mastodon@server01mas:~$
mastodon@server01mas:~$ rbenv install 2.4.1
Downloading ruby-2.4.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.1.tar.bz2
Installing ruby-2.4.1...
Installed ruby-2.4.1 to /home/mastodon/.rbenv/versions/2.4.1
mastodon@server01mas:~$
mastodon@server01mas:~$ rbenv global 2.4.1
mastodon@server01mas:~$
mastodon@server01mas:~$ ruby -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
mastodon@server01mas:~$

6/ Exportation de la base de donnée.

mastodon@server01mas:~$ pg_dump postgres > postgres.pgsql
mastodon@server01mas:~$
mastodon@server01mas:~$ ls -lh postgres.pgsql
-rw-r--r-- 1 mastodon mastodon 902 Apr 17 10:08 postgres.pgsql
mastodon@server01mas:~$

7/ Sauvegarde du répertoire live/, création de l’archive.

mastodon@server01mas:~$ tar cvfz live.tar.gz live
mastodon@server01mas:~$
mastodon@server01mas:~$ ls -lh live.tar.gz
-rw-r--r-- 1 mastodon mastodon 575M Apr 17 10:19 live.tar.gz
mastodon@server01mas:~$

8/ Téléchargement de toute les modifications.

mastodon@server01mas:~$ cd live
mastodon@server01mas:~/live$ git fetch --all
Fetching origin
remote: Counting objects: 4715, done.
remote: Total 4715 (delta 1801), reused 1801 (delta 1801), pack-reused 2913
Receiving objects: 100% (4715/4715), 1.60 MiB | 0 bytes/s, done.
Resolving deltas: 100% (3338/3338), completed with 411 local objects.
From https://github.com/Gargron/mastodon
   5f54981..64e1d51  master     -> origin/master
 * [new branch]      blackle-master -> origin/blackle-master
 * [new branch]      fix-admin-reset-password -> origin/fix-admin-reset-password
 * [new branch]      fix-recovery-codes-design -> origin/fix-recovery-codes-design
 * [new branch]      skylight   -> origin/skylight
 * [new branch]      yiskah-patch-1 -> origin/yiskah-patch-1
 * [new tag]         v1.1       -> v1.1
 * [new tag]         v1.1.1     -> v1.1.1
 * [new tag]         v1.1.2     -> v1.1.2
 * [new tag]         v1.2       -> v1.2
mastodon@server01mas:~/live$

9/ Checkout de la branche stable v1.2.

mastodon@server01mas:~/live$ git checkout tags/v1.2 -b v1.2
Switched to a new branch 'v1.2'
...
mastodon@server01mas:~/live$

10/ Vérification.

mastodon@server01mas:~/live$ git status
On branch v1.2
Untracked files:
  (use "git add ..." to include in what will be committed)
	npm-debug.log
	vendor/bundle/
nothing added to commit but untracked files present (use "git add" to track)
mastodon@server01mas:~/live$

11/ Installation de rails.

mastodon@server01mas:~/live$ gem install rails
Fetching: i18n-0.8.1.gem (100%)
Successfully installed i18n-0.8.1
...
Fetching: rails-5.0.2.gem (100%)
Successfully installed rails-5.0.2
36 gems installed
mastodon@server01mas:~/live$
mastodon@server01mas:~/live$ bundle install
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Installing rake 12.0.0
Installing concurrent-ruby 1.0.5
...
Installing devise-two-factor 3.0.0
Bundle complete! 80 Gemfile dependencies, 135 gems now installed.
Gems in the groups development and test were not installed.
Bundled gems are installed into ./vendor/bundle.
...
mastodon@server01mas:~/live$

12/ Mise-à-jour de Yarn.

mastodon@server01mas:~/live$ npm upgrade yarn
mastodon@server01mas:~/live
mastodon@server01mas:~/live$ yarn install
yarn install v0.21.3
[1/4] Resolving packages...
...
info To upgrade, run the following command:
$ npm upgrade --global yarn
Done in 38.32s.
mastodon@server01mas:~/live$

13/ Mise-à-jour des assets et de la base de données.

mastodon@server01mas:~/live$ RAILS_ENV=production bundle exec rails assets:clean
mastodon@server01mas:~/live$
mastodon@server01mas:~/live$ RAILS_ENV=production bundle exec rails assets:precompile
I, [2017-04-17T10:56:55.327575 #9089]  INFO -- : Writing /home/mastodon/live/public/assets/application_public-ff92fbfb31a9056b294415acf2190bf7a5ab47eb875ad7863ec82171915654bc.js
...
I, [2017-04-17T10:58:45.301179 #9089]  INFO -- : Writing /home/mastodon/live/public/assets/pghero/application-9bc22f0902dcd973784cb5dd4a5fd5f7437691f893fe23bef94cfb6ae256059b.css.gz
mastodon@server01mas:~/live$
mastodon@server01mas:~/live$ RAILS_ENV=production bundle exec rails db:migrate
Migrating to AddIndexOnMentionsStatusId (20170405112956)
== 20170405112956 AddIndexOnMentionsStatusId: migrating =======================
-- add_index(:mentions, :status_id)
   -> 0.6750s
...
-- add_column(:statuses, :language, :string, {:null=>false, :default=>"en"})
   -> 0.4539s
== 20170414132105 AddLanguageToStatuses: migrated (0.4541s) ===================
mastodon@server01mas:~/live$
mastodon@server01mas:~/live$ exit
exit
admin@server01mas:~$

14/ Démarrage des services.

admin@server01mas:~$ su
Password:
root@server01mas:/home/admin#
root@server01mas:/home/admin# systemctl start mastodon-web.service mastodon-sidekiq.service mastodon-streaming.service
root@server01mas:/home/admin#
root@server01mas:/home/admin# exit
exit
admin@server01mas:~$

15/ Liens.

https://angristan.fr/installer-instance-mastodon-debian-8/
https://jesuisadmin.fr/migration-dune-instance-mastodon/
https://www.citizenz.info/

One Response

  1. Mise-à-jour Mastodon v1.4.1 – Rock Star Ninja

    […] Suivre le didacticiel : Mise-à-jour d’une instance Mastodon vers la version stable v1.2 […]

Comments are closed, but trackbacks and pingbacks are open.