services: n8n: image: n8nio/n8n:latest container_name: n8n restart: unless-stopped security_opt: - no-new-privileges:true environment: - PUID=${PUID} - PGID=${PGID} - TZ=${TZ} - GENERIC_TIMEZONE=${TZ} - N8N_HOST=${N8N_HOST} - N8N_PORT=${N8N_PORT} - N8N_PROTOCOL=https - DB_TYPE=postgresdb - DB_POSTGRESDB_HOST=postgres - DB_POSTGRESDB_PORT=5432 - DB_POSTGRESDB_DATABASE=n8n - DB_POSTGRESDB_USER=n8n - DB_POSTGRESDB_PASSWORD=${N8N_POSTGRES_PASSWORD} - N8N_BASIC_AUTH_ACTIVE=true - N8N_BASIC_AUTH_USER=${N8N_USER} - N8N_BASIC_AUTH_PASSWORD=${N8N_BASIC_AUTH_PASSWORD} - WEBHOOK_URL=https://${N8N_HOST} - N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true volumes: - /path/to/n8n/data:/home/node/ ports: - ${N8N_PORT}:5678 depends_on: - postgres networks: - n8n-net postgres: image: postgres:latest container_name: n8n-postgres restart: unless-stopped security_opt: - no-new-privileges:true environment: POSTGRES_USER: n8n POSTGRES_PASSWORD: ${N8N_POSTGRES_PASSWORD} POSTGRES_DB: n8n volumes: - /path/to/n8n/postgres_data:/var/lib/postgresql ports: - "127.0.0.1:${POSTGRES_PORT}:5432" networks: - n8n-net adminer: image: adminer:latest container_name: adminer restart: unless-stopped ports: - "127.0.0.1:${ADMINER_PORT}:8080" networks: - n8n-net networks: n8n-net: external: true