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
This commit is contained in:
parent
088ec72ddc
commit
12e1efaa3d
@ -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
|
||||||
@ -58,11 +58,11 @@ npm ci
|
|||||||
# Build frontend
|
# Build frontend
|
||||||
echo "🏗️ Build frontend Vite..."
|
echo "🏗️ Build frontend Vite..."
|
||||||
export NODE_ENV=production
|
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)
|
# Database migrations (serve Drizzle che è devDependency)
|
||||||
echo "🗄️ Verifica database schema..."
|
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
|
# 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
|
# Il server Express usa Vite per servire il frontend anche in produzione
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// PM2 Ecosystem config per VigilanzaTurni
|
// PM2 Ecosystem config per VigilanzaTurni
|
||||||
// Le variabili .env vengono caricate dallo script deploy.sh e passate tramite 'export'
|
// Le variabili .env vengono caricate dallo script deploy.sh e passate tramite 'export'
|
||||||
|
|
||||||
module.exports = {
|
export default {
|
||||||
apps: [{
|
apps: [{
|
||||||
name: 'vigilanza-turni',
|
name: 'vigilanza-turni',
|
||||||
script: 'npm',
|
script: 'npm',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user