Aggiunge infrastruttura PocketBase locale (Docker, schema, hook)
Introduce PocketBase come sostituto di Supabase solo per l'ambiente di sviluppo locale (docs/PORTABILITA.md): docker-compose.pocketbase.yml, schema iniziale in pocketbase/pb_migrations/ (collection equivalenti alle tabelle Supabase, con le stesse API rule dove esprimibili) e la logica procedurale che in Postgres viveva in trigger/funzioni riscritta come hook JS in pocketbase/pb_hooks/ (claim slot giocatore, blocco autovoto, convocati/pagelle chiuse, immutabilità di risposto_il). Il superuser e il provider Google OAuth2 si ricreano da soli a ogni avvio da variabili d'ambiente (script scripts/pocketbase-reset.sh), così un reset non richiede passaggi manuali da dashboard. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
# PocketBase locale per lo sviluppo (sostituisce "npx supabase start" solo in locale,
|
||||
# vedi docs/PORTABILITA.md e la voce DD relativa). La produzione resta su Supabase.
|
||||
#
|
||||
# Uso:
|
||||
# docker compose -f docker-compose.pocketbase.yml up -d # avvia
|
||||
# docker compose -f docker-compose.pocketbase.yml down # ferma
|
||||
# docker compose -f docker-compose.pocketbase.yml down -v # ferma e azzera i dati locali
|
||||
#
|
||||
# Dashboard admin: http://127.0.0.1:8090/_/
|
||||
# API: http://127.0.0.1:8090/api/
|
||||
|
||||
services:
|
||||
pocketbase:
|
||||
image: ghcr.io/muchobien/pocketbase:latest
|
||||
container_name: crapp-pocketbase
|
||||
restart: unless-stopped
|
||||
# --automigrate=0: le modifiche fatte da dashboard (es. abilitare un provider OAuth2,
|
||||
# con relativo client secret) NON devono finire come file di migration versionati in
|
||||
# git. Le migration restano solo quelle scritte a mano in pocketbase/pb_migrations/.
|
||||
command: ["--automigrate=0"]
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
# L'immagine crea il superuser da queste variabili a ogni avvio (idempotente):
|
||||
# sopravvive a "npm run pocketbase:reset" senza passaggi manuali.
|
||||
PB_ADMIN_EMAIL: ${POCKETBASE_SUPERUSER_EMAIL:-}
|
||||
PB_ADMIN_PASSWORD: ${POCKETBASE_SUPERUSER_PASSWORD:-}
|
||||
ports:
|
||||
- "8090:8090"
|
||||
volumes:
|
||||
- ./pocketbase/pb_data:/pb_data
|
||||
- ./pocketbase/pb_migrations:/pb_migrations
|
||||
- ./pocketbase/pb_hooks:/pb_hooks
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--spider", "-q", "http://127.0.0.1:8090/api/health"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
Reference in New Issue
Block a user