Riscrivi backend per hosting Node/MariaDB/PM2 (no Cloudflare)
L'utente ha un hosting Virtualmin esistente (musictools.djluza.com)
con Apache + Node 20 + MariaDB + PM2. Tutta l'infrastruttura
Cloudflare (Workers/D1/R2/Pages) e' rimpiazzata con un backend
Express che gira sul server gia' presente, a costo zero.
Cambia:
- server/src/*.ts (Workers) -> server/src/*.js (Node ESM puro)
- D1 (sqlite) -> MariaDB 10.11 via mysql2/promise
- R2 (storage) -> filesystem locale ~/builds/ + signed URL HMAC
- wrangler.toml -> ecosystem.config.cjs (PM2)
- Aggiunto src/migrate.js: runner SQL idempotente
Endpoints invariati - l'app desktop non vede differenze:
- POST /api/license/{activate,validate,deactivate}
- GET /api/latest, /api/download
- POST /api/webhook/lemonsqueezy
- GET /api/health
README riscritto con istruzioni complete: creazione DB,
deploy via rsync/git, config Apache reverse proxy via
Virtualmin, gestione PM2, backup, workflow release.
Email rimane su Resend (deliverability) - free tier sufficiente.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
1 parent
339dd4f3cc
commit
2d8290579b
22 files changed
+892
-790
No files matched your search
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* PM2 ecosystem per il backend MusicTools.
|
||||
*
|
||||
* Avvio: pm2 start ecosystem.config.cjs --env production
|
||||
* Reload: pm2 reload musictools-api
|
||||
* Logs: pm2 logs musictools-api
|
||||
* Save: pm2 save && pm2 startup (al primo deploy, una sola volta)
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
apps: [
|
||||
{
|
||||
name: "musictools-api",
|
||||
script: "src/server.js",
|
||||
cwd: __dirname,
|
||||
exec_mode: "fork", // 1 processo, basta per i nostri volumi
|
||||
instances: 1,
|
||||
autorestart: true,
|
||||
max_restarts: 10,
|
||||
max_memory_restart: "256M",
|
||||
env: {
|
||||
NODE_ENV: "production",
|
||||
},
|
||||
// Le env sensibili stanno in .env: dotenv le carica al boot
|
||||
out_file: "logs/out.log",
|
||||
error_file: "logs/err.log",
|
||||
merge_logs: true,
|
||||
time: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
Reference in new issue
Block a user