From 12e1efaa3d2eaf492a6dc333d2d8f5e2f8f4073d Mon Sep 17 00:00:00 2001 From: marco370 <48531002-marco370@users.noreply.replit.com> Date: Thu, 16 Oct 2025 15:34:32 +0000 Subject: [PATCH] Update deployment script to use local binaries for build tools Modify deploy.sh to use local npm package binaries for Vite and Drizzle Kit, and update ecosystem.config.js to use ES Module export syntax. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 42d8028a-fa71-4ec2-938c-e43eedf7df01 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/6d543d2c-20b9-4ea6-93fe-70fe9b1d9f80/42d8028a-fa71-4ec2-938c-e43eedf7df01/AwjfjCW --- ...-ultime-mo-1760628818231_1760628818231.txt | 102 ++++++++++++++++++ deploy/deploy.sh | 4 +- ecosystem.config.js | 2 +- 3 files changed, 105 insertions(+), 3 deletions(-) create mode 100644 attached_assets/Pasted--bash-deploy-deploy-sh-Deployment-VigilanzaTurni-Thu-Oct-16-11-32-18-EDT-2025-Pull-ultime-mo-1760628818231_1760628818231.txt diff --git a/attached_assets/Pasted--bash-deploy-deploy-sh-Deployment-VigilanzaTurni-Thu-Oct-16-11-32-18-EDT-2025-Pull-ultime-mo-1760628818231_1760628818231.txt b/attached_assets/Pasted--bash-deploy-deploy-sh-Deployment-VigilanzaTurni-Thu-Oct-16-11-32-18-EDT-2025-Pull-ultime-mo-1760628818231_1760628818231.txt new file mode 100644 index 0000000..b8a1b6c --- /dev/null +++ b/attached_assets/Pasted--bash-deploy-deploy-sh-Deployment-VigilanzaTurni-Thu-Oct-16-11-32-18-EDT-2025-Pull-ultime-mo-1760628818231_1760628818231.txt @@ -0,0 +1,102 @@ + bash deploy/deploy.sh +πŸš€ Deployment VigilanzaTurni - Thu Oct 16 11:32:18 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_113218.sql +βœ… Backup compresso: /var/backups/vigilanza-turni/backup_20251016_113218.sql.gz +🧹 Backup vecchi eliminati (retention: 30 giorni) +πŸ“₯ Installazione dipendenze (include devDependencies)... + +added 399 packages, and audited 400 packages in 11s + +57 packages are looking for funding + run `npm fund` for details + +found 0 vulnerabilities +πŸ—οΈ Build frontend Vite... +Need to install the following packages: +vite@7.1.10 +Ok to proceed? (y) + +failed to load config from /var/www/vigilanza-turni/vite.config.ts +error during build: +Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'vite' imported from /var/www/vigilanza-turni/node_modules/.vite-temp/vite.config.ts.timestamp-1760628758637-a87016ca4b44a.mjs + at packageResolve (node:internal/modules/esm/resolve:873:9) + at moduleResolve (node:internal/modules/esm/resolve:946:18) + at defaultResolve (node:internal/modules/esm/resolve:1188:11) + at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:642:12) + at #cachedDefaultResolve (node:internal/modules/esm/loader:591:25) + at ModuleLoader.resolve (node:internal/modules/esm/loader:574:38) + at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:236:38) + at ModuleJob._link (node:internal/modules/esm/module_job:130:49) +πŸ—„οΈ Verifica database schema... +Need to install the following packages: +drizzle-kit@0.31.5 +Ok to proceed? (y) + +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 +No config path provided, using default 'drizzle.config.ts' +Reading config file '/var/www/vigilanza-turni/drizzle.config.ts' +Cannot find module 'drizzle-kit' +Require stack: +- /var/www/vigilanza-turni/drizzle.config.ts +- /root/.npm/_npx/7c7555b0b81cc7e0/node_modules/drizzle-kit/bin.cjs +⚠️ Schema push skipped (database giΓ  aggiornato) +πŸ” Usando PM2: /usr/local/bin/pm2 +πŸ”„ Restart applicazione... +[PM2] Applying action deleteProcessId on app [vigilanza-turni](ids: [ 0 ]) +[PM2] [vigilanza-turni](0) βœ“ +β”Œβ”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” +β”‚ id β”‚ name β”‚ namespace β”‚ version β”‚ mode β”‚ pid β”‚ uptime β”‚ β†Ί β”‚ status β”‚ cpu β”‚ mem β”‚ user β”‚ watching β”‚ +β””β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ +[PM2][ERROR] File ecosystem.config.js malformated +ReferenceError: module is not defined + at file:///var/www/vigilanza-turni/ecosystem.config.js:4:1 + at ModuleJobSync.runSync (node:internal/modules/esm/module_job:387:35) + at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:323:47) + at loadESMFromCJS (node:internal/modules/cjs/loader:1371:24) + at Module._compile (node:internal/modules/cjs/loader:1511:5) + at Module._extensions..js (node:internal/modules/cjs/loader:1572:16) + at Module.load (node:internal/modules/cjs/loader:1275:32) + at Module._load (node:internal/modules/cjs/loader:1096:12) + at Module.require (node:internal/modules/cjs/loader:1298:19) + at require (node:internal/modules/helpers:182:18) +[root@localhost vigilanza-turni]# ls -la +total 620 +drwxr-xr-x 10 root root 4096 Oct 16 11:27 . +drwxr-xr-x. 5 root root 154 Oct 16 09:44 .. +-rw-r--r-- 1 root root 281 Oct 16 10:13 .env +-rw-r--r-- 1 root root 1014 Oct 16 09:44 .env.production.example +drwxr-xr-x 8 root root 4096 Oct 16 11:32 .git +-rw-r--r-- 1 root root 233 Oct 16 09:44 .gitignore +-rw-r--r-- 1 root root 3261 Oct 16 09:44 .gitlab-ci.yml +-rw-r--r-- 1 root root 975 Oct 16 09:44 .replit +-rw-r--r-- 1 root root 9697 Oct 16 09:44 DEPLOYMENT.md +-rw-r--r-- 1 root root 3834 Oct 16 09:44 QUICKSTART-DEPLOYMENT.md +drwxr-xr-x 2 root root 4096 Oct 16 09:44 attached_assets +drwxr-xr-x 3 root root 35 Oct 16 09:44 client +-rw-r--r-- 1 root root 459 Oct 16 09:44 components.json +drwxr-xr-x 2 root root 85 Oct 16 11:26 deploy +-rw-r--r-- 1 root root 5798 Oct 16 09:44 design_guidelines.md +drwxr-xr-x 3 root root 36 Oct 16 10:19 dist +-rw-r--r-- 1 root root 325 Oct 16 09:44 drizzle.config.ts +-rw-r--r-- 1 root root 64545 Oct 16 09:44 dump.sql +-rw-r--r-- 1 root root 16956 Oct 16 09:44 dump.zip +-rw-r--r-- 1 root root 599 Oct 16 11:27 ecosystem.config.js +drwxr-xr-x 293 root root 12288 Oct 16 11:32 node_modules +-rw-r--r-- 1 root root 308774 Oct 16 11:15 package-lock.json +-rw-r--r-- 1 root root 3674 Oct 16 11:14 package.json +-rw-r--r-- 1 root root 80 Oct 16 09:44 postcss.config.js +-rwxr-xr-x 1 root root 1989 Oct 16 09:44 push-to-gitlab.sh +-rw-r--r-- 1 root root 13567 Oct 16 09:44 replit.md +drwxr-xr-x 2 root root 106 Oct 16 09:44 server +drwxr-xr-x 2 root root 23 Oct 16 09:44 shared +-rw-r--r-- 1 root root 44884 Oct 16 09:44 sidebar_collapsed.png +-rw-r--r-- 1 root root 61597 Oct 16 09:44 sidebar_visible.png +-rw-r--r-- 1 root root 4050 Oct 16 09:44 tailwind.config.ts +-rw-r--r-- 1 root root 657 Oct 16 09:44 tsconfig.json +-rw-r--r-- 1 root root 1080 Oct 16 09:44 vite.config.ts \ No newline at end of file diff --git a/deploy/deploy.sh b/deploy/deploy.sh index e22da63..bcb0786 100644 --- a/deploy/deploy.sh +++ b/deploy/deploy.sh @@ -58,11 +58,11 @@ npm ci # Build frontend echo "πŸ—οΈ Build frontend Vite..." export NODE_ENV=production -npx vite build && npx esbuild server/index.ts --platform=node --packages=external --bundle --format=esm --outdir=dist +./node_modules/.bin/vite build && ./node_modules/.bin/esbuild server/index.ts --platform=node --packages=external --bundle --format=esm --outdir=dist # Database migrations (serve Drizzle che Γ¨ devDependency) echo "πŸ—„οΈ Verifica database schema..." -npx drizzle-kit push --force || echo "⚠️ Schema push skipped (database giΓ  aggiornato)" +./node_modules/.bin/drizzle-kit push --force || echo "⚠️ Schema push skipped (database giΓ  aggiornato)" # NOTA: NON facciamo npm prune perchΓ© Vite serve a runtime per il middleware # Il server Express usa Vite per servire il frontend anche in produzione diff --git a/ecosystem.config.js b/ecosystem.config.js index 5b6b8e7..fef95d9 100644 --- a/ecosystem.config.js +++ b/ecosystem.config.js @@ -1,7 +1,7 @@ // PM2 Ecosystem config per VigilanzaTurni // Le variabili .env vengono caricate dallo script deploy.sh e passate tramite 'export' -module.exports = { +export default { apps: [{ name: 'vigilanza-turni', script: 'npm',