n8n Server on Digital Ocean
Prerequisites
- An active Digital Ocean account.
- A registered domain on Google Domains or similar domain provider.
Procedure
Step 1: Set Up Digital Ocean Docker Server
- Login to your Digital Ocean account at Digitalocean.com.
- Create a new project or select an existing project.
- Click on Create, then Droplets.
- Select your desired region.
- Under “Choose An image”, go to the Marketplace tab.
- Type “Docker” in the search bar and select the Docker image.
- Choose your CPU based on your usage requirements.
- Choose your authentication method (SSH is more secure than password).
- Type in a hostname that matches your desired subdomain.
- Click on Create Droplet and wait for the droplet to be created.
Step 2: Configure DNS Settings in Google Domains
- Copy the IP address assigned to the droplet to your clipboard.
- Open a new tab and go to domains.google.com.
- Select the domain name for the n8n server.
- Click on the DNS section.
- Click on Manage Custom Records.
- Click on Create New Record and enter the following:
- Click on SAVE.
- Verify the status of the DNS settings at dnschecker.org.
Step 3: Access Digital Ocean Console
- Go back to the Digital Ocean tab with the project folder.
- Click the 3 dots on the droplet and go to Access Console.
- Click on the Launch Droplet Console button to open a new window with a console.
Step 4: Clone n8n Repository and Configure Files
- Clone the n8n repository by running the following command in the console:
git clone https://github.com/n8n-io/n8n-docker-caddy.git
- Rename the folder to “n8n-digital-ocean” by running:
mv n8n-docker-caddy n8n-digital-ocean
- Change into the new folder using the following command:
cd n8n-digital-ocean
- Edit the .env file, docker-compose.yml, and Caddyfile according to the provided examples.
Step 5: Edit the .env file
Example File.env
- Open the .env file using the nano editor by running the following command:
nano .env
- Update the following variables in the .env file:
- DATA_FOLDER: Set this to the path of your data folder (e.g.,
/root/n8n-digital-ocean
). - DOMAIN_NAME: Set this to your domain name (e.g.,
example.com
). - SUBDOMAIN: Set this to your desired subdomain (e.g.,
n8nserver
). - N8N_BASIC_AUTH_USER: Set this to your desired username for accessing the n8n server.
- N8N_BASIC_AUTH_PASSWORD: Set this to your desired password for accessing the n8n server.
- SSL_EMAIL: Set this to your email address for SSL certificate creation.
- DATA_FOLDER: Set this to the path of your data folder (e.g.,
Save the changes and exit the editor by pressing Ctrl + X
, followed by Y
, and then Enter
.
Step 6: Edit the docker-compose.yml file
- Open the docker-compose.yml file using the nano editor by running the following command:
nano docker-compose.yml
- Under the “environment” section, add the following line after the “GENERIC_TIMEZONE” line:
- EXECUTIONS_PROCESS=main
This configuration helps with the n8n server performance.
Save the changes and exit the editor by pressing Ctrl + X
, followed by Y
, and then Enter
.
Step 7: Edit the Caddyfile in the caddy_config folder
- Open the Caddyfile using the nano editor by running the following command:
nano caddy_config/Caddyfile
- Update the first line of the Caddyfile to match your subdomain, but keep the “{” character. For example:
n8nserver.example.com {
- Make sure that the “reverse_proxy” section is properly configured to point to the n8n server with the correct port number:
reverse_proxy n8n:5678 { flush_interval -1 }
Save the changes and exit the editor by pressing Ctrl + X
, followed by Y
, and then Enter
.
After completing these steps, you have successfully edited the .env file, docker-compose.yml, and Caddyfile according to the provided examples. This configuration ensures that your n8n server is set up with the correct domain, subdomain, and environment settings.
Step 8: Open Firewall Ports and Start n8n Server
- Open the firewall ports by running the following commands:
sudo ufw allow 80 sudo ufw allow 443
- Start the n8n server app by running:
docker compose up -d
Step 9: Access the n8n Server
- Open a web browser and navigate to your configured subdomain.
- Log in using the N8N_BASIC_AUTH_USER and N8N_BASIC_AUTH_PASSWORD configured in the .env file.
How to update.
log into n8n server on digital ocean.
start console
go into n8n image folder
use command
docker pull n8nio/n8n:latest
More Commands:
// Pull latest (stable) version docker pull docker.n8n.io/n8nio/n8n
// Pull specific version docker pull docker.n8n.io/n8nio/n8n:0.220.1
// Pull next (unstable) version docker pull docker.n8n.io/n8nio/n8n:next