Sviluppo locale (macOS / Docker)
Scopo
Avviare Ez FactoryOS in development con Docker Compose e Makefile, senza installare Bench sull’host.
Prerequisiti
- Docker Desktop (o engine equivalente)
- Git, Make
- Porte libere tipiche:
8001(HTTP),9001(SocketIO),3307(MariaDB),6380(Redis)
Procedura
bash
cp .env.example .env
# Impostare ADMIN_PASSWORD, DB_* (non committare .env)
make setup
make upStack: deploy/compose/development.yml — servizi mariadb, redis, frappe monolitico (bench start). App montata da apps/ez_factoryos.
Accesso
| Voce | Valore |
|---|---|
| URL | http://localhost:8001 |
| Site | factory.local |
| User | Administrator |
| Password | ADMIN_PASSWORD in .env |
Aggiungere factory.local in /etc/hosts se necessario (127.0.0.1 factory.local).
Comandi Makefile
| Comando | Descrizione |
|---|---|
make setup | Crea .env e verifica Docker |
make up / make down | Avvia / ferma stack |
make logs | Log Frappe |
make shell | Shell nel container |
make test | Lint + bench run-tests |
make migrate | bench migrate |
make backup / make restore | Backup/restore locali |
make reset | Solo con CONFIRM_RESET=yes EZ_ENV=development |
make compose-validate | Validazione compose |
Bench nel container
bash
./scripts/bench-exec.sh bench --site factory.local console
./scripts/bench-exec.sh bench --site factory.local run-tests --app ez_factoryosNode-RED locale (opzionale)
Vedi deploy/node-red/README.md. Impostare NODE_RED_BASE_URL e token in .env.
Verifica
bash
curl -fsS http://localhost:8001/api/method/ping
# atteso: {"message":"pong"}
make testLogin Desk /desk e app Ez FactoryOS.
Rollback / Troubleshooting
| Problema | Azione |
|---|---|
| Site does not exist | Hosts factory.local; make down && make up |
| Porta occupata | Cambiare HTTP_PUBLISH_PORT / DB_PUBLISH_PORT in .env |
| Reset completo | CONFIRM_RESET=yes EZ_ENV=development make reset (distrugge volumi locali) |
| Migrazioni | make migrate dopo pull DocType |
Alias setup breve: setup/local-development.
