22
0
Fork 0

Howto upgradé pour Stretch

This commit is contained in:
Benoît S. 2018-01-10 22:25:07 +01:00
parent ff559ad3db
commit 36de957548
1 changed files with 16 additions and 28 deletions

View File

@ -11,7 +11,7 @@ title: Howto Mastodon
## Installation
Nous installons la version **2.1.3** sous **Debian 8 (Jessie)**.
Nous installons la version **2.1.3** sous **Debian 9 (Stretch)**.
Mastodon s'appuie sur Ruby, [NodeJS](HowtoNodeJS), [Yarn](HowtoYarn), [Nginx](HowtoNginx), [Redis](HowtoRedis) et [PostgreSQL](HowtoPostgreSQL).
@ -19,11 +19,10 @@ On peut installer les dépendances pour Mastodon :
~~~
# apt install nodejs yarn imagemagick ffmpeg libpq-dev libxml2-dev libxslt1-dev file git curl \
g++ libprotobuf-dev protobuf-compiler pkg-config build-essential libreadline-dev libicu-dev libidn11-dev
g++ libprotobuf-dev protobuf-compiler pkg-config build-essential libreadline-dev libicu-dev \
libidn11-dev libssl-dev
~~~
> **Note** : Vous devez avoir les backports `jessie-backports` pour installer _ffmpeg_.
### Compte UNIX
Créer un compte UNIX *mastodon* :
@ -53,24 +52,9 @@ $ TMPDIR=~/tmp MAKE_OPTS=-j$(nproc) rbenv install 2.4.2
> **Note** : On met la variable d'environnement `RAILS_ENV` dans notre profile bash pour éviter de l'indiquer à chaque commande Ruby/Rails.
### NodeJS et Yarn
Mastodon nécessite une version très récentes de [NodeJS](HowtoNodeJS) et [Yarn](HowtoYarn) :
~~~
# echo "deb http://deb.nodesource.com/node_6.x jessie main" > /etc/apt/sources.list.d/nodesource.list
# wget https://deb.nodesource.com/gpgkey/nodesource.gpg.key -O -|apt-key add -
# echo "deb http://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list
# wget https://dl.yarnpkg.com/debian/pubkey.gpg -O - | apt-key add -
# apt update
# apt install nodejs yarn
~~~
### PostgreSQL
Mastodon utilise [PostgreSQL](HowtoPostgreSQL). On utilise donc la version 9.4 de Debian Jessie :
Mastodon utilise [PostgreSQL](HowtoPostgreSQL). On utilise donc la version 9.6 de Debian Stretch :
~~~
# apt install postgresql postgresql-client libpq-dev postgresql-contrib
@ -108,8 +92,6 @@ $ gem install bundler
$ bundle install --deployment --without development test
$ yarn install --pure-lockfile
$ cp .env.production.sample .env.production
$ bundle exec rake secret
$ bundle exec rake mastodon:webpush:generate_vapid_key >> .env.production
~~~
> Attention, si vous avez un `/home` en `noexec`, il faudra le passer en `exec` pour les processus Ruby et NPM. Au risque d'obtenir ce genre d'erreurs :
@ -133,10 +115,6 @@ DB_PORT=5432
LOCAL_DOMAIN=mastodon.example.com
LOCAL_HTTPS=true
PAPERCLIP_SECRET=PASSWORD
SECRET_KEY_BASE=PASSWORD
OTP_SECRET=PASSWORD
EMAIL_DOMAIN_WHITELIST=example.com
DEFAULT_LOCALE=fr
@ -152,10 +130,19 @@ SMTP_AUTH_METHOD=none
SMTP_OPENSSL_VERIFY_MODE=none
~~~
Génération des clés d'applications et webpush :
~~~
$ echo PAPERCLIP_SECRET=$(bundle exec rake secret) >> .env.production
$ echo SECRET_KEY_BASE=$(bundle exec rake secret) >> .env.production
$ echo OTP_SECRET=$(bundle exec rake secret) >> .env.production
$ bundle exec rake mastodon:webpush:generate_vapid_key >> .env.production
~~~
Initialisation de la base de données :
~~~
$ bundle exec rails db:setup
$ SAFETY_ASSURED=1 bundle exec rails db:setup
~~~
Compilation des assets :
@ -183,6 +170,7 @@ WorkingDirectory=/home/mastodon/mastodon
Environment="RAILS_ENV=production"
Environment="PORT=3000"
ExecStart=/home/mastodon/.rbenv/shims/bundle exec puma -C config/puma.rb
ExecReload=/bin/kill -SIGUSR1 $MAINPID
TimeoutSec=15
Restart=always
@ -243,7 +231,7 @@ On active et on démarre les unités :
~~~
RAILS_ENV=production
@daily cd /home/mastodon/mastodon && /home/mastodon/.rbenv/shims/bundle exec rake mastodon:daily > /dev/null
@daily cd /home/mastodon/mastodon && /home/mastodon/.rbenv/shims/bundle exec rake mastodon:media:remove_remote
~~~
### Nginx