version: '3.8' services: n8n: image: n8nio/n8n:1.105.2 container_name: n8n restart: unless-stopped ports: - 5678:5678 # Only exposed locally, Traefik handles external access environment: - DB_TYPE=postgresdb - DB_POSTGRESDB_HOST=postgres - DB_POSTGRESDB_PORT=5432 - DB_POSTGRESDB_DATABASE=${POSTGRES_DB} # Comes from .env file - DB_POSTGRESDB_USER=${POSTGRES_USER} # Comes from .env file - DB_POSTGRESDB_PASSWORD=${POSTGRES_PASSWORD} # Comes from .env file - NODE_FUNCTION_ALLOW_EXTERNAL=langchain # Important for LangChain nodes! volumes: - /usr/docker_binds/n8n/.n8n:/home/node/.n8n postgres: image: postgres:14 container_name: n8n_postgres restart: unless-stopped environment: - POSTGRES_DB=${POSTGRES_DB} # From .env - POSTGRES_USER=${POSTGRES_USER} # From .env - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} # From .env volumes: - /usr/docker_binds/n8n/postgres:/var/lib/postgresql/data # Persist your database networks: - n8n