prod setup
This commit is contained in:
@@ -1,54 +0,0 @@
|
|||||||
name: Deploy to Plesk (Node.js hosting)
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-and-deploy:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: '22'
|
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Build project
|
|
||||||
run: npm run build
|
|
||||||
|
|
||||||
- name: Check build output
|
|
||||||
run: ls -la ./dist
|
|
||||||
|
|
||||||
- name: Deploy via FTP to Plesk
|
|
||||||
run: |
|
|
||||||
sudo apt-get update && sudo apt-get install -y lftp
|
|
||||||
HOST=${{ secrets.FTP_HOST }}
|
|
||||||
USER=${{ secrets.FTP_USER }}
|
|
||||||
PASSWORD=${{ secrets.FTP_PASSWORD }}
|
|
||||||
TARGET_DIR=${{ secrets.FTP_TARGET_DIR }}
|
|
||||||
lftp -c "
|
|
||||||
open -u $USER,$PASSWORD $HOST
|
|
||||||
set ssl:verify-certificate no
|
|
||||||
mirror -R --delete --verbose \
|
|
||||||
--exclude-glob node_modules/ \
|
|
||||||
--exclude-glob .git/ \
|
|
||||||
--exclude-glob .astro/ \
|
|
||||||
--exclude-glob public/content/ \
|
|
||||||
./dist $TARGET_DIR/dist
|
|
||||||
mirror -R --verbose ./public $TARGET_DIR/public
|
|
||||||
put -O $TARGET_DIR package.json
|
|
||||||
put -O $TARGET_DIR package-lock.json
|
|
||||||
"
|
|
||||||
|
|
||||||
- name: Trigger Plesk restart
|
|
||||||
if: success()
|
|
||||||
run: |
|
|
||||||
echo "::notice::Build uploadé. Redémarre l'application Node.js depuis Plesk pour appliquer."
|
|
||||||
26
README.md
26
README.md
@@ -81,22 +81,24 @@ Login via mot de passe, cookie httpOnly 7 jours.
|
|||||||
|
|
||||||
### Paramètres Plesk Node.js
|
### Paramètres Plesk Node.js
|
||||||
|
|
||||||
- **Node.js version** : 22
|
- **Node.js version** : 22+ (24.x OK)
|
||||||
- **Application root** : racine du repo
|
- **Application root** : `/httpdocs/johanleroy`
|
||||||
|
- **Document root Apache** : `/httpdocs/johanleroy/dist/client` (Apache sert les statiques buildés, le reste passe en proxy vers Node)
|
||||||
- **Application startup file** : `dist/server/entry.mjs`
|
- **Application startup file** : `dist/server/entry.mjs`
|
||||||
- **Application URL** : https://johanleroy.fr
|
- **Application URL** : https://johanleroy.fr (SSL Let's Encrypt obligatoire pour les cookies admin)
|
||||||
|
|
||||||
### CI/CD Gitea (branch `main`)
|
### Déploiement manuel
|
||||||
|
|
||||||
Le workflow `.gitea/workflows/deploy.yml` déclenche un build + upload FTP sur chaque push `main`.
|
1. **Build local** : `npm run build` (vérifier que `dist/server/entry.mjs` est généré)
|
||||||
|
2. **Upload FTP/SFTP** vers le répertoire de l'application Plesk (ex : `/httpdocs/johanleroy/`) :
|
||||||
|
- `dist/` (écrase l'existant)
|
||||||
|
- `public/` (écrase l'existant)
|
||||||
|
- `package.json`
|
||||||
|
- `package-lock.json`
|
||||||
|
3. **Plesk → Node.js → NPM install** (à faire si `package.json` a changé)
|
||||||
|
4. **Plesk → Node.js → Restart App** pour recharger le nouveau bundle
|
||||||
|
|
||||||
**Secrets Gitea à configurer :**
|
**Ne JAMAIS écraser** : `data/`, `.env`, `node_modules/` côté serveur.
|
||||||
- `FTP_HOST`
|
|
||||||
- `FTP_USER`
|
|
||||||
- `FTP_PASSWORD`
|
|
||||||
- `FTP_TARGET_DIR` (ex : `/httpdocs/johanleroy`)
|
|
||||||
|
|
||||||
Après chaque déploiement : redémarrer l'application Node.js depuis Plesk pour prendre en compte les nouveaux fichiers.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user