Docker/Compose/N8N: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
No edit summary
 
Line 1: Line 1:
==N8N » Volume==
==N8N » Volume==
{|class='wikitable mw-collapsible'
{|class='wikitable mw-collapsible' style='width:100%;margin:3px 0'
!scope='col' style='width:1000px'|
!scope='col' style='text-align:left' colspan='2'|
'''N8N » Volume'''
N8N » Volume
|-
|-
|valign='top'|
|valign='top' style='width:50%'|
<syntaxhighlight lang="bash">
<syntaxhighlight style='margin:3px 0' lang='bash'>
ssh -qt -i ~/.ssh/cid.chorke.org_ed25519 chorke@linode-aa.public.ip bash
ssh -qt -i ~/.ssh/cid.chorke.org_ed25519 chorke@linode-aa.public.ip bash
cat <<'EXE'| sudo bash
cat <<'EXE'| sudo bash
Line 14: Line 14:
EXE
EXE
</syntaxhighlight>
</syntaxhighlight>
|valign='top' style='width:50%'|
|}
|}


==N8N » Secret==
==N8N » Secret==
{|class='wikitable mw-collapsible mw-collapsed'
{|class='wikitable mw-collapsible' style='width:100%;margin:3px 0'
!scope='col' style='width:1000px'|
!scope='col' style='text-align:left' colspan='2'|
'''N8N » Secret'''
N8N » Secret
|-
|-
|valign='top'|
|valign='top' style='width:50%'|
<syntaxhighlight lang="bash">
<syntaxhighlight style='margin:3px 0' lang='bash'>
makepasswd --chars 16 --count 5 --crypt-md5
makepasswd --chars 16 --count 5 --crypt-md5
:'
:'
Line 32: Line 33:
'
'
</syntaxhighlight>
</syntaxhighlight>
|valign='top' style='width:50%'|
|}
|}


==N8N » Caddyfile==
==N8N » Caddyfile==
{|class='wikitable mw-collapsible mw-collapsed'
{|class='wikitable mw-collapsible mw-collapsed' style='width:100%;margin:3px 0'
!scope='col' colspan='2' style='width:1000px'|
!scope='col' style='text-align:left' colspan='2'|
'''N8N » Caddyfile'''
N8N » Caddyfile
|-
|-
|valign='top' colspan='2'|
|valign='top' style='width:50%'|
<syntaxhighlight lang="bash">
<syntaxhighlight style='margin:3px 0' lang='bash'>
cat <<'INI' | sudo tee /etc/n8n.shahed.biz/caddy/Caddyfile >/dev/null
cat <<'INI' | sudo tee /etc/n8n.shahed.biz/caddy/Caddyfile >/dev/null
n8n.shahed.biz {
n8n.shahed.biz {
Line 49: Line 51:
INI
INI
</syntaxhighlight>
</syntaxhighlight>
|valign='top' style='width:50%'|
|-
|-
|valign='top' style='width:490px'|
|valign='top'|
; ✅ When to use ''Caddy''?
; ✅ When to use ''Caddy''?
:* When you want '''fast setup''' with '''HTTPS out-of-the-box'''
:* When you want '''fast setup''' with '''HTTPS out-of-the-box'''
Line 56: Line 59:
:* When you want '''simpler config files''' (especially for small teams)
:* When you want '''simpler config files''' (especially for small teams)


|valign='top' style='width:490px'|
|valign='top'|
; 🧠 Relationship with ''n8n''
; 🧠 Relationship with ''n8n''
:* '''It does not require Caddy'''
:* '''It does not require Caddy'''
Line 64: Line 67:


==N8N » Environment==
==N8N » Environment==
{|class='wikitable mw-collapsible mw-collapsed'
{|class='wikitable mw-collapsible mw-collapsed' style='width:100%;margin:3px 0'
!scope='col' style='width:1000px'|
!scope='col' style='text-align:left' colspan='2'|
'''N8N » Environment'''
N8N » Environment
|-
|-
|valign='top'|
|valign='top' style='width:50%'|
<syntaxhighlight lang="properties">
<syntaxhighlight style='margin:3px 0' lang='properties'>
cat <<'ENV' | sudo tee /etc/n8n.shahed.biz/.env >/dev/null
cat <<'ENV' | sudo tee /etc/n8n.shahed.biz/.env >/dev/null
N8N_DB_PASSWORD=gLn5tbVIdzY0K3AJ
N8N_DB_PASSWORD=gLn5tbVIdzY0K3AJ
Line 84: Line 87:
sudo chmod 600 /etc/n8n.shahed.biz/.env
sudo chmod 600 /etc/n8n.shahed.biz/.env
</syntaxhighlight>
</syntaxhighlight>
|valign='top' style='width:50%'|
|}
|}


==N8N » Docker » Compose==
==N8N » Docker » Compose==
{|class='wikitable mw-collapsible'
{|class='wikitable mw-collapsible' style='width:100%;margin:3px 0'
!scope='col' style='width:1000px'|
!scope='col' style='text-align:left' colspan='2'|
'''N8N » Docker » Compose'''
N8N » Docker » Compose
|-
|-
|valign='top'|
|valign='top' style='width:50%'|
<syntaxhighlight lang="yaml">
<syntaxhighlight style='margin:3px 0' lang='yaml'>
cat <<'YML' | sudo tee /etc/n8n.shahed.biz/docker-compose.yml >/dev/null
cat <<'YML' | sudo tee /etc/n8n.shahed.biz/docker-compose.yml >/dev/null
---
---
Line 191: Line 195:
YML
YML
</syntaxhighlight>
</syntaxhighlight>
|valign='top' style='width:50%'|
|}
|}


==N8N » Docker » Manage==
==N8N » Docker » Manage==
{|class='wikitable mw-collapsible'
{|class='wikitable mw-collapsible' style='width:100%;margin:3px 0'
!scope='col' style='width:1000px'|
!scope='col' style='text-align:left' colspan='2'|
'''N8N » Docker » Compose » Manage'''
N8N » Docker » Compose » Manage
|-
|-
|valign='top'|
|valign='top' style='width:50%'|
<syntaxhighlight lang="bash">
<syntaxhighlight style='margin:3px 0' lang='bash'>
ssh -qt -i ~/.ssh/cid.chorke.org_ed25519 chorke@linode-aa.public.ip bash
ssh -qt -i ~/.ssh/cid.chorke.org_ed25519 chorke@linode-aa.public.ip bash
sudo su
sudo su
Line 214: Line 219:
xdg-open https://n8n.shahed.biz
xdg-open https://n8n.shahed.biz
</syntaxhighlight>
</syntaxhighlight>
|valign='top' style='width:50%'|
|}
|}


==N8N » Console » Login==
==N8N » Console » Login==
{|class='wikitable mw-collapsible mw-collapsed'
{|class='wikitable mw-collapsible mw-collapsed' style='width:100%;margin:3px 0'
!scope='col' style='width:1000px'|
!scope='col' style='text-align:left' colspan='2'|
'''N8N » Console » Login'''
N8N » Console » Login
|-
|-
|valign='top'|
|valign='top' style='width:50%'|
<syntaxhighlight lang="yaml">
<syntaxhighlight style='margin:3px 0' lang='yaml'>
---
---
Page: https://n8n.shahed.biz
Page: https://n8n.shahed.biz
Line 228: Line 234:
pass: ypBAMGHp1j8QJKU7
pass: ypBAMGHp1j8QJKU7
</syntaxhighlight>
</syntaxhighlight>
|valign='top' style='width:50%'|
|}
|}


==References==
==References==
{|
{|class='wikitable mw-collapsible' style='width:100%;margin:3px 0'
|valign='top'|
!scope='col' style='text-align:left' colspan='3'|
References
|-
|valign='top' style='width:33%'|
* [https://community.n8n.io/t/reset-admin-password-on-locally-hosted-n8n/48836 n8n » Reset Admin Password]
* [https://community.n8n.io/t/reset-admin-password-on-locally-hosted-n8n/48836 n8n » Reset Admin Password]
* [https://github.com/n8n-io/n8n n8n » SCM » Upstream]
* [https://github.com/n8n-io/n8n n8n » SCM » Upstream]
Line 241: Line 251:
* [https://n8n.io/ n8n]
* [https://n8n.io/ n8n]


|valign='top'|
|valign='top' style='width:34%'|
 
|valign='top'|


|-
|valign='top' style='width:33%'|
|colspan='3'|
----
|-
|-
|valign='top'|
|valign='top'|
Line 258: Line 264:


|valign='top'|
|valign='top'|
|-
|colspan='3'|
----
|-
|-
|valign='top'|
|valign='top'|

Latest revision as of 10:36, 15 January 2026

N8N » Volume

N8N » Volume

ssh -qt -i ~/.ssh/cid.chorke.org_ed25519 chorke@linode-aa.public.ip bash
cat <<'EXE'| sudo bash
mkdir -p           /{etc,var}/n8n.shahed.biz/
mkdir -p           /etc/n8n.shahed.biz/caddy/
mkdir -p           /var/n8n.shahed.biz/{n8n,postgres,caddy/{conf,data,files}}
chown -R 1000:1000 /var/n8n.shahed.biz/{n8n,caddy,postgres}/
EXE

N8N » Secret

N8N » Secret

makepasswd --chars 16 --count 5 --crypt-md5
:'
gLn5tbVIdzY0K3AJ   $1$vUMUSy9W$XdzoyzZ/8pYghRbGWSeIg0
yx9SrGc7vsyvbnQU   $1$3A7k24lk$.8tqpJaYeJzyy8PZqzp3h0
ypBAMGHp1j8QJKU7   $1$P.ugq.Lv$roVoXJR1dFZ0e.GxjfjiF1
LCMnxYWVWgJ0AVA1   $1$dPoj6SuY$AEJMcY96R11tb4WP1njdk.
26IThiQhPxQSSed1   $1$3FHdqT0J$sm0ZxPCKBwKj2jaZsU1t.1
'

N8N » Caddyfile

N8N » Caddyfile

cat <<'INI' | sudo tee /etc/n8n.shahed.biz/caddy/Caddyfile >/dev/null
n8n.shahed.biz {
    reverse_proxy n8n:5678 {
      flush_interval -1
    }
}
INI
✅ When to use Caddy?
  • When you want fast setup with HTTPS out-of-the-box
  • When you're managing microservices or DevOps workflows
  • When you want simpler config files (especially for small teams)
🧠 Relationship with n8n
  • It does not require Caddy
  • It does not depend on any web server
  • n8n is a standalone workflow automation tool

N8N » Environment

N8N » Environment

cat <<'ENV' | sudo tee /etc/n8n.shahed.biz/.env >/dev/null
N8N_DB_PASSWORD=gLn5tbVIdzY0K3AJ
N8N_DB_USER=shahed_n8n
N8N_DB_NAME=shahed_n8n
N8N_FQDN=n8n.shahed.biz
N8N_RUNNERS_ENABLED=true
N8N_TIMEZONE=Asia/Kuala_Lumpur
N8N_CONF_DIR=/etc/n8n.shahed.biz/
N8N_DATA_DIR=/var/n8n.shahed.biz/
N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
ENV

sudo chmod 600 /etc/n8n.shahed.biz/.env

N8N » Docker » Compose

N8N » Docker » Compose

cat <<'YML' | sudo tee /etc/n8n.shahed.biz/docker-compose.yml >/dev/null
---
services:
  caddy:
    image: caddy:latest
    restart: unless-stopped
    ports:
      - 80:80
      - 443:443
    expose:
      - 80
      - 443
    volumes:
      - caddy_file:/etc/caddy/Caddyfile
      - caddy_files_dir:/files
      - caddy_data_dir:/data
      - caddy_conf_dir:/conf
  postgres:
    image: postgres:15
    container_name: n8n_postgres
    restart: unless-stopped
    environment:
      - POSTGRES_PASSWORD=${N8N_DB_PASSWORD}
      - POSTGRES_USER=${N8N_DB_USER}
      - POSTGRES_DB=${N8N_DB_NAME}
    volumes:
      - pgsql_data_dir:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U n8n"]
      interval: 10s
      timeout: 5s
      retries: 5
  n8n:
    image: docker.n8n.io/n8nio/n8n
    restart: always
    ports:
      - 127.0.0.1:5678:5678
    environment:
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_PORT=5432
      - DB_POSTGRESDB_HOST=postgres
      - DB_POSTGRESDB_USER=${N8N_DB_USER}
      - DB_POSTGRESDB_DATABASE=${N8N_DB_NAME}
      - DB_POSTGRESDB_PASSWORD=${N8N_DB_PASSWORD}
      - N8N_PORT=5678
      - N8N_HOST=${N8N_FQDN}
      - N8N_RUNNERS_ENABLED=${N8N_RUNNERS_ENABLED}
      - N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=${N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS}
      - GENERIC_TIMEZONE=${N8N_TIMEZONE}
      - WEBHOOK_URL=https://${N8N_FQDN}/
      - NODE_ENV=production
    volumes:
      - n8n_data_dir:/home/node/.n8n
      - caddy_files_dir:/files

volumes:
  n8n_data_dir:
    driver: local
    driver_opts:
      device: ${N8N_DATA_DIR}/n8n/
      type: none
      o: bind
  pgsql_data_dir:
    driver: local
    driver_opts:
      device: ${N8N_DATA_DIR}/postgres/
      type: none
      o: bind
  caddy_conf_dir:
    driver: local
    driver_opts:
      device: ${N8N_DATA_DIR}/caddy/conf/
      type: none
      o: bind
  caddy_data_dir:
    driver: local
    driver_opts:
      device: ${N8N_DATA_DIR}/caddy/data/
      type: none
      o: bind
  caddy_files_dir:
    driver: local
    driver_opts:
      device: ${N8N_DATA_DIR}/caddy/files/
      type: none
      o: bind
  caddy_file:
    driver: local
    driver_opts:
      device: ${N8N_CONF_DIR}/caddy/Caddyfile
      type: none
      o: bind

networks:
  n8n:
    external: false
YML

N8N » Docker » Manage

N8N » Docker » Compose » Manage

ssh -qt -i ~/.ssh/cid.chorke.org_ed25519 chorke@linode-aa.public.ip bash
sudo su

systemctl disable --now nginx
cd /etc/n8n.shahed.biz/
systemctl status nginx

docker compose down
docker compose up -d
docker compose logs -ft

xdg-open https://www.cdn77.com/tls-test/result?domain=n8n.shahed.biz
xdg-open https://n8n.shahed.biz

N8N » Console » Login

N8N » Console » Login

---
Page: https://n8n.shahed.biz
user: tool.tech@chorke.org
pass: ypBAMGHp1j8QJKU7

References

References