2022.07
Check
Le script check_2022.07.php est à disposition pour vérifier une 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.3
- PHP 8.1
- Apache 2.4
- BDD PostgreSQL 13 principale
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
HTTPS & HTTP/2
- Chaque vhost doit être accessible via HTTPS par le protocole HTTP/2.
- Le chiffrement TLS est requis.
- Le protocole HTTP non sécurisé doit être désactivé.
- Le traffic HTTP doit être redirigé en amont (par le reverse proxy) vers du HTTPS.
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.
La timezone de la base de données doit être identique à celle de PHP.