mirror of
https://github.com/Dokploy/templates.git
synced 2026-06-15 20:25:24 +02:00
feat(blueprints): n8n + worker/runner + redis/postgres + ollama & fix(blueprints): twentycrm (#364)
* feat(n8n): add n8n runner with Postgres and Ollama configuration * feat(meta): update n8n runner version to nightly and enhance description * feat(docker): update PostgreSQL image to 17-alpine and enhance healthcheck command * feat(n8n): update environment variables and enhance configuration for Redis and Ollama integration * feat(n8n): replace hardcoded N8N_PROXY_HOPS with environment variable and fix encryption key variable name * feat(n8n): comment out SMTP environment variables in docker-compose.yml * feat(n8n): set default value for N8N_PROXY_HOPS environment variable * Update blueprints/n8n-runner-postgres-ollama/docker-compose.yml * Update blueprints/n8n-runner-postgres-ollama/docker-compose.yml * Update blueprints/n8n-runner-postgres-ollama/docker-compose.yml * Update blueprints/n8n-runner-postgres-ollama/docker-compose.yml * Update blueprints/n8n-runner-postgres-ollama/docker-compose.yml * feat(twenty): update HTTP protocol handling in environment variables and enhance healthcheck configuration * refactor(docker-compose): remove container names for n8n services --------- Co-authored-by: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com>
This commit is contained in:
146
blueprints/n8n-runner-postgres-ollama/docker-compose.yml
Normal file
146
blueprints/n8n-runner-postgres-ollama/docker-compose.yml
Normal file
@@ -0,0 +1,146 @@
|
||||
services:
|
||||
n8n:
|
||||
image: n8nio/n8n:latest
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
- N8N_HOST=${N8N_HOST}
|
||||
- N8N_PORT=${N8N_PORT}
|
||||
- N8N_PROTOCOL=https
|
||||
# Database
|
||||
- DB_TYPE=postgresdb
|
||||
- DB_POSTGRESDB_HOST=postgres
|
||||
- DB_POSTGRESDB_USER=${POSTGRES_USER}
|
||||
- DB_POSTGRESDB_PASSWORD=${POSTGRES_PASSWORD}
|
||||
# Configuration
|
||||
- N8N_DIAGNOSTICS_ENABLED=false
|
||||
- N8N_PERSONALIZATION_ENABLED=true
|
||||
- N8N_ENCRYPTION_KEY=${ENCRYPTION_KEY}
|
||||
- N8N_USER_MANAGEMENT_JWT_SECRET
|
||||
- N8N_SECURE_COOKIE=true
|
||||
- N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
|
||||
- N8N_BLOCK_ENV_ACCESS_IN_NODE=true
|
||||
- N8N_PROXY_HOPS=${PROXY_HOPS:-1}
|
||||
- WEBHOOK_URL=https://${N8N_HOST}/
|
||||
- GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
|
||||
- N8N_TEMPLATES_ENABLED=true
|
||||
- N8N_HIRING_BANNER_ENABLED=false
|
||||
- OFFLOAD_MANUAL_EXECUTIONS_TO_WORKERS=true
|
||||
# Ollama
|
||||
- OLLAMA_HOST=${OLLAMA_HOST:-ollama:11434}
|
||||
# Runners
|
||||
- N8N_RUNNERS_ENABLED=true
|
||||
- N8N_RUNNERS_MODE=external
|
||||
- N8N_RUNNERS_BROKER_LISTEN_ADDRESS=0.0.0.0
|
||||
- N8N_RUNNERS_AUTH_TOKEN=${N8N_RUNNERS_SECRET}
|
||||
- N8N_NATIVE_PYTHON_RUNNER=true
|
||||
- N8N_RUNNERS_MAX_CONCURRENCY=50
|
||||
# Logging
|
||||
- EXECUTIONS_DATA_PRUNE=true
|
||||
- EXECUTIONS_DATA_MAX_AGE=7
|
||||
# Redis
|
||||
- EXECUTIONS_MODE=queue
|
||||
- QUEUE_BULL_REDIS_HOST=redis
|
||||
- QUEUE_BULL_REDIS_PORT=6379
|
||||
# Emails
|
||||
# - N8N_SMTP_HOST=${SMTP_HOST}
|
||||
# - N8N_SMTP_PORT=${SMTP_PORT}
|
||||
# - N8N_SMTP_USER=${SMTP_USER}
|
||||
# - N8N_SMTP_PASS=${SMTP_PASS}
|
||||
volumes:
|
||||
- n8n_data:/home/node/.n8n
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
|
||||
n8n-worker:
|
||||
image: docker.n8n.io/n8nio/n8n:latest
|
||||
restart: always
|
||||
command: worker
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
- N8N_HOST=${N8N_HOST}
|
||||
- N8N_PORT=${N8N_PORT}
|
||||
- N8N_PROTOCOL=https
|
||||
- EXECUTIONS_MODE=queue
|
||||
- DB_TYPE=postgresdb
|
||||
- DB_POSTGRESDB_HOST=postgres
|
||||
- DB_POSTGRESDB_USER=${POSTGRES_USER}
|
||||
- DB_POSTGRESDB_PASSWORD=${POSTGRES_PASSWORD}
|
||||
- N8N_ENCRYPTION_KEY=${ENCRYPTION_KEY}
|
||||
- N8N_SECURE_COOKIE=true
|
||||
- N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
|
||||
- N8N_BLOCK_ENV_ACCESS_IN_NODE=true
|
||||
- N8N_PROXY_HOPS=${PROXY_HOPS}
|
||||
- WEBHOOK_URL=https://${N8N_HOST}/
|
||||
- GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
|
||||
- QUEUE_BULL_REDIS_HOST=redis
|
||||
- QUEUE_BULL_REDIS_PORT=6379
|
||||
depends_on:
|
||||
- n8n
|
||||
- redis
|
||||
|
||||
n8n-runner:
|
||||
image: n8nio/runners:nightly
|
||||
restart: always
|
||||
environment:
|
||||
- N8N_RUNNERS_TASK_BROKER_URI=http://n8n:5679
|
||||
- N8N_RUNNERS_AUTH_TOKEN=${N8N_RUNNERS_SECRET}
|
||||
- N8N_ENCRYPTION_KEY=${ENCRYPTION_KEY}
|
||||
- GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
|
||||
- N8N_RUNNERS_MAX_CONCURRENCY=50
|
||||
depends_on:
|
||||
- n8n
|
||||
|
||||
ollama:
|
||||
image: ollama/ollama:latest
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ollama_storage:/home/node/.ollama
|
||||
|
||||
init-ollama:
|
||||
image: ollama/ollama:latest
|
||||
volumes:
|
||||
- ollama_storage:/home/node/.ollama
|
||||
entrypoint: /bin/sh
|
||||
environment:
|
||||
- OLLAMA_HOST=ollama:11434
|
||||
command:
|
||||
- "-c"
|
||||
- "sleep 3; ollama pull llama3.2:latest; ollama pull gemma3:latest"
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
restart: unless-stopped
|
||||
command: redis-server --appendonly yes
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
volumes:
|
||||
- redis_storage:/data
|
||||
|
||||
postgres:
|
||||
image: postgres:17-alpine
|
||||
hostname: postgres
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- POSTGRES_USER=${POSTGRES_USER}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||
- POSTGRES_DB=${POSTGRES_DB}
|
||||
volumes:
|
||||
- postgres_storage:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ['CMD-SHELL', 'pg_isready -h localhost -U ${POSTGRES_USER} -d ${POSTGRES_DB}']
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
|
||||
volumes:
|
||||
n8n_data:
|
||||
postgres_storage:
|
||||
ollama_storage:
|
||||
redis_storage:
|
||||
BIN
blueprints/n8n-runner-postgres-ollama/n8n.png
Normal file
BIN
blueprints/n8n-runner-postgres-ollama/n8n.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.4 KiB |
35
blueprints/n8n-runner-postgres-ollama/template.toml
Normal file
35
blueprints/n8n-runner-postgres-ollama/template.toml
Normal file
@@ -0,0 +1,35 @@
|
||||
[variables]
|
||||
main_domain = "${domain}"
|
||||
postgres_user = "${username}"
|
||||
postgres_password = "${password:24}"
|
||||
postgres_db = "n8n"
|
||||
n8n_encryption_key = "${base64:64}"
|
||||
n8n_runner_secret = "${base64:64}"
|
||||
|
||||
[config]
|
||||
mounts = []
|
||||
|
||||
[[config.domains]]
|
||||
serviceName = "n8n"
|
||||
port = 5_678
|
||||
host = "${main_domain}"
|
||||
|
||||
[config.env]
|
||||
N8N_HOST = "${main_domain}"
|
||||
N8N_PORT = "5678"
|
||||
N8N_RUNNERS_SECRET = "${n8n_runner_secret}"
|
||||
|
||||
PROXY_HOPS = "0"
|
||||
ENCRYPTION_KEY = "${n8n_encryption_key}"
|
||||
GENERIC_TIMEZONE = "Europe/Berlin"
|
||||
|
||||
POSTGRES_DB = "${postgres_db}"
|
||||
POSTGRES_USER = "${postgres_user}"
|
||||
POSTGRES_PASSWORD = "${postgres_password}"
|
||||
|
||||
OLLAMA_HOST = "http://ollama:11434"
|
||||
|
||||
SMTP_HOST = ""
|
||||
SMTP_PORT = "587"
|
||||
SMTP_USER = ""
|
||||
SMTP_PASS = ""
|
||||
@@ -1,5 +1,3 @@
|
||||
version: "3.9"
|
||||
|
||||
services:
|
||||
twenty-change-vol-ownership:
|
||||
image: ubuntu
|
||||
@@ -21,13 +19,19 @@ services:
|
||||
- twenty-docker-data:/app/docker-data
|
||||
environment:
|
||||
PORT: 3000
|
||||
SERVER_URL: ${HTTP_PROTOCOL}://${TWENTY_HOST}
|
||||
FRONT_BASE_URL: ${HTTP_PROTOCOL}://${TWENTY_HOST}
|
||||
|
||||
PG_DATABASE_URL: postgres://${DB_USER}:${DB_PASSWORD}@twenty-postgres:5432/twenty
|
||||
SERVER_URL: https://${TWENTY_HOST}
|
||||
FRONT_BASE_URL: https://${TWENTY_HOST}
|
||||
REDIS_URL: redis://twenty-redis:6379
|
||||
ENABLE_DB_MIGRATIONS: "true"
|
||||
SIGN_IN_PREFILLED: "true"
|
||||
|
||||
REDIS_URL: redis://twenty-redis:6379
|
||||
IS_SIGN_UP_DISABLED: ${IS_SIGN_UP_DISABLED:-false}
|
||||
SIGN_IN_PREFILLED: "false"
|
||||
|
||||
IS_CONFIG_VARIABLES_IN_DB_ENABLED: "true"
|
||||
STORAGE_TYPE: local
|
||||
|
||||
APP_SECRET: ${APP_SECRET}
|
||||
depends_on:
|
||||
twenty-change-vol-ownership:
|
||||
@@ -35,10 +39,11 @@ services:
|
||||
twenty-postgres:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: curl --fail http://localhost:3000/healthz
|
||||
test: ["CMD", "curl", "-f", "http://127.0.0.1:3000/healthz"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
retries: 30
|
||||
start_period: 30s
|
||||
restart: always
|
||||
|
||||
twenty-worker:
|
||||
@@ -47,8 +52,8 @@ services:
|
||||
command: ["yarn", "worker:prod"]
|
||||
environment:
|
||||
PG_DATABASE_URL: postgres://${DB_USER}:${DB_PASSWORD}@twenty-postgres:5432/twenty
|
||||
SERVER_URL: https://${TWENTY_HOST}
|
||||
FRONT_BASE_URL: https://${TWENTY_HOST}
|
||||
SERVER_URL: ${HTTP_PROTOCOL}://${TWENTY_HOST}
|
||||
FRONT_BASE_URL: ${HTTP_PROTOCOL}://${TWENTY_HOST}
|
||||
REDIS_URL: redis://twenty-redis:6379
|
||||
ENABLE_DB_MIGRATIONS: "false"
|
||||
STORAGE_TYPE: local
|
||||
@@ -61,7 +66,7 @@ services:
|
||||
restart: always
|
||||
|
||||
twenty-postgres:
|
||||
image: postgres:16-alpine
|
||||
image: postgres:17-alpine
|
||||
|
||||
volumes:
|
||||
- twenty-postgres-data:/var/lib/postgresql/data
|
||||
@@ -88,10 +93,6 @@ services:
|
||||
retries: 10
|
||||
restart: always
|
||||
|
||||
networks:
|
||||
dokploy-network:
|
||||
external: true
|
||||
|
||||
volumes:
|
||||
twenty-docker-data:
|
||||
twenty-postgres-data:
|
||||
|
||||
@@ -13,7 +13,9 @@ port = 3_000
|
||||
host = "${main_domain}"
|
||||
|
||||
[config.env]
|
||||
HTTP_PROTOCOL = "http"
|
||||
TWENTY_HOST = "${main_domain}"
|
||||
DB_USER = "${db_user}"
|
||||
DB_PASSWORD = "${db_password}"
|
||||
APP_SECRET = "${app_secret}"
|
||||
IS_SIGN_UP_DISABLED = "false"
|
||||
|
||||
Reference in New Issue
Block a user