Update docker-compose.yml

new compose based on psql; mariadb and mysql are deprecated
This commit is contained in:
LRVT 2024-02-22 12:23:05 +01:00 committed by GitHub
parent 65c876d791
commit 4d02f7710f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,24 +1,25 @@
version: '3.8' version: '3.8'
services: services:
n8n-db: n8n-db:
image: mariadb:10.7 image: postgres:11-alpine
container_name: n8n-db container_name: n8n-db
hostname: n8n-db
restart: unless-stopped restart: unless-stopped
environment: environment:
- MARIADB_ROOT_PASSWORD - POSTGRES_USER
- MARIADB_DATABASE - POSTGRES_PASSWORD
- MARIADB_USER - POSTGRES_DB
- MARIADB_PASSWORD - POSTGRES_NON_ROOT_USER
- MARIADB_MYSQL_LOCALHOST_USER=true - POSTGRES_NON_ROOT_PASSWORD
volumes: volumes:
- ${DOCKER_VOLUME_STORAGE:-/mnt/docker-volumes}/n8n/database:/var/lib/mysql - ${DOCKER_VOLUME_STORAGE:-/mnt/docker-volumes}/n8n/database:/var/lib/postgresql/data
- ${DOCKER_VOLUME_STORAGE:-/mnt/docker-volumes}/n8n/init-database.sh:/docker-entrypoint-initdb.d/init-data.sh:ro
healthcheck: healthcheck:
test: "/usr/bin/mysql --user=${MARIADB_USER} --password=${MARIADB_PASSWORD} --execute 'SELECT 1;'" test: ['CMD-SHELL', 'pg_isready -h localhost -U ${POSTGRES_USER} -d ${POSTGRES_DB}']
interval: 10s interval: 5s
timeout: 5s timeout: 5s
retries: 10 retries: 10
n8n: n8n:
image: n8nio/n8n image: n8nio/n8n
@ -26,18 +27,17 @@ services:
hostname: n8n hostname: n8n
restart: unless-stopped restart: unless-stopped
environment: environment:
- DB_TYPE=mariadb - DB_TYPE=postgresdb
- DB_MYSQLDB_HOST=n8n-db - DB_POSTGRESDB_HOST=n8n-db
- DB_MYSQLDB_DATABASE=${MARIADB_DATABASE} - DB_POSTGRESDB_DATABASE=${POSTGRES_DB}
- DB_MYSQLDB_USER=${MARIADB_USER} - DB_POSTGRESDB_USER=${POSTGRES_NON_ROOT_USER}
- DB_MYSQLDB_PASSWORD=${MARIADB_PASSWORD} - DB_POSTGRESDB_PASSWORD=${POSTGRES_NON_ROOT_PASSWORD}
ports: ports:
- 5678:5678 - 5678:5678
links: links:
- n8n-db - n8n-db
volumes: volumes:
- ${DOCKER_VOLUME_STORAGE:-/mnt/docker-volumes}/n8n/storage:/home/node/.n8n - ${DOCKER_VOLUME_STORAGE:-/mnt/docker-volumes}/n8n/storage:/home/node/.n8n
#command: n8n start --tunnel
depends_on: depends_on:
n8n-db: n8n-db:
condition: service_healthy condition: service_healthy