services:pouet.chapril.org
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédente | |||
| services:pouet.chapril.org [2026/04/11 17:40] – supprimée - modification externe (Date inconnue) 127.0.0.1 | services:pouet.chapril.org [2026/04/11 17:40] (Version actuelle) – ↷ Page déplacée de admin:services:pouet.chapril.org à services:pouet.chapril.org pitchum | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | ====== Service pouet.chapril.org ====== | ||
| + | Service de // | ||
| + | |||
| + | ====== Maintenance ====== | ||
| + | |||
| + | ===== Mise à jour ===== | ||
| + | |||
| + | Nous mettons à jour en suivant les grandes lignes indiquées dans la [[https:// | ||
| + | |||
| + | En gros, ça donne ceci : | ||
| + | <code bash> | ||
| + | sudo -iu mastodon | ||
| + | cd live/ | ||
| + | RELEASE=4.1.6 && git fetch --all && git checkout v${RELEASE? | ||
| + | bundle install | ||
| + | exit | ||
| + | systemctl restart mastodon-streaming | ||
| + | systemctl reload mastodon-web | ||
| + | </ | ||
| + | |||
| + | Puis redémarrer éventuellement le ou les autres services '' | ||
| + | |||
| + | ====== Installation ====== | ||
| + | |||
| + | ===== Installation du système de la VM ===== | ||
| + | |||
| + | La machine a été installée en repectant les [[: | ||
| + | |||
| + | ===== Installation des services ===== | ||
| + | |||
| + | L’installation est inspirée de [[https:// | ||
| + | |||
| + | Configuration APT dans ''/ | ||
| + | < | ||
| + | deb https:// | ||
| + | deb-src https:// | ||
| + | </ | ||
| + | |||
| + | Installation des dépendances : | ||
| + | <code bash> | ||
| + | apt update | ||
| + | apt install imagemagick ffmpeg libpq-dev libxml2-dev libxslt1-dev file git curl | ||
| + | #laisser les configurations par défaut dans les boites de dialogue | ||
| + | apt install nodejs | ||
| + | |||
| + | npm install -g yarn | ||
| + | apt install redis-server redis-tools | ||
| + | apt-get install postgresql postgresql-contrib | ||
| + | </ | ||
| + | |||
| + | Création de la base PostgreSQL : | ||
| + | <code bash> | ||
| + | su - postgres | ||
| + | psql | ||
| + | </ | ||
| + | <code sql> | ||
| + | CREATE USER mastodon CREATEDB; | ||
| + | \q | ||
| + | exit | ||
| + | </ | ||
| + | |||
| + | Installation des dépendances Ruby : | ||
| + | <code bash> | ||
| + | apt install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev rbenv bundler | ||
| + | </ | ||
| + | |||
| + | Configuration de l' | ||
| + | <code bash> | ||
| + | su - mastodon | ||
| + | echo ' | ||
| + | echo 'eval " | ||
| + | exit | ||
| + | </ | ||
| + | |||
| + | On a besoin de Ruby 2.4.1 (au moins). | ||
| + | D' | ||
| + | Installation manuelle : | ||
| + | <code bash> | ||
| + | su - mastodon | ||
| + | git clone https:// | ||
| + | rbenv install 2.4.1 | ||
| + | </ | ||
| + | |||
| + | Clonage de Mastodon : | ||
| + | <code bash> | ||
| + | cd ~/ | ||
| + | git clone https:// | ||
| + | cd live/ | ||
| + | # | ||
| + | git checkout v1.4.1 | ||
| + | git checkout -b stable | ||
| + | bundle install --deployment --without development test | ||
| + | yarn install | ||
| + | </ | ||
| + | |||
| + | Configuration de Mastodon : | ||
| + | <code bash> | ||
| + | cp .env.production.sample .env.production | ||
| + | vim .env.production | ||
| + | </ | ||
| + | < | ||
| + | # modifier ces champs : | ||
| + | REDIS_HOST=127.0.0.1 | ||
| + | REDIS_PORT=6379 | ||
| + | DB_HOST=/ | ||
| + | DB_USER=mastodon | ||
| + | DB_NAME=mastodon-production | ||
| + | DB_PASS= | ||
| + | DB_PORT=5432 | ||
| + | LOCAL_DOMAIN=pouet.chapril.org | ||
| + | LOCAL_HTTPS=true | ||
| + | # générer trois chaines aléatoires pour ces champs avec la commande " | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | DEFAULT_LOCALE=fr | ||
| + | SMTP_SERVER=localhost | ||
| + | SMTP_PORT=25 | ||
| + | SMTP_FROM_ADDRESS=mastodon@chapril.org | ||
| + | SMTP_DELIVERY_METHOD=smtp # delivery method can also be sendmail | ||
| + | SMTP_AUTH_METHOD=none | ||
| + | SMTP_OPENSSL_VERIFY_MODE=none | ||
| + | SMTP_ENABLE_STARTTLS_AUTO=false | ||
| + | </ | ||
| + | |||
| + | La configuration a été déplacée dans ''/ | ||
| + | <code bash> | ||
| + | cp / | ||
| + | ln -sf / | ||
| + | </ | ||
| + | |||
| + | Configuration de la base de donnée PostgreSQL : | ||
| + | <code bash> | ||
| + | RAILS_ENV=production bundle exec rails db:setup | ||
| + | </ | ||
| + | |||
| + | Préparation des fichiers JavaScript et CSS : | ||
| + | <code bash> | ||
| + | RAILS_ENV=production bundle exec rails assets: | ||
| + | </ | ||
| + | |||
| + | Configuration des services Systemd : | ||
| + | * // | ||
| + | <code ini> | ||
| + | [Unit] | ||
| + | | ||
| + | | ||
| + | |||
| + | [Service] | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | |||
| + | [Install] | ||
| + | | ||
| + | </ | ||
| + | * //Backend// via ''/ | ||
| + | <code ini> | ||
| + | [Unit] | ||
| + | | ||
| + | | ||
| + | |||
| + | [Service] | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | |||
| + | [Install] | ||
| + | | ||
| + | </ | ||
| + | * API via ''/ | ||
| + | <code ini> | ||
| + | [Unit] | ||
| + | | ||
| + | | ||
| + | |||
| + | [Service] | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | |||
| + | [Install] | ||
| + | | ||
| + | </ | ||
| + | |||
| + | Activation des services : | ||
| + | <code bash> | ||
| + | systemctl enable / | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Configuration HTTP pour dossier public ===== | ||
| + | |||
| + | Les démons de Mastodon ne servent pas les éléments statiques (avatar, JavaScript, CSS, PNG etc.). | ||
| + | Il faut les servir avec un démon HTTP. | ||
| + | Nginx a été configuré sur la VM Pouet avec la configuration suivante : | ||
| + | <code nginx> | ||
| + | server { | ||
| + | listen 80 default_server; | ||
| + | listen [::]:80 default_server; | ||
| + | |||
| + | root / | ||
| + | |||
| + | server_name pouet.chapril.org _; | ||
| + | |||
| + | location / { | ||
| + | try_files $uri $uri/; | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Configuration proxy HTTP sur Bastion ===== | ||
| + | |||
| + | La VM Bastion redirige le trafic vers la VM Pouet sur les ports '' | ||
| + | La configuration Nginx dans Bastion est la suivante : | ||
| + | <code nginx> | ||
| + | map $http_upgrade $connection_upgrade { | ||
| + | default upgrade; | ||
| + | '' | ||
| + | } | ||
| + | |||
| + | server { | ||
| + | listen 80; | ||
| + | |||
| + | server_name pouet.chapril.org; | ||
| + | # On redirige tout en HTTPS | ||
| + | return 301 https:// | ||
| + | |||
| + | access_log / | ||
| + | error_log / | ||
| + | } | ||
| + | |||
| + | server { | ||
| + | listen 443 ssl; | ||
| + | server_name pouet.chapril.org; | ||
| + | |||
| + | access_log / | ||
| + | error_log / | ||
| + | |||
| + | add_header Referrer-Policy " | ||
| + | add_header Content-Security-Policy " | ||
| + | |||
| + | # HTTPS | ||
| + | ssl_certificate | ||
| + | ssl_certificate_key / | ||
| + | ssl_protocols TLSv1.2; | ||
| + | ssl_ecdh_curve prime256v1; | ||
| + | ssl_ciphers EECDH+AESGCM: | ||
| + | ssl_prefer_server_ciphers on; | ||
| + | | ||
| + | location / { | ||
| + | add_header Referrer-Policy " | ||
| + | add_header Content-Security-Policy " | ||
| + | try_files $uri @proxy_static @proxy; | ||
| + | } | ||
| + | |||
| + | location ~ ^/ | ||
| + | add_header Cache-Control " | ||
| + | add_header Referrer-Policy " | ||
| + | add_header Content-Security-Policy " | ||
| + | try_files $uri @proxy_static; | ||
| + | } | ||
| + | |||
| + | location @proxy_static { | ||
| + | add_header Referrer-Policy " | ||
| + | add_header Content-Security-Policy " | ||
| + | proxy_set_header Host $host; | ||
| + | proxy_set_header X-Real-IP $remote_addr; | ||
| + | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
| + | proxy_set_header X-Forwarded-Proto https; | ||
| + | proxy_pass_header Server; | ||
| + | proxy_pass http:// | ||
| + | proxy_buffering off; | ||
| + | proxy_redirect off; | ||
| + | proxy_http_version 1.1; | ||
| + | proxy_set_header Upgrade $http_upgrade; | ||
| + | proxy_set_header Connection $connection_upgrade; | ||
| + | } | ||
| + | |||
| + | location @proxy { | ||
| + | add_header Referrer-Policy " | ||
| + | add_header Content-Security-Policy " | ||
| + | proxy_set_header Host $host; | ||
| + | proxy_set_header X-Real-IP $remote_addr; | ||
| + | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
| + | proxy_set_header X-Forwarded-Proto https; | ||
| + | proxy_pass_header Server; | ||
| + | proxy_pass http:// | ||
| + | proxy_buffering off; | ||
| + | proxy_redirect off; | ||
| + | proxy_http_version 1.1; | ||
| + | proxy_set_header Upgrade $http_upgrade; | ||
| + | proxy_set_header Connection $connection_upgrade; | ||
| + | } | ||
| + | |||
| + | location / | ||
| + | proxy_set_header Host $host; | ||
| + | proxy_set_header X-Real-IP $remote_addr; | ||
| + | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
| + | proxy_set_header X-Forwarded-Proto https; | ||
| + | proxy_pass http:// | ||
| + | proxy_buffering off; | ||
| + | proxy_redirect off; | ||
| + | proxy_http_version 1.1; | ||
| + | proxy_set_header Upgrade $http_upgrade; | ||
| + | proxy_set_header Connection $connection_upgrade; | ||
| + | } | ||
| + | error_page 500 501 502 503 504 /500.html; | ||
| + | } | ||
| + | </ | ||
