63 lines
1.6 KiB
YAML
63 lines
1.6 KiB
YAML
|
|
# HomeAI Kit — Automation Stack (n8n + PostgreSQL)
|
||
|
|
# Workflow automation that connects all other services.
|
||
|
|
#
|
||
|
|
# Setup:
|
||
|
|
# docker network create homeai-net # once, if not already created
|
||
|
|
# docker compose up -d
|
||
|
|
#
|
||
|
|
# n8n UI: http://localhost:5678
|
||
|
|
# Create your admin account on first visit.
|
||
|
|
|
||
|
|
services:
|
||
|
|
postgres:
|
||
|
|
image: postgres:16-alpine
|
||
|
|
container_name: homeai-postgres
|
||
|
|
ports:
|
||
|
|
- "${POSTGRES_PORT:-5432}:5432"
|
||
|
|
environment:
|
||
|
|
POSTGRES_USER: ${POSTGRES_USER:-homeai}
|
||
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env}
|
||
|
|
POSTGRES_DB: ${POSTGRES_DB:-n8n}
|
||
|
|
volumes:
|
||
|
|
- postgres_data:/var/lib/postgresql/data
|
||
|
|
healthcheck:
|
||
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-homeai} -d ${POSTGRES_DB:-n8n}"]
|
||
|
|
interval: 10s
|
||
|
|
timeout: 5s
|
||
|
|
retries: 5
|
||
|
|
restart: unless-stopped
|
||
|
|
networks:
|
||
|
|
- homeai-net
|
||
|
|
|
||
|
|
n8n:
|
||
|
|
image: n8nio/n8n:latest
|
||
|
|
container_name: homeai-n8n
|
||
|
|
ports:
|
||
|
|
- "${N8N_PORT:-5678}:5678"
|
||
|
|
environment:
|
||
|
|
DB_TYPE: postgresdb
|
||
|
|
DB_POSTGRESDB_HOST: postgres
|
||
|
|
DB_POSTGRESDB_PORT: 5432
|
||
|
|
DB_POSTGRESDB_DATABASE: ${POSTGRES_DB:-n8n}
|
||
|
|
DB_POSTGRESDB_USER: ${POSTGRES_USER:-homeai}
|
||
|
|
DB_POSTGRESDB_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env}
|
||
|
|
N8N_HOST: ${N8N_HOST:-localhost}
|
||
|
|
N8N_PROTOCOL: http
|
||
|
|
WEBHOOK_URL: http://${N8N_HOST:-localhost}:${N8N_PORT:-5678}/
|
||
|
|
volumes:
|
||
|
|
- n8n_data:/home/node/.n8n
|
||
|
|
depends_on:
|
||
|
|
postgres:
|
||
|
|
condition: service_healthy
|
||
|
|
restart: unless-stopped
|
||
|
|
networks:
|
||
|
|
- homeai-net
|
||
|
|
|
||
|
|
volumes:
|
||
|
|
postgres_data:
|
||
|
|
n8n_data:
|
||
|
|
|
||
|
|
networks:
|
||
|
|
homeai-net:
|
||
|
|
external: true
|