Install n8n on Synology with docker

Hi Erwin! Here my Docker settings from the manual installation.

1. Install Postgres




2. Install n8n




Maybe this helps. I’ve not I will try an reinstall and do an documentation for you!

2 Likes

What is the ‘docker user’ ?
Until now I had every docker container running with PUID and PGID.
For the PUID/PGID I used the userid and groupid of an account that I specifically created for Docker.
For standard sysnology often the default admin account is used: 1026/100.
From what I understand is that at synology they discourage using the root account.
So my docker user 1026/100 has indeed RW access to /volume1/docker/n8n.

I know what you‘ve talking about. I got some docker installations with the PUIG/PGID in the configs. In this example i haven‘t used this parameters.

Thanks Jonathan!
Instead of Postgres, I have MariaDB running as a synology package, so not in docker. It works with other containers ok.
I do this so synology backups also the databases without having to pull all kind of stunts.

So I followed your example from “2. install n8n”
I changed the DB settings obviously :wink:
It works WITHOUT setting the volumes…
When I add a volume, it breaks. This does not work:
Screenshot 2021-05-07 at 22.25.48
It results in this error:

Initializing n8n process
UserSettings got generated and saved to: /home/node/.n8n/config
› Error: There was an error: EACCES: permission denied, open
› ‘/home/node/.n8n/config’

When I change it from /home/node/.n8n to /home/node ,so it reflects your settings, I get this error:

Initializing n8n process
(node:6) [EACCES] Error: EACCES: permission denied, open ‘/home/node/.local/share/n8n/package.json’
(Use node --trace-warnings ... to show where the warning was created)
UserSettings got generated and saved to: /home/node/.n8n/config
› Error: There was an error: EACCES: permission denied, mkdir
› ‘/home/node/.n8n’
[Error: EACCES: permission denied, mkdir ‘/home/node/.cache/n8n’] {
errno: -13,
code: ‘EACCES’,
syscall: ‘mkdir’,
path: ‘/home/node/.cache/n8n’
}
[Error: EACCES: permission denied, mkdir ‘/home/node/.cache/n8n’] {
errno: -13,
code: ‘EACCES’,
syscall: ‘mkdir’,
path: ‘/home/node/.cache/n8n’
}

So yes, it’s absolutely a permission problem… The container seems to ignore the PUID/PGID environment variables. Running from terminal with -u or --user also gives a weird error:

Error: Unexpected arguments: -u, myDocker
:woozy_face:

Would you have a problem trying it with Postgres as Docker Container?

Initializing n8n process
(node:6) [EACCES] Error: EACCES: permission denied, open ‘/home/node/.local/share/n8n/package.json’
(Use node --trace-warnings ... to show where the warning was created)
UserSettings got generated and saved to: /home/node/.n8n/config
There was an error initializing DB: “getaddrinfo ENOTFOUND postgres-db”

:cry:

Guys, I got some results…
The docker image makes itself owner of the mapped volume with username ‘1000’.
When I give the ‘Owner’ RW permissions to that folder (/volume1/docker/n8n/configfiles) then it works.
I am, however, not sure if this is secure…
The synology admin account (puid 1000) is disabled by default, so I guess were safe (but don’t know for sure).

1 Like

Hi all.

I encountered this same issue when first installing n8n with Docker. For me the issue was that the default “sleep” time of 5s wasn’t enough for Postgres to set itself up, thus resulting in an empty n8n config file, thus first resulting in error DB: connect ECONNREFUSED and later on "/home/node/.n8n/config". It does not seem to be valid JSON.

When I increased the timeout to 20s, Postgres was able to boot normally, and on first boot n8n was able to connect and set the initial config correctly (only containing an encryption key). :tada:

I hope this helps someone :slight_smile:

Hello smamudhan,

I’m not a IT specialist and a bit lost with the config of Docker!

Just a question regarding the n8n.domain.com, do I need to subscribe for a domain to achieve this?
To where the domain need to be redirected, the public dyn DNS address?
n8n works globally, but I can not use the webhooks, as it can not resolve the DNS server.

Many thanks in advance for your reply!

Philippe

1 Like

Hey @Philippe ,

Happy to help. You do need a registered domain to achieve this.

I have edited my personal domain out (for privacy reasons) and used n8n.domain.com as a placeholder in the screenshot.

Once you have a domain registered, look for the section to add DNS records, and add a record that will associate your n8n server IP address with your domain name. This will typically be an “A” record, where your hostname will be n8n and your destination would be the IP address of your server. This will result in n8n.yourdomain.com being associated with your server.

Dyn DNS only applies if you have a dynamic, changing IP address (a likely scenario if you host from home). You can read more about how that works by searching for “DDNS”.

Feel free to reach out if you get stuck!

1 Like