Document OVH FTP path handling

This commit is contained in:
Clément SAILLANT
2026-03-14 15:51:02 +00:00
parent 3c641ba79a
commit cf6e8601a6
4 changed files with 26 additions and 2 deletions
+2
View File
@@ -1,6 +1,8 @@
FTP_HOST=ftp.cluster129.hosting.ovh.net FTP_HOST=ftp.cluster129.hosting.ovh.net
FTP_USER=ecobsoleiq FTP_USER=ecobsoleiq
FTP_PORT=21 FTP_PORT=21
# OVH FTP is chrooted: use /www here.
# Do not reuse the absolute SFTP path /home/ecobsoleiq/www in FTP mode.
FTP_REMOTE_DIR=/www FTP_REMOTE_DIR=/www
FTP_PASS=your-ftp-password FTP_PASS=your-ftp-password
PUBLIC_SITE_URL_PROD=https://www.lelectronrare.fr/ PUBLIC_SITE_URL_PROD=https://www.lelectronrare.fr/
+5 -2
View File
@@ -74,7 +74,8 @@ Utilisateur: `ecobsoleiq`
2. Préparer les identifiants (hors repo): 2. Préparer les identifiants (hors repo):
- Copier `.env.ftp.example` vers `.env.ftp` - Copier `.env.ftp.example` vers `.env.ftp`
- Remplacer `FTP_PASS=...` par le vrai mot de passe - Remplacer `FTP_PASS=...` par le vrai mot de passe
- Garder `FTP_REMOTE_DIR=/www` (recommandé OVH mutualisé) - Garder `FTP_REMOTE_DIR=/www` en FTP
- Ne pas réutiliser ici le chemin absolu SFTP ` /home/ecobsoleiq/www `
- `source .env.ftp` (ou exporter `FTP_PASS` / `FTP_HOST` en variable d'env) - `source .env.ftp` (ou exporter `FTP_PASS` / `FTP_HOST` en variable d'env)
3. Déploiement via script: 3. Déploiement via script:
- `FTP_PASS='<ton_mot_de_passe>' FTP_REMOTE_DIR='/www' npm run deploy:ftp` - `FTP_PASS='<ton_mot_de_passe>' FTP_REMOTE_DIR='/www' npm run deploy:ftp`
@@ -89,7 +90,9 @@ Utilisateur: `ecobsoleiq`
Notes: Notes:
- Le script utilise `lftp`; installe-le si absent: `brew install lftp` ou `apt-get install lftp`. - Le script utilise `lftp`; installe-le si absent: `brew install lftp` ou `apt-get install lftp`.
- Le script refuse de synchroniser vers `/` par sécurité (utiliser `/www`). - Le script refuse de synchroniser vers `/` par sécurité (utiliser `/www`).
- Si ton host pointe vers un sous-répertoire, ajuste `FTP_REMOTE_DIR` (ex: `/www/`). - Sur cet hébergement OVH, le chroot FTP fait que le docroot public se référence en FTP comme `/www`, alors qu'en SFTP il apparaît comme `/home/ecobsoleiq/www`.
- Mélanger les deux crée un faux arbre du type `/home/ecobsoleiq/home/ecobsoleiq/www/...`, hors docroot web.
- Si ton host pointe vers un sous-répertoire, ajuste `FTP_REMOTE_DIR` à partir de la racine FTP (ex: `/www/preview`).
- Aucune donnée sensible nest hardcodée dans le script (mot de passe via `FTP_PASS` uniquement). - Aucune donnée sensible nest hardcodée dans le script (mot de passe via `FTP_PASS` uniquement).
Exemple 1-liner (via fichier local `.env.ftp`): Exemple 1-liner (via fichier local `.env.ftp`):
@@ -14,6 +14,18 @@ Le runner :
- choisit la cible `preview` ou `production` - choisit la cible `preview` ou `production`
- synchronise `dist/` via `lftp` - synchronise `dist/` via `lftp`
## Point critique OVH
Sur cet hebergement, le chemin valide depend du protocole :
- FTP : `/www`
- SFTP : `/home/ecobsoleiq/www`
Il ne faut pas reutiliser le chemin absolu SFTP dans le flux FTP.
Sinon OVH cree un arbre imbrique du type :
- `/home/ecobsoleiq/home/ecobsoleiq/www/...`
qui n'est pas le docroot public.
## Secrets GitHub requis ## Secrets GitHub requis
- `OVH_FTP_HOST` - `OVH_FTP_HOST`
+7
View File
@@ -49,6 +49,13 @@ if [[ "$FTP_REMOTE_DIR" != /* ]]; then
FTP_REMOTE_DIR="/$FTP_REMOTE_DIR" FTP_REMOTE_DIR="/$FTP_REMOTE_DIR"
fi fi
if [[ "$FTP_REMOTE_DIR" == /home/* ]]; then
echo "Refusing FTP sync to an absolute server filesystem path: '$FTP_REMOTE_DIR'."
echo "On OVH FTP, use the chrooted path instead: '/www' or '/www/<subdir>'."
echo "Example: SFTP uses '/home/ecobsoleiq/www', but FTP must use '/www'."
exit 1
fi
if [[ "$FTP_REMOTE_DIR" == "/" && "${ALLOW_FTP_ROOT_SYNC:-0}" != "1" ]]; then if [[ "$FTP_REMOTE_DIR" == "/" && "${ALLOW_FTP_ROOT_SYNC:-0}" != "1" ]]; then
echo "Refusing FTP sync to '/'." echo "Refusing FTP sync to '/'."
echo "Set FTP_REMOTE_DIR='/www' (recommended for OVH web hosting)." echo "Set FTP_REMOTE_DIR='/www' (recommended for OVH web hosting)."