Semplifica il deploy: un solo docker-compose senza anchor YAML
I due file compose andavano tenuti allineati a mano, e gli anchor (x-app-env, <<:) sono sintassi che va conosciuta per riuscire a leggere il file. Per un deploy che deve restare semplice era complessita' non giustificata. Ora c'e' un solo docker-compose.yml, esplicito, che copre produzione e sviluppo: - ogni servizio dichiara quello che usa, senza merge key - mailpit e' dietro il profilo "dev", quindi non parte mai in produzione - la porta e' legata a 127.0.0.1 per default: in produzione il traffico arriva da Traefik sulla rete interna, in locale basta localhost:8080. Per esporla davvero: APP_PORT=0.0.0.0:8080 - .env diventa l'unica fonte di configurazione, senza valori ridichiarati Compromesso accettato: sparendo i valori fissati nel compose, DB_HOST e REDIS_HOST devono contenere i nomi dei servizi (mariadb, redis) e non un indirizzo. E' segnalato in .env.example, nel README e in HANDOFF.md. Per le modifiche al codice senza ricostruire l'immagine il README documenta un docker-compose.override.yml, che Compose applica da solo ed e' gia' ignorato da git. Verificato: sei servizi healthy, login e pagine a 200, redeploy idempotente, porta esposta solo su localhost, mailpit assente senza il profilo dev. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
75
.env.example
75
.env.example
@@ -1,74 +1,91 @@
|
||||
# =============================================================================
|
||||
# TerManager2 — environment template
|
||||
# TerManager2 — configurazione
|
||||
#
|
||||
# LOCAL DEVELOPMENT: copy to .env and adjust.
|
||||
# cp .env.example .env && docker compose -f docker-compose.dev.yml up -d
|
||||
# Questo file e' l'UNICA fonte di configurazione: docker-compose.yml lo legge
|
||||
# cosi' com'e' e non ridichiara nulla.
|
||||
#
|
||||
# PRODUCTION (Dokploy): do NOT ship a .env file. Set these as environment
|
||||
# variables in the Dokploy UI instead — the container reads them directly.
|
||||
# Variables marked [REQUIRED] have no safe default and the stack will refuse
|
||||
# to start without them.
|
||||
# In locale: cp .env.example .env e modifica quello che serve
|
||||
# Su Dokploy: incolla queste variabili in Environment, il .env lo
|
||||
# genera lui
|
||||
#
|
||||
# Le variabili marcate [OBBLIGATORIA] non hanno default: lo stack si rifiuta
|
||||
# di partire senza.
|
||||
# =============================================================================
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Applicazione
|
||||
# -----------------------------------------------------------------------------
|
||||
APP_NAME=TerManager2
|
||||
APP_ENV=production
|
||||
APP_DEBUG=false
|
||||
APP_TIMEZONE=Europe/Rome
|
||||
|
||||
# [REQUIRED] Generate with: php artisan key:generate --show
|
||||
# Proclamatori personal data is encrypted with this key. If it changes or is
|
||||
# lost, that data becomes permanently unreadable. Back it up.
|
||||
APP_KEY=
|
||||
|
||||
# [REQUIRED] Public URL, including scheme. Used for links in PDFs and emails,
|
||||
# and to validate the incoming Host header.
|
||||
# [OBBLIGATORIA] Deve combaciare ESATTAMENTE col dominio servito, schema
|
||||
# incluso. L'app rifiuta richieste con un Host diverso (protezione contro
|
||||
# l'host header injection): un valore sbagliato da' 400 su tutto.
|
||||
# In locale: http://localhost:8080
|
||||
APP_URL=https://territori.example.org
|
||||
|
||||
# [OBBLIGATORIA] Genera con: echo "base64:$(openssl rand -base64 32)"
|
||||
# I dati personali dei proclamatori sono cifrati con questa chiave: se la
|
||||
# perdi non sono piu' leggibili nemmeno avendo il backup del database.
|
||||
# Conservala in un password manager.
|
||||
APP_KEY=
|
||||
|
||||
LOG_CHANNEL=stderr
|
||||
LOG_LEVEL=warning
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# First-run bootstrap
|
||||
# Primo avvio
|
||||
# -----------------------------------------------------------------------------
|
||||
# The admin account created on first deploy. Change the password after login.
|
||||
# L'amministratore creato al primo deploy. Cambia la password dopo il login.
|
||||
INITIAL_ADMIN_NAME=Amministratore
|
||||
INITIAL_ADMIN_EMAIL=
|
||||
INITIAL_ADMIN_PASSWORD=
|
||||
|
||||
# Leave these at their defaults; they exist as escape hatches.
|
||||
# Lasciale cosi': esistono come via di fuga se qualcosa va storto.
|
||||
RUN_MIGRATIONS=true
|
||||
RUN_DB_SEED_ON_FIRST_START=true
|
||||
ENSURE_INITIAL_ADMIN_ON_EMPTY_DB=true
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Database — hostnames are fixed by docker-compose.yml
|
||||
# Database
|
||||
# -----------------------------------------------------------------------------
|
||||
# DB_HOST deve restare "mariadb": e' il nome del servizio in
|
||||
# docker-compose.yml, non un indirizzo di rete.
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=mariadb
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=termanager2
|
||||
DB_USERNAME=termanager2
|
||||
|
||||
# [REQUIRED] No defaults on purpose — generate with: openssl rand -base64 24
|
||||
# [OBBLIGATORIE] Genera con: openssl rand -base64 24
|
||||
DB_PASSWORD=
|
||||
DB_ROOT_PASSWORD=
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Redis (cache, sessions, queue)
|
||||
# Redis — cache, sessioni, code
|
||||
# -----------------------------------------------------------------------------
|
||||
# Come sopra: "redis" e' il nome del servizio, non va cambiato.
|
||||
REDIS_HOST=redis
|
||||
REDIS_PORT=6379
|
||||
# [REQUIRED] openssl rand -base64 24
|
||||
|
||||
# [OBBLIGATORIA] openssl rand -base64 24
|
||||
REDIS_PASSWORD=
|
||||
|
||||
CACHE_STORE=redis
|
||||
SESSION_DRIVER=redis
|
||||
SESSION_SECURE_COOKIE=true
|
||||
QUEUE_CONNECTION=redis
|
||||
|
||||
# true in produzione (HTTPS), false se accedi in HTTP su localhost.
|
||||
SESSION_SECURE_COOKIE=true
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Mail — external SMTP. Use MAIL_MAILER=log to disable delivery entirely.
|
||||
# Posta
|
||||
# -----------------------------------------------------------------------------
|
||||
# In produzione: SMTP esterno.
|
||||
# In locale con --profile dev: MAIL_HOST=mailpit, MAIL_PORT=1025
|
||||
# Per disattivare del tutto l'invio: MAIL_MAILER=log
|
||||
MAIL_MAILER=smtp
|
||||
MAIL_HOST=
|
||||
MAIL_PORT=587
|
||||
@@ -79,10 +96,10 @@ MAIL_FROM_ADDRESS=noreply@example.org
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Local development only — ignored in production
|
||||
# Porte
|
||||
# -----------------------------------------------------------------------------
|
||||
# Host port for docker-compose.dev.yml. In production Traefik handles routing
|
||||
# and no port is published.
|
||||
APP_PORT=8080
|
||||
MAILPIT_UI_PORT=8025
|
||||
SEED_DEV_DATA=false
|
||||
# Di default l'app ascolta solo su localhost. In produzione va bene cosi': il
|
||||
# traffico arriva da Traefik sulla rete interna, non da questa porta.
|
||||
# Per esporla davvero (server senza reverse proxy): APP_PORT=0.0.0.0:8080
|
||||
APP_PORT=127.0.0.1:8080
|
||||
MAILPIT_UI_PORT=127.0.0.1:8025
|
||||
|
||||
Reference in New Issue
Block a user