Guide for n8n.io
I would be very interested, as I'm currently trying to get it running. Also willing to contribute to the guide. Here's what I've done so far
Setup
- switched to node version 10 as recommended here:
uberspace tools version use node 10 npm install -g n8n- add web backend
uberspace backend set / --http --port 5678(it may be possible to use another path, but this would require further configuration, as I got CORS-errors when I tried) - Create
~/etc/services.d/n8n.iniwith the following content:
[program:n8n]
environment=
WEBHOOK_TUNNEL_URL="https://$USER.uber.space/"
command=n8n
startsecs=60
autostart=yes
autorestart=yes
- restart supervisord:
supervisorctl reread
supervisorctl update
supervisorctl status
- n8n should now be available under https://$USER.uber.space/
(not yet best practice, as probably further security aspects should be configured)
Considerations for Webhook node
- For the webhook to work (in my case, for testing purposes, to accept requests from a local devserver) I needed to add a corresponding web header
uberspace web header set / Access-Control-Allow-Origin "http://localhost:8080" - For multiple origins, maybe this can help: https://stackoverflow.com/questions/1653308/access-control-allow-origin-multiple-origin-domains
- For the urls to correctly show up, the environment variable WEBHOOK_TUNNEL_URL needs to be set to "https://$USER.uber.space/"` (see above in n8n.ini)
Considerations for Send Email node
I set up credentials for a mailbox on the same server:
- User:
$MAILBOX@$USER.uberspace.de - Host:
$USER.uberspace.de - Port:
587
However, so far I got an error "SSL routines:ssl3_get_record:wrong version number" when trying to execute the node. So far I didn't find a solution here. Maybe someone else has more insights here?
-- Edit: WEBHOOK_TUNNEL_URL added Edit2: added description how to run n8n as service
Update on SSL issue with Send Email node: Using another SMTP Server (Posteo) worked just fine. So it may just be an issue with the specific configuration at Uberspace?
The issue might be a mismatch of the openssl libraries used by uberspace and n8n (probably the nodemailer package?)? Or maybe n8n just hasn't implemented or doesn't allow for the needed configuration to access uberspace smtp server? Or maybe (hopefully) there's a simpler solution that I don't see...would be nice, if we could use uberspace mailboxes...
@tobimori @andrfr have you tried further? i'm very interesseted in setting n8n up on uberspace aswell. But i'm not any help in terms of figuring out where to change what, im willing to be a test bunny. if needed.
@qimmiq from my side, it is currently on hold, but not forgotten. I plan to return to it within this year :). The setup process described so far, should give you at least an installation to play around with (but not production ready).
@andrfr i did so :) it worked. with one change "uberspace web backend set / --http --port 5678" so i will play around a little ... looking forward to production state
Did some more work on the guide, here is the current state. I think it's 80-90% done, will have to do some more styling to make it fit for the Lab.
n8n installation on uberspace
TODO: Description of n8n
Note
For this guide you should be familiar with the basic concepts of
- Node.js and its package manager npm
- supervisord
- domains
Prerequisites
We're using Node.js in the version 12 (the current version used in the docker version of n8n):
uberspace tools version use node 12
Your n8n URL needs to be setup:
uberspace web domain list
domain.example
This guide assumes you are using a custom domain domain.example.
Installation
Install n8n
npm install -g n8n
Configuration
Configure web server
Note: n8n is running on port 5678
To make the application accessible from the outside, configure a web backend:
uberspace web backend set domain.example --http --port 5678
Setup daemon
Define a username <USER> and password <PASSWORD>, then create ~/etc/services.d/n8n.ini with the following content:
[program:n8n]
environment=
N8N_HOST=domain.example,
VUE_APP_URL_BASE_API="https://domain.example/",
WEBHOOK_TUNNEL_URL="https://domain.example/",
GENERIC_TIMEZONE="Europe/Berlin",
N8N_BASIC_AUTH_ACTIVE=true,
N8N_BASIC_AUTH_USER=<USER>,
N8N_BASIC_AUTH_PASSWORD=<PASSWORD>
command=n8n
startsecs=60
autostart=yes
autorestart=yes
n8n can be configured using environment variables. The proposed n8n.ini provides some useful additional configurations for activating authentication, setting a proper timezone and configuring the domain for webhooks to work.
After creating the configuration, tell supvervisord to refresh its configuration and start the service:
supervisorctl reread
supervisorctl update
supervisorctl status
If it's not in state RUNNING, check your configuration.
Finishing installation
Point your browser to your n8n URL.
Optional configuration for different nodes
MongoDB node
If you intend to use the MongoDB node, you first need to set up MongoDB on your uberspace. This guide assumes you have also set up the optional .mongorc.js file as in the guide.
Choose a name for the database <MONGODB_NAME> that n8n can use, together with username <MONGODB_USER> and password <MONGODB_PASSWORD>. Then start the MongoDB CLI and create the user:
db.createUser(
{
user: "<MONGODB_USER>",
pwd: "<MONGODB_PASSWORD>",
roles:[{
role: "readWrite",
db:"<MONGODB_NAME>"
}]
})
Then, in n8n you can create new credentials of type MongoDB. If you didn't change the MongoDB configuration you can leave the values for Host as localhost and Port as 27017. Enter <MONGODB_NAME> for Database, <MONGODB_USER> for User and <MONGODB_PASSWORD> for Password. You should now be able to use the MongoDB node in your workflows.
Send Email node
To use the Send Email node with your uberspace mailbox, create new credentials of type SMTP in n8n. Disable SSL/TLS. Use your access settings as described here:
- User:
$MAILBOX@$USER.uberspace.de - Host:
$SERVER.uberspace.de - Port:
587
Webhook node
The n8n.ini-file above defines the WEBHOOK_TUNNEL_URL, so that the n8n frontend displays the Webhook URLs correctly. If you want to access your webhooks from another webpage https://other.webpage, you need to set the corresponding web header:
uberspace web header set / Access-Control-Allow-Origin https://other.webpage
thank you for your guide!
after following it, i get this error:
Initializing n8n process
There was an error initializing DB: "SQLite package has not been found installed. Try to install it: npm install sqlite3 --save"
Stopping n8n...
any idea?
@chrischma so i digged in a litte, it has sth todo with how sqlite is set up .. but i couldn't figure it out. BUT i managed to set it up with mysql.
setup a new msql data base and add this to n8n.ini
DB_TYPE=mysqldb,
DB_MYSQLDB_DATABASE=<DATABASE>,
DB_MYSQLDB_HOST=localhost,
DB_MYSQLDB_USER=<USERNAME>,
DB_MYSQLDB_PASSWORD=<your Mysql password>
I killed my n8n instance, which was running smooooth :D forgot about the updates, left the broken thing and now want to reinstall the newest version.
But now i just get npm "Killed" errors all the time. tried to install an older version (0.126.0), but this time with postgress in my n8n.ini but the service does not start. something like "Error: glob is no function" or sth.
if anybody wants to revamp that guide 👍 would be awesome