Skip to content

Staging safety ​

Scopo ​

Evitare effetti collaterali di staging su sistemi esterni (email, webhook, Business Cube).

Prerequisiti ​

  • Stack staging up; file env deploy/env/.env.staging (o equivalente Coolify).
  • Compose: COMPOSE_FILE=deploy/compose/staging.yml (default script).

Procedura ​

bash
bash scripts/staging-safety.sh

Lo script esegue sul site staging:

  • mute_emails = 1
  • disable_external_webhooks = 1
  • svuota business_cube_api_url in site config
  • clear-cache

Non modifica NODE_RED_* (il gateway OT di staging resta raggiungibile in rete privata; le scritture PLC restano off via OT_WRITES_ENABLED=0 sul compose Node-RED).

Variabili env ​

In deploy/env/.env.staging.example:

  • MUTE_EMAILS=1
  • DISABLE_EXTERNAL_WEBHOOKS=1

Refresh da produzione ​

bash
PROD_BACKUP_ID=<timestamp> bash scripts/staging-refresh.sh

Restore backup prod su staging + scripts/anonymize-data.py (email utenti/anagrafiche) + safety.

Verifica ​

bash
# Sul backend staging
bench --site <SITE_NAME> get-config mute_emails
# atteso: 1

Invio email di test non deve raggiungere destinatari reali.

Rollback / Troubleshooting ​

  • Safety non applicata post-deploy: rieseguire lo script (non è sempre automatica in Actions).
  • Dati sensibili dopo refresh: rieseguire anonymize-data.py e estendere lo script se servono nuovi DocType.
  • Reset volumi: vietato su staging senza conferma esplicita.

Ez FactoryOS — MES per Ortobellina / OP Raggio di Sole · App Frappe v16 ez_factoryos