DOMAIN=
TIMEZONE=Europe/Moscow
POSTGRES_USER=
POSTGRES_PASSWORD=
POSTGRES_DB=
PGADMIN_DEFAULT_EMAIL=
PGADMIN_DEFAULT_PASSWORD=
version: '3.8'
services:
##########################################################################
# PostgreSQL
##########################################################################
postgres:
image: postgres
container_name: postgres_db
restart: unless-stopped
healthcheck:
test: ['CMD-SHELL', 'pg_isready -h localhost -U ${POSTGRES_USER} -d ${POSTGRES_DB}']
interval: 30s
timeout: 10s
retries: 5
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
PGDATA: /var/lib/postgresql/data/pgdata
POSTGRES_INITDB_ARGS: "--encoding=UTF8 --locale=en_US.UTF-8"
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
##########################################################################
# pgadmin
##########################################################################
pgadmin:
image: dpage/pgadmin4
container_name: pgadmin
restart: unless-stopped
environment:
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL}
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD}
ports:
- "5050:80"
depends_on: # после какого контейнера нужно выполнить запуск
postgres:
condition: service_healthy
##########################################################################
# N8N MAIN
##########################################################################
n8n-main:
image: n8nio/n8n
container_name: n8n-main
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5678/healthz"]
interval: 30s
timeout: 10s
retries: 5
environment:
# BD
DB_TYPE: postgresdb
DB_POSTGRESDB_HOST: postgres
DB_POSTGRESDB_PORT: 5432
DB_POSTGRESDB_DATABASE: ${POSTGRES_DB}
DB_POSTGRESDB_USER: ${POSTGRES_USER}
DB_POSTGRESDB_PASSWORD: ${POSTGRES_PASSWORD}
# Configuration
GENERIC_TIMEZONE: ${TIMEZONE}
N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS: "true" # автоматическое соблюдение правильных прав доступа к файлам
N8N_HOST: ${DOMAIN}
N8N_PROTOCOL: "https"
WEBHOOK_URL: "https://${DOMAIN}"
EXECUTIONS_DATA_SAVE_ON_SUCCESS: "all" # Сохраняет ли n8n данные об успешном выполнении all \ none
EXECUTIONS_DATA_SAVE_ON_ERROR: "all" # Сохраняет ли n8n данные выполнения при ошибке all \ none
EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS: "false" # Сохранять ли данные о выполнениях при запуске вручную
N8N_RUNNERS_ENABLED: true
# Mode queue
EXECUTIONS_MODE: queue # использовать очередь regular \ queue
QUEUE_HEALTH_CHECK_ACTIVE: true
QUEUE_BULL_REDIS_HOST: redis
QUEUE_BULL_REDIS_PORT: 6379
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
volumes:
- n8n_data:/home/node/.n8n
deploy:
resources:
limits:
memory: "4G"
ports:
- "5678:5678"
##########################################################################
# N8N WORKER
##########################################################################
n8n-worker:
image: n8nio/n8n
container_name: n8n-worker
restart: unless-stopped
environment:
# BD
DB_TYPE: postgresdb
DB_POSTGRESDB_HOST: postgres
DB_POSTGRESDB_PORT: 5432
DB_POSTGRESDB_DATABASE: ${POSTGRES_DB}
DB_POSTGRESDB_USER: ${POSTGRES_USER}
DB_POSTGRESDB_PASSWORD: ${POSTGRES_PASSWORD}
# Configuration
N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS: "true"
N8N_PROTOCOL: "https"
WEBHOOK_URL: "https://${DOMAIN}"
# Queue
EXECUTIONS_MODE: queue
QUEUE_BULL_REDIS_HOST: redis
QUEUE_BULL_REDIS_PORT: 6379
QUEUE_HEALTH_CHECK_ACTIVE: true
depends_on:
- n8n-main
- redis
volumes:
- n8n_data:/home/node/.n8n
##########################################################################
# qdrant
##########################################################################
qdrant:
image: qdrant/qdrant
container_name: qdrant
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:6333/health"]
interval: 30s
timeout: 10s
retries: 5
environment:
QDRANT__STORAGE__MODE: "disk"
QDRANT__SERVICE__GRPC_PORT: 6334
QDRANT__SERVICE__HTTP_PORT: 6333
QDRANT__STORAGE__OPTIMIZE_INVERTED_INDEX: "true"
QDRANT__SERVICE__MAX_REQUEST_SIZE_MB: 256
QDRANT__STORAGE__CACHE_COLLECTIONS_IN_MEMORY: "true"
ports:
- "6333:6333"
- "6334:6334"
volumes:
- qdrant_data:/qdrant/storage
##########################################################################
# Redis
##########################################################################
redis:
image: redis:6
container_name: redis
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "--no-auth-warning", "ping"]
interval: 30s
timeout: 10s
retries: 5
ports:
- "6379:6379"
volumes:
- redis_data:/data
##########################################################################
# watchtower
##########################################################################
watchtower:
image: containrrr/watchtower
container_name: watchtower
restart: unless-stopped
environment:
WATCHTOWER_CLEANUP: "true" # Очистка старых образов
WATCHTOWER_POLL_INTERVAL: "86400" # Интервал проверки обновлений - 24 часа
WATCHTOWER_LABEL_ENABLE: "true" # отслеживание обновлений
labels:
com.centurylinklabs.watchtower.enable: "false" # не обновлять себя
volumes:
- /var/run/docker.sock:/var/run/docker.sock
volumes:
postgres_data:
driver: local
n8n_data:
driver: local
qdrant_data:
driver: local
redis_data:
driver: local