So after trying n8n out with the default sqlitedb, I’m trying to get it started using postgres for the back end, using
and
But it’s not obvious where to put the exported variables - adding them to a script that does a basic “docker run” doesn’t work. Neither does putting them in a file: ~/.n8n/.env
right now I am doing this:
You can find a full example which starts n8n via docker-compose with Postgres here:
Apart from that can the you use the default docker-syntax to set environment variables -e NAME=VALUE as described here in the docker documentation:
Here also a full example for a one-liner with all variables set:
I do not have an example ready with nginx in front of it. But you can combine the above examples with any other docker-example which puts nginx in front of X and you should the be able to get it up and running.
Apart from that do I strongly recommend you to follow our server-setup guide. It does not use nginx but but traefik and takes care of everything:
So that works fine with the -e docker options.
Although it isn’t necessary to add in the schema option for the psql connection. TBH, I’ve never had to use that in 20+ years of being a sysadmin.
(and the machine it’s on right now is actually running apache, not nginx)
I might give traefik a go if I move it to its own container.
For my setup it’s more likely that any external webhooks would be coming via haproxy, so I’ll look at that soon.