cd /var/www/vigilanza-turni
[root@localhost vigilanza-turni]# git pull origin main
From https://git.alfacom.it/marco/VigilanzaTurni
 * branch            main       -> FETCH_HEAD
Already up to date.
[root@localhost vigilanza-turni]# grep "REPLIT_DOMAINS =" server/replitAuth.ts
const REPLIT_DOMAINS = process.env.REPLIT_DOMAINS || process.env.DOMAIN || "vt.alfacom.it";
[root@localhost vigilanza-turni]# bash fix-server.sh
 Fix Deployment Server - vt.alfacom.it
==========================================
 Step 1: Aggiornamento package.json scripts...

 Step 2: Verifica .env...

 Step 3: Verifica deploy.sh...
✅ deploy.sh già configurato correttamente

✅ Fix completato!

 Riepilogo modifiche:
  ✓ package.json scripts aggiornati
  ✓ .env con DOMAIN e ISSUER_URL
  ✓ deploy.sh usa npm ci --include=dev

 Esegui deployment con:
   bash deploy/deploy.sh
[root@localhost vigilanza-turni]# bash deploy/deploy.sh
 Deployment VigilanzaTurni - Thu Oct 16 12:30:49 EDT 2025
 Pull ultime modifiche da GitLab...
From https://git.alfacom.it/marco/VigilanzaTurni
 * branch            main       -> FETCH_HEAD
Already up to date.
 Backup database pre-deployment...
✅ Backup salvato: /var/backups/vigilanza-turni/backup_20251016_123049.sql
✅ Backup compresso: /var/backups/vigilanza-turni/backup_20251016_123049.sql.gz
粒 Backup vecchi eliminati (retention: 30 giorni)
 Installazione dipendenze (include devDependencies)...
npm warn deprecated @esbuild-kit/esm-loader@2.6.5: Merged into tsx: https://tsx.is
npm warn deprecated @esbuild-kit/core-utils@3.3.2: Merged into tsx: https://tsx.is

added 496 packages, and audited 497 packages in 12s

67 packages are looking for funding
  run `npm fund` for details

8 vulnerabilities (3 low, 5 moderate)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
️  Build frontend Vite...

> rest-express@1.0.0 build
> vite build && esbuild server/index.ts --platform=node --packages=external --bundle --format=esm --outdir=dist

vite v5.4.20 building for production...
transforming (3) src/main.tsxBrowserslist: browsers data (caniuse-lite) is 12 months old. Please run:
  npx update-browserslist-db@latest
  Why you should do it regularly: https://github.com/browserslist/update-db#readme
transforming (4) src/App.tsx
A PostCSS plugin did not pass the `from` option to `postcss.parse`. This may cause imported assets to be incorrectly
transformed. If you've recently added a PostCSS plugin that raised this warning, please contact the package author to fix the issue.
✓ 2673 modules transformed.
../dist/public/index.html                   1.49 kB │ gzip:   0.63 kB
../dist/public/assets/index-DdJrKUWT.css   75.43 kB │ gzip:  12.17 kB
../dist/public/assets/index-C9iY8fDP.js   590.69 kB │ gzip: 173.23 kB

(!) Some chunks are larger than 500 kB after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
✓ built in 8.78s

  dist/index.js  56.6kb

⚡ Done in 23ms
️  Verifica database schema...

> rest-express@1.0.0 db:push
> drizzle-kit push --force || drizzle-kit push || echo 'DB schema sync skipped'

No config path provided, using default 'drizzle.config.ts'
Reading config file '/var/www/vigilanza-turni/drizzle.config.ts'
Using 'pg' driver for database querying
[✓] Pulling schema from database...
[i] No changes detected
 Usando PM2: /usr/local/bin/pm2
 Restart applicazione...
[PM2] Applying action deleteProcessId on app [vigilanza-turni](ids: [ 0 ])
[PM2] [vigilanza-turni](0) ✓
┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐
│ id │ name               │ mode     │ ↺    │ status    │ cpu      │ memory   │
└────┴────────────────────┴──────────┴──────┴───────────┴──────────┴──────────┘
[PM2] Starting /usr/bin/npm in fork_mode (1 instance)
[PM2] Done.
┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐
│ id │ name               │ mode     │ ↺    │ status    │ cpu      │ memory   │
├────┼────────────────────┼──────────┼──────┼───────────┼──────────┼──────────┤
│ 0  │ vigilanza-turni    │ fork     │ 0    │ online    │ 0%       │ 5.3mb    │
└────┴────────────────────┴──────────┴──────┴───────────┴──────────┴──────────┘
[PM2] Saving current process list...
[PM2] Successfully saved in /root/.pm2/dump.pm2
 Health check...
✅ Deployment completato con successo!
[TAILING] Tailing last 20 lines for [vigilanza-turni] process (change the value with --lines option)
/root/.pm2/logs/vigilanza-turni-error.log last 20 lines:
0|vigilanz |         ^
0|vigilanz |
0|vigilanz | Error: Environment variable REPLIT_DOMAINS not provided
0|vigilanz |     at file:///var/www/vigilanza-turni/dist/index.js:821:9
0|vigilanz |     at ModuleJob.run (node:internal/modules/esm/module_job:263:25)
0|vigilanz |     at async ModuleLoader.import (node:internal/modules/esm/loader:540:24)
0|vigilanz |     at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5)
0|vigilanz |
0|vigilanz | Node.js v20.19.2
0|vigilanz | file:///var/www/vigilanza-turni/dist/index.js:821
0|vigilanz |   throw new Error("Environment variable REPLIT_DOMAINS not provided");
0|vigilanz |         ^
0|vigilanz |
0|vigilanz | Error: Environment variable REPLIT_DOMAINS not provided
0|vigilanz |     at file:///var/www/vigilanza-turni/dist/index.js:821:9
0|vigilanz |     at ModuleJob.run (node:internal/modules/esm/module_job:263:25)
0|vigilanz |     at async ModuleLoader.import (node:internal/modules/esm/loader:540:24)
0|vigilanz |     at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5)
0|vigilanz |
0|vigilanz | Node.js v20.19.2

/root/.pm2/logs/vigilanza-turni-out.log last 20 lines:
0|vigilanz |
0|vigilanz |
0|vigilanz | > rest-express@1.0.0 start
0|vigilanz | > NODE_ENV=production node dist/index.js
0|vigilanz |
0|vigilanz |
0|vigilanz | > rest-express@1.0.0 start
0|vigilanz | > NODE_ENV=production node dist/index.js
0|vigilanz |
0|vigilanz | 12:26:05 PM [express] serving on port 5000
0|vigilanz |
0|vigilanz | > rest-express@1.0.0 start
0|vigilanz | > NODE_ENV=production node dist/index.js
0|vigilanz |
0|vigilanz | 12:26:08 PM [express] serving on port 5000
0|vigilanz |
0|vigilanz | > rest-express@1.0.0 start
0|vigilanz | > NODE_ENV=production node dist/index.js
0|vigilanz |
0|vigilanz | 12:31:17 PM [express] serving on port 5000


 Status PM2:
┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐
│ id │ name               │ mode     │ ↺    │ status    │ cpu      │ memory   │
├────┼────────────────────┼──────────┼──────┼───────────┼──────────┼──────────┤
│ 0  │ vigilanza-turni    │ fork     │ 0    │ online    │ 0%       │ 65.7mb   │
└────┴────────────────────┴──────────┴──────┴───────────┴──────────┴──────────┘

 Ultimi backup disponibili:
-rw-r--r-- 1 root root 3.4K Oct 16 12:30 /var/backups/vigilanza-turni/backup_20251016_123049.sql.gz
-rw-r--r-- 1 root root 3.4K Oct 16 12:25 /var/backups/vigilanza-turni/backup_20251016_122541.sql.gz
-rw-r--r-- 1 root root 3.4K Oct 16 12:01 /var/backups/vigilanza-turni/backup_20251016_120124.sql.gz
-rw-r--r-- 1 root root 3.4K Oct 16 11:58 /var/backups/vigilanza-turni/backup_20251016_115804.sql.gz
-rw-r--r-- 1 root root 3.4K Oct 16 11:56 /var/backups/vigilanza-turni/backup_20251016_115644.sql.gz

 Applicazione disponibile su: https://vt.alfacom.it