Getting Started with n8n on Scalingo
n8n is an open-source workflow automation tool that lets you connect apps,
APIs, and databases without heavy coding. It works like a visual editor where
you drag, drop, and link nodes to create automated workflows. It supports
both scheduled and event-driven automations.
n8n can interact with more than 200 services, and allows to run custom scripts
or API calls when necessary, making it a great solution for data syncing,
process automation, or no-code integrations.
Planning your Deployment
-
By default, n8n uses SQLite to save credentials, past executions, and workflows. Since using SQLite on Scalingo is not an option, you’ll have to provision a Scalingo for PostgreSQL® addon. We usually advise to start with a Scalingo for PostgreSQL® Starter or Business 512 addon, and change for a more powerful plan later if need be.
-
Depending on several factors such as the amount of data processed by your n8n workflows, the way your workflows are built, and the number of workflows you run at the same time, n8n can consume a lot of RAM. We usually advise to start with an XL container, and change for a more or less powerful plan later, depending on your usage.
-
The Enterprise edition of n8n provides some interesting features, such as custom variables, external secrets, Single Sign-On, version control with Git, or muti-main mode. Depending on your use case, purchasing an Enterprise license might really worth it. See full comparison for more details.
Deployment Example
At Scalingo we are using n8n everyday to run tedious tasks. These tasks handle quite a lot of data, and save us a lot of time. Since we rely on it for our business, we also want to have a resilient and effective solution.
Our current setup is as follow:
- We are running an Enterprise edition, so we can benefit from all the nice features.
- We are running in queue mode, with a multi-main setup, which allows us to scale-out when needed, and have better performances.
- 2 x 2XL containers for the
web
process type - 2 x 2XL containers for the
worker
process type, which handle our queues - 1 x Scalingo for PostgreSQL® Business 2G addon
- 1 x Scalingo for Caching Business 1G addon
Deploying
Using our One-Click Deploy Button
Click the One-Click Deploy button belowto automatically deploy n8n with your Scalingo account:
Using the Command Line
We maintain a repository called n8n-scalingo on GitHub to help you deploy n8n on Scalingo. Here are the few additional steps you will need to follow:
-
Clone our repository:
git clone https://github.com/Scalingo/n8n-scalingo cd n8n-scalingo
-
Create the application on Scalingo:
scalingo create my-n8n
Notice that our Command Line automatically detects the git repository, and adds a git remote to Scalingo:
git remote -v origin https://github.com/Scalingo/n8n-scalingo (fetch) origin https://github.com/Scalingo/n8n-scalingo (push) scalingo git@ssh.osc-fr1.scalingo.com:my-n8n.git (fetch) scalingo git@ssh.osc-fr1.scalingo.com:my-n8n.git (push)
-
Provision a Scalingo for PostgreSQL® Starter 512 addon:
scalingo --app my-n8n addons-add postgresql postgresql-starter-512
-
(optional) Instruct the platform to run the
web
process type in a single XL container:scalingo --app my-n8n scale web:1:XL
-
Set a few mandatory environment variables:
These must be set with the given values:scalingo --app my-n8n env-set N8N_PORT=\$PORT scalingo --app my-n8n env-set N8N_PROTOCOL=https scalingo --app my-n8n env-set DB_TYPE=postgresdb
When running in queue mode, the following one must be set:
scalingo --app my-n8n env-set N8N_ENCRYPTION_KEY=<SOME RANDOM STRING>
-
Everything’s ready, deploy to Scalingo:
git push scalingo master
Using the Terraform Provider
-
Start by forking our n8n repository
-
Place the following block in your Terraform file to create the app:
resource "scalingo_app" "my-n8n" { name = "my-n8n" stack_id = "scalingo-22" force_https = true environment = { N8N_PROTOCOL = "https", N8N_PORT = "$PORT", DB_TYPE = "postgresdb", N8N_ENCRYPTION_KEY = "<SOME RANDOM STRING>" } }
-
Link the app to your forked repository:
data "scalingo_scm_integration" "github" { scm_type = "github" } resource "scalingo_scm_repo_link" "default" { auth_integration_uuid = data.scalingo_scm_integration.github.id app = scalingo_app.my-n8n.id source = "https://github.com/<username>/n8n-scalingo" branch = "master" }
-
Provision a Scalingo for PostgreSQL® Starter 512 addon and attach it to your app:
resource "scalingo_addon" "my-n8n-postgresql" { app = scalingo_app.my-n8n.id provider_id = "postgresql" plan = "postgresql-starter-512" }
-
(optional) Instruct the platform to run the
web
process type in a single XL container:resource "scalingo_container_type" "web" { app = scalingo_app.my-n8n.id name = "web" size = "XL" amount = 1 }
-
Run
terraform plan
and check if the result looks good -
If so, run
terraform apply
-
Once Terraform is done, your n8n instance is ready to be deployed:
- Head to your dashboard
- Click on your n8n application
- Click on the Deploy tab
- Click on Manual deployment in the left menu
- Click the Trigger deployment button
- After a few seconds, your n8n instance is finally up and running!
Updating
n8n is a Node.js application, distributed via its own package called n8n
.
Updating to a newer version mainly consists in updating your requirements in
the package.json
file of your n8n repository.
-
In your n8n repository, ask
npm
to bump the n8n package version:
To update to thelatest
version:npm install n8n --package-lock-only
To update to the
next
version:npm install n8n@next --package-lock-only
To update to a specific version:
npm install n8n@<version> --package-lock-only
-
Commit the update:
git add package.json git add package-lock.json git commit -m "Upgrade to ..."
Using the Command Line
- Make sure you’ve successfully followed the first steps
- Push the changes to Scalingo:
git push scalingo master
Using the Terraform Provider
- Make sure you’ve successfully followed the first steps
-
Push the changes to your repository:
git push origin master
- Head to your dashboard
- Click on your n8n application
- Click on the Deploy tab
- Click on Manual deployment in the left menu
- Click the Trigger deployment button
- After a few seconds, your updated n8n instance is ready!
Customizing
Environment
n8n supports a lot of environment variables.