Installing n8n on Ubuntu
What is n8n?
n8n is an extendable workflow automation tool. With a fair-code distribution model, n8n will always have visible source code, be available to self-host, and allow you to add your own custom functions, logic and apps. n8n's node-based approach makes it highly versatile, enabling you to connect anything to everything. -https://github.com/n8n-io/n8n
Installing n8n
sudo apt-get update && sudo apt-get upgrade
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
#sudo usermod -aG docker ${USER}
sudo reboot
Set DNS with your DNS provider like goDaddy:
Type: A Name: n8n (or the desired subdomain) IP address: <IP_OF_YOUR_SERVER>
Installation commands
make folder name n8n
mkdir n8n
cd n8n
Create a docker-compose.yml
file. Paste the following in the file:
version: "3.7"
services:
traefik:
image: "traefik"
restart: always
command:
- "--api=true"
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.web.http.redirections.entryPoint.to=websecure"
- "--entrypoints.web.http.redirections.entrypoint.scheme=https"
- "--entrypoints.websecure.address=:443"
- "--certificatesresolvers.mytlschallenge.acme.tlschallenge=true"
- "--certificatesresolvers.mytlschallenge.acme.email=${SSL_EMAIL}"
- "--certificatesresolvers.mytlschallenge.acme.storage=/letsencrypt/acme.json"
ports:
- "80:80"
- "443:443"
volumes:
- traefik_data:/letsencrypt
- /var/run/docker.sock:/var/run/docker.sock:ro
n8n:
image: docker.n8n.io/n8nio/n8n
restart: always
ports:
- "127.0.0.1:5678:5678"
labels:
- traefik.enable=true
- traefik.http.routers.n8n.rule=Host(`${SUBDOMAIN}.${DOMAIN_NAME}`)
- traefik.http.routers.n8n.tls=true
- traefik.http.routers.n8n.entrypoints=web,websecure
- traefik.http.routers.n8n.tls.certresolver=mytlschallenge
- traefik.http.middlewares.n8n.headers.SSLRedirect=true
- traefik.http.middlewares.n8n.headers.STSSeconds=315360000
- traefik.http.middlewares.n8n.headers.browserXSSFilter=true
- traefik.http.middlewares.n8n.headers.contentTypeNosniff=true
- traefik.http.middlewares.n8n.headers.forceSTSHeader=true
- traefik.http.middlewares.n8n.headers.SSLHost=${DOMAIN_NAME}
- traefik.http.middlewares.n8n.headers.STSIncludeSubdomains=true
- traefik.http.middlewares.n8n.headers.STSPreload=true
- traefik.http.routers.n8n.middlewares=n8n@docker
environment:
- N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
- N8N_PORT=5678
- N8N_PROTOCOL=https
- NODE_ENV=production
- WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
- GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
volumes:
- n8n_data:/home/node/.n8n
- /local-files:/files
volumes:
traefik_data:
external: true
n8n_data:
external: true
Create .env
file
.env
filenano .env
# The top level domain to serve from
DOMAIN_NAME=yoursite.com
# The subdomain to serve from
SUBDOMAIN=n8n
# DOMAIN_NAME and SUBDOMAIN combined decide where n8n will be reachable from
# above example would result in: https://n8n.bridgethings.com
# Optional timezone to set which gets used by Cron-Node by default
# If not set New York time will be used
GENERIC_TIMEZONE=asia/kolkata
# The email address to use for the SSL certificate creation
[email protected]
Create data folder
sudo docker volume create n8n_data
Create a volume for the Traefik data, This is defined as traefik_data
.
sudo docker volume create traefik_data
Run Docker
sudo docker compose up -d
Reference
Updating n8n
Read n8n documentation for fill instrctions
# 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
# Get the container ID
docker ps -a
# Stop the container with ID container_id
docker stop [container_id]
# Remove the container with ID container_id
docker rm [container_id]
sudo docker compose up -d
Previousinstalling wordpress on ubuntu (WordPress on Docker with remote NGINXProxyManager)NextTeaching 7 year kid about Embedded systems
Last updated