introduce
Automating workflows has become an essential part of the modern enterprise, and n8n is a powerful, self-hosted automation tool that streamlines the process. In this guide, we’ll walk you through setting up n8n on a DigitalOcean Droplet using Docker and Caddy, ensuring a secure and efficient deployment.
Prerequisites
Before we begin, please make sure you have the following:
- A DigitalOcean account
- Basic knowledge of Linux commands
- Domains and subdomains are ready for you to set up
Step 1: Create DigitalOcean Droplet
- Log in to your DigitalOcean account.
- Select a project or create a new one.
- Navigate to Administration > Droplets > Create Droplet.
- choose docker Image from the Market tab.
- Choose a plan based on your resource needs (the Basic Shared CPU plan is usually sufficient).
- Complete the Droplet setup and note the IP address.
Step 2: Secure your Droplet
Log in to your new Droplet via SSH:
ssh root@
Create a new user to manage n8n:
adduser
usermod -aG sudo
Log out and log back in as a new user:
ssh @
Step 3: Clone the n8n Docker repository
Clone n8n Docker settings using Caddy:
git clone https://github.com/n8n-io/n8n-docker-caddy.git
cd n8n-docker-caddy
Step 4: Create Docker volume
Set up persistent storage for Caddy and n8n:
sudo docker volume create caddy_data
sudo docker volume create n8n_data
Step 5: Configure Firewall
Allow HTTP and HTTPS traffic:
sudo ufw allow 80
sudo ufw allow 443
Step 6: Update environment variables
Create or update your .env
document:
DATA_FOLDER=/home//n8n-docker-caddy
SUBDOMAIN=n8n
DOMAIN=yourdomain.com
GENERIC_TIMEZONE="Asia/Kuala_Lumpur"
replace
and yourdomain.com
and your user and domain details.
Step 7: Update Caddyfile
Open caddy_config/Caddyfile
And add your subdomain configuration:
n8n.yourdomain.com {
reverse_proxy n8n:5678 {
flush_interval -1
}
}
Save and close the file.
Step 8: Start the Docker container
Bring up the container:
sudo docker-compose up -d
Step 9: Visit n8n
Open a browser and navigate to:
https://n8n.yourdomain.com
You should now see the n8n interface.
in conclusion
Congratulations! You have successfully deployed n8n on DigitalOcean using Docker and Caddy. With this setup, you can now start building and managing automated workflows efficiently.
For more details and troubleshooting, see n8n documentation.
photography: Codioful (formerly known as Gradienta) exist Not splashed