From cf6e8601a6a59a287251fe93ed354c40f88aad1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20SAILLANT?= <108685187+electron-rare@users.noreply.github.com> Date: Sat, 14 Mar 2026 15:51:02 +0000 Subject: [PATCH] Document OVH FTP path handling --- .env.ftp.example | 2 ++ docs/github-pages-deploy.md | 7 +++++-- docs/ovh-ftp-preview-solution-2026-03-14.md | 12 ++++++++++++ scripts/deploy-ovh-ftp.sh | 7 +++++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.env.ftp.example b/.env.ftp.example index 9ab7658..e26aa99 100644 --- a/.env.ftp.example +++ b/.env.ftp.example @@ -1,6 +1,8 @@ FTP_HOST=ftp.cluster129.hosting.ovh.net FTP_USER=ecobsoleiq 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_PASS=your-ftp-password PUBLIC_SITE_URL_PROD=https://www.lelectronrare.fr/ diff --git a/docs/github-pages-deploy.md b/docs/github-pages-deploy.md index 83c14c0..47c1d69 100644 --- a/docs/github-pages-deploy.md +++ b/docs/github-pages-deploy.md @@ -74,7 +74,8 @@ Utilisateur: `ecobsoleiq` 2. Préparer les identifiants (hors repo): - Copier `.env.ftp.example` vers `.env.ftp` - 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) 3. Déploiement via script: - `FTP_PASS='' FTP_REMOTE_DIR='/www' npm run deploy:ftp` @@ -89,7 +90,9 @@ Utilisateur: `ecobsoleiq` Notes: - 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`). -- 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 n’est hardcodée dans le script (mot de passe via `FTP_PASS` uniquement). Exemple 1-liner (via fichier local `.env.ftp`): diff --git a/docs/ovh-ftp-preview-solution-2026-03-14.md b/docs/ovh-ftp-preview-solution-2026-03-14.md index d25e412..d164ead 100644 --- a/docs/ovh-ftp-preview-solution-2026-03-14.md +++ b/docs/ovh-ftp-preview-solution-2026-03-14.md @@ -14,6 +14,18 @@ Le runner : - choisit la cible `preview` ou `production` - 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 - `OVH_FTP_HOST` diff --git a/scripts/deploy-ovh-ftp.sh b/scripts/deploy-ovh-ftp.sh index 6c58484..517c09d 100755 --- a/scripts/deploy-ovh-ftp.sh +++ b/scripts/deploy-ovh-ftp.sh @@ -49,6 +49,13 @@ if [[ "$FTP_REMOTE_DIR" != /* ]]; then FTP_REMOTE_DIR="/$FTP_REMOTE_DIR" 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/'." + 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 echo "Refusing FTP sync to '/'." echo "Set FTP_REMOTE_DIR='/www' (recommended for OVH web hosting)."