Local Docker Compose setup to run n8n
- Docker and Docker Compose
- Stonehenge - Uses Traefik as reverse proxy and handles SSL certificates.
- n8n main instance
- n8n worker instance
- Postgres database
- Valkey (opensource Redis alternative)
Prepare configuration:
Copy .env.dist to .env and adjust the values.
docker compose up --waitOpen https://n8n.docker.so
On the OpenAI credential dialog, use the following info:
- Base URL with LM Studio: http://host.docker.internal:1234/v1
- Base URL with Ollama: http://host.docker.internal:11434/v1
- API Key:
whatever
make updateThis command will do the following operations:
When Docker image tag for n8n updates in compose.yaml:3 you can update to a new version with:
docker compose up --waitThen you can clean old image(s) with:
docker image prune -a --force --filter "label=org.opencontainers.image.source=https://github.com/n8n-io/n8n"A local directory local-files shared between the n8n instance and host. In n8n, use the /files path to read from
and write to this directory.
Check general instructions on https://blog.oxyconit.com/how-to-update-postgres-16-to-17-in-docker/
Create a backup in an old version:
docker compose exec -it postgres /bin/bash -c 'pg_dumpall -U $POSTGRES_USER > /backup/dump.sql'Import the backup in the new version:
docker compose exec -it postgres /bin/bash -c 'psql -d $POSTGRES_DB -U $POSTGRES_USER < /backup/dump.sql'This was made based on the example from github.com/n8n-io.