Pour être sûr que la machine est bien configurée –> tout doit être en vert sur le script PHP, toutes les checkbox sur ce document cochées.

2023.04

  1. 2023.04
    1. Check
    2. La stack de base
    3. Dimensionnement machine
    4. Authentification SSH
    5. Binaires
    6. Droits
      1. Logs
    7. Configuration PHP
      1. Extensions
      2. php.ini
    8. Configuration Apache
      1. SSL & HTTP/2
      2. Configuration vhost
      3. Modules
      4. Compression des médias
    9. Configuration PostgreSQL

Check

Le script check_2023.04.php est à disposition pour check une bonne partie des prérequis. Tous les voyants devraient être verts, attention cependant il est possible d’avoir de faux négatifs (par exemple si la mémoire configurée est supérieure à celle requise). Tutoriel pour lancer les tests

La stack de base

  • Debian 11.6
  • PHP 8.2
  • Apache 2.4
  • PostgreSQL 14

Dimensionnement machine

Nous exigeons au minimum :

  • 2 vCPU
  • 4 Go RAM

Authentification SSH

La liste des clés publiques des utilisateurs du Phare est disponible à l’adresse suivante : https://faros.lephare.com/lephare.keys.

curl -sL https://faros.lephare.com/lephare.keys >> ~/.ssh/authorized_keys
chmod 0600 ~/.ssh/authorized_keys

La liste des adresses ips à autoriser :

  • 37.59.114.65
  • 193.39.2.4
  • 80.15.143.1

Binaires

  • curl
  • git
  • git-lfs
  • pg_dump (utilisé par lephare/ansible-deploy)
  • rsync
  • Python 3.5 - 3.11, pré-requis pour managed node Ansible

Droits

Logs

Créer un user séparé qui a uniquement accès en lecture aux fichiers de logs suivants :

  • Apache access.log
  • Apache error.log
  • PHP-FPM log

Configuration PHP

Extensions

Pré-requis pour Symfony 7.x. Ces extensions sont activées par défaut.

  • SimpleXML
  • ctype
  • iconv
  • json
  • pcre
  • session
  • tokenizer

Extensions supplémentaires pour nos applications

  • opcache - not tested by check_script
  • pcntl - not tested by check_script
  • apcu
  • curl
  • exif
  • gd
  • imagick
  • intl
  • mbstring
  • memcached
  • pdo
  • pdo_pgsql
  • pgsql
  • posix
  • soap
  • xml
  • zip

php.ini

display_errors = Off
display_startup_errors = Off
session.auto_start = off
date.timezone = Europe/Paris
upload_max_filesize = 32M
post_max_size = 33M
sys_temp_dir = /var/tmp
upload_tmp_dir = /var/tmp


# Les sessions sont stockées dans memcached -->
session.save_handler = memcached
session.save_path = localhost:11211
memcached.sess_lock_wait_min = 150
memcached.sess_lock_wait_max = 150
memcached.sess_lock_retries = 800


# Optimisation opcache -->
opcache.revalidate_freq = 0
opcache.validate_timestamps = 0
opcache.max_accelerated_files = 20000
opcache.memory_consumption = 256
opcache.interned_strings_buffer = 16
short_open_tag = Off
memory_limit = 128M
opcache.enable = 1


# Realpath cache -->
realpath_cache_size = 4096K
realpath_cache_ttl = 60

Configuration Apache

SSL & HTTP/2

Chaque vhost doit être accessible en HTTPS et HTTP/2.

Configuration vhost

DocumentRoot <deploy_dir>/current/public/
Options FollowSymLinks
Protocols h2 http/1.1

Modules

  • mod_rewrite On
  • mod_headers On
  • mod_expires On
  • mod_brotli On

Compression des médias

<IfModule mod_brotli.c>
    <IfModule mod_filter.c>
        AddOutputFilterByType BROTLI_COMPRESS "application/atom+xml" \
        "application/javascript" \
        "application/json" \
        "application/ld+json" \
        "application/manifest+json" \
        "application/rdf+xml" \
        "application/rss+xml" \
        "application/schema+json" \
        "application/geo+json" \
        "application/vnd.ms-fontobject" \
        "application/wasm" \
        "application/x-font-ttf" \
        "application/x-javascript" \
        "application/x-web-app-manifest+json" \
        "application/xhtml+xml" \
        "application/xml" \
        "font/eot" \
        "font/opentype" \
        "font/otf" \
        "font/ttf" \
        "image/bmp" \
        "image/svg+xml" \
        "image/vnd.microsoft.icon" \
        "text/cache-manifest" \
        "text/calendar" \
        "text/css" \
        "text/html" \
        "text/javascript" \
        "text/plain" \
        "text/markdown" \
        "text/vcard" \
        "text/vnd.rim.location.xloc" \
        "text/vtt" \
        "text/x-component" \
        "text/x-cross-domain-policy" \
        "text/xml"
    </IfModule>
</IfModule>

Configuration PostgreSQL

L’utilisateur doit avoir les privilèges “CREATE” sur le schéma public.