docker-compose_n8n/docker-compose.yml
2025-08-09 02:05:19 +08:00

46 lines
1.4 KiB
YAML
Executable File

# AUTHOR: Kris <connect@kristoffermalong.dev>
# NOTE:
# Permission fix for linux based operating systems (If you are using local-space instead of mounted volumes).
# sudo chown -R 1000:1000 ./n8n_data
# sudo chmod 755 ./n8n_data
# then, restart docker compose container
# This configuration is set to mounted volume by default.
services:
n8n:
image: n8nio/n8n:stable
container_name: n8n
ports:
- "5678:${N8N_PORT}"
user: "1000:1000"
environment:
- N8N_BASIC_AUTH_ACTIVE=${N8N_BASIC_AUTH_ACTIVE}
- N8N_BASIC_AUTH_USER=${N8N_BASIC_AUTH_USER}
- N8N_BASIC_AUTH_PASSWORD=${N8N_BASIC_AUTH_PASSWORD}
- N8N_HOST=${N8N_HOST}
- N8N_PORT=${N8N_PORT}
- N8N_PROTOCOL=${N8N_PROTOCOL}
- N8N_EDITOR_BASE_URL=${N8N_EDITOR_BASE_URL}
- TZ=${TZ}
# For security. Set default values for the following environment variables.
- N8N_RUNNERS_ENABLED=true
- N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
volumes:
- n8n_data:/home/node/.n8n:rw
restart: unless-stopped
# We do this since we are not autoscaling.
# We can autoscale with kubernetes or k8s in the future.
# This is to prevent your host PC or VPS from draining its resources.
deploy:
resources:
limits:
cpus: "${N8N_LIMIT_CPUS}"
memory: "${N8N_LIMIT_MEMORY}"
reservations:
cpus: "${N8N_RESERVE_CPUS}"
memory: "${N8N_RESERVE_MEMORY}"
volumes:
n8n_data: