Tots els compose

This commit is contained in:
Guillem Hernandez Sola
2026-06-30 13:12:37 +02:00
parent bebb2969f8
commit f1fe15d1b5
35 changed files with 2075 additions and 0 deletions

64
n8n/docker-compose.yml Normal file
View File

@@ -0,0 +1,64 @@
# /opt/stacks/n8n/docker-compose.yml
services:
postgres:
image: postgres:15
restart: unless-stopped
environment:
POSTGRES_USER: '${POSTGRES_USER}'
POSTGRES_PASSWORD: '${POSTGRES_PASSWORD}'
POSTGRES_DB: '${POSTGRES_DB}'
TZ: Europe/Madrid
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck: # Crític: n8n espera que postgres estigui llest
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
networks:
- n8n-net
n8n:
image: n8nio/n8n:latest
restart: unless-stopped
ports:
- "5678:5678" # Interfície web (només local → via Nginx)
environment:
TZ: Europe/Madrid
GENERIC_TIMEZONE: Europe/Madrid # Necessari per a workflows cron
# Base de dades
DB_TYPE: postgresdb
DB_POSTGRESDB_HOST: postgres
DB_POSTGRESDB_PORT: 5432
DB_POSTGRESDB_DATABASE: '${POSTGRES_DB}'
DB_POSTGRESDB_USER: '${POSTGRES_USER}'
DB_POSTGRESDB_PASSWORD: '${POSTGRES_PASSWORD}'
# Seguretat
N8N_ENCRYPTION_KEY: '${N8N_ENCRYPTION_KEY}' # CRÍTIC: mai canviar un cop configurat
# URL pública (necessari per a webhooks)
N8N_HOST: '${N8N_HOST}'
N8N_PORT: 5678
N8N_PROTOCOL: https
WEBHOOK_URL: 'https://${N8N_HOST}/'
volumes:
- n8n_data:/home/node/.n8n
depends_on:
postgres:
condition: service_healthy # Espera que postgres estigui realment llest
networks:
- n8n-net
- shared_net
volumes:
postgres_data:
n8n_data:
networks:
n8n-net:
driver: bridge
shared_net:
external: true
name: shared_net