diff --git a/.gitignore b/.gitignore index e69de29..665da45 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,2 @@ +.env +.env.* diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100755 index 0000000..541e524 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,45 @@ +# AUTHOR: Kris +# 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:5678" + 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: diff --git a/env.default b/env.default new file mode 100644 index 0000000..05b947e --- /dev/null +++ b/env.default @@ -0,0 +1,23 @@ +# Rename to ".env" +# ----- System Variables +N8N_BASIC_AUTH_ACTIVE=true +N8N_BASIC_AUTH_USER=admin +N8N_BASIC_AUTH_PASSWORD=changeme +N8N_HOST=localhost +N8N_PORT=5678 +N8N_PROTOCOL=http +N8N_EDITOR_BASE_URL=http://localhost:5678 +TZ=Asia/Manila + + + + +# ----- Resources +# - Limits +N8N_LIMIT_CPUS=0.25 +N8N_LIMIT_MEMORY=512MB + +# - Reservations +N8N_RESERVE_CPUS=0.25 +N8N_RESERVE_MEMORY=512MB +