-
Notifications
You must be signed in to change notification settings - Fork 98
N8N #272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mattkgwhite
wants to merge
8
commits into
tailscale-dev:main
Choose a base branch
from
mattkgwhite:N8N
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+167
−0
Open
N8N #272
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
684c013
Add N8N to services
56b6e2a
Update N8N_HOST environment variable format
mattkgwhite db30b97
Merge branch 'main' into N8N
mattkgwhite e6dbd78
Merge branch 'main' into N8N
jackspiering 96ec797
N8N: Update file names to match the template
b599366
Merge branch 'N8N' of github.com:mattkgwhite/ScaleTail into N8N
8d70828
Updates to reflect template and mitigate some errors.
crypt0rr d55da7e
Merge branch 'main' into N8N
crypt0rr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| #version=1.1 | ||
| #URL=https://github.com/tailscale-dev/ScaleTail | ||
| #COMPOSE_PROJECT_NAME= # Optional: only use when running multiple deployments on the same infrastructure. | ||
|
|
||
| # Service Configuration | ||
| SERVICE=n8n | ||
| IMAGE_URL=docker.n8n.io/n8nio/n8n:stable | ||
| TAILNET_NAME= | ||
|
|
||
| # Network Configuration | ||
| SERVICEPORT=5678 # N8N default port | ||
| DNS_SERVER=9.9.9.9 | ||
|
|
||
| # Tailscale Configuration | ||
| TS_AUTHKEY= | ||
|
|
||
| # Optional Service variables | ||
| # PUID=1000 | ||
|
|
||
| # N8N Configuration variables | ||
| POSTGRES_USER= | ||
| POSTGRES_PASSWORD= | ||
| POSTGRES_DB= | ||
|
|
||
| POSTGRES_NON_ROOT_USER= | ||
| POSTGRES_NON_ROOT_PASSWORD= | ||
|
|
||
| N8N_ENCRYPTION_KEY= | ||
|
|
||
| TZ=Europe/London |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # SERVICE with Tailscale Sidecar Configuration | ||
|
|
||
| This Docker Compose configuration sets up [N8N](https://n8n.io/) with Tailscale as a sidecar container to keep the app reachable over your Tailnet. | ||
|
|
||
| ## SERVICE | ||
|
|
||
| [N8N](https://n8n.io/) a workflow automation platform that uniquely combines AI capabilities with business process automation, giving technical teams the flexibility of code with the speed of no code. | ||
|
|
||
| ## Configuration Overview | ||
|
|
||
| In this setup, the `tailscale-N8N` service runs Tailscale, which manages secure networking for SERVICE. The `SERVICE` service utilizes the Tailscale network stack via Docker's `network_mode: service:` configuration. This keeps the app Tailnet-only unless you intentionally expose ports. | ||
|
|
||
| For the folder structure you will need to pre-create the n8n-storage directory, and correct the ownership before the first run, by doing the following: | ||
|
|
||
| ```bash | ||
| mkdir -p n8n-storage | ||
| sudo chown -R 1000:1000 n8n-storage | ||
| ``` | ||
|
|
||
| ## What to document for users | ||
|
|
||
| In this setup, the tailscale-n8n service runs Tailscale, which manages secure networking for the N8N service. The N8N service uses the Tailscale network stack via Docker’s network_mode: service: configuration. This setup ensures that N8N management interface is only accessible through the Tailscale network (or locally, if preferred), providing an extra layer of security and privacy for managing your automations. | ||
|
|
||
| If you need the runners for N8N uncomment the following within the docker-compose.yaml file - `N8N_RUNNERS_MODE=external`, `N8N_RUNNERS_AUTH_TOKEN=${RUNNERS_AUTH_TOKEN}`, `N8N_RUNNERS_BROKER_LISTEN_ADDRESS=0.0.0.0` as well as uncommenting `RUNNERS_AUTH_TOKEN` within the .env file. | ||
|
|
||
| The configs section also needs to be updated to match the below. Specifically the Proxy port needs changing from 8080 to 5678 | ||
|
|
||
| ``` | ||
| configs: | ||
| ts-serve: | ||
| content: | | ||
| {"TCP":{"443":{"HTTPS":true}}, | ||
| "Web":{"$${TS_CERT_DOMAIN}:443": | ||
| {"Handlers":{"/": | ||
| {"Proxy":"http://127.0.0.1:5678"}}}}, | ||
| "AllowFunnel":{"$${TS_CERT_DOMAIN}:443":false}} | ||
| ``` |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please follow the template and change the filename to 'compose.yaml'.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, Updated the file name to match the template as requested |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| configs: | ||
| ts-serve: | ||
| content: | | ||
| {"TCP":{"443":{"HTTPS":true}}, | ||
| "Web":{"$${TS_CERT_DOMAIN}:443": | ||
| {"Handlers":{"/": | ||
| {"Proxy":"http://127.0.0.1:5678"}}}}, | ||
| "AllowFunnel":{"$${TS_CERT_DOMAIN}:443":false}} | ||
|
|
||
| services: | ||
| # Make sure you have updated/checked the .env file with the correct variables. | ||
| # All the ${ xx } need to be defined there. | ||
| # Tailscale Sidecar Configuration | ||
| tailscale: | ||
| image: tailscale/tailscale:latest # Image to be used | ||
| container_name: tailscale-${SERVICE} # Name for local container management | ||
| hostname: ${SERVICE} # Name used within your Tailscale environment | ||
| environment: | ||
| - TS_AUTHKEY=${TS_AUTHKEY} | ||
| - TS_STATE_DIR=/var/lib/tailscale | ||
| - TS_SERVE_CONFIG=/config/serve.json # Tailscale Serve configuration to expose the web interface on your local Tailnet - remove this line if not required | ||
| - TS_USERSPACE=false | ||
| - TS_ENABLE_HEALTH_CHECK=true # Enable healthcheck endpoint: "/healthz" | ||
| - TS_LOCAL_ADDR_PORT=127.0.0.1:41234 # The <addr>:<port> for the healthz endpoint | ||
| #- TS_ACCEPT_DNS=true # Uncomment when using MagicDNS | ||
| - TS_AUTH_ONCE=true | ||
| configs: | ||
| - source: ts-serve | ||
| target: /config/serve.json | ||
| volumes: | ||
| - ./config:/config # Config folder used to store Tailscale files - you may need to change the path | ||
| - ./ts/state:/var/lib/tailscale # Tailscale requirement - you may need to change the path | ||
| devices: | ||
| - /dev/net/tun:/dev/net/tun # Network configuration for Tailscale to work | ||
| cap_add: | ||
| - net_admin # Tailscale requirement | ||
| #ports: | ||
| # - 0.0.0.0:${SERVICEPORT}:${SERVICEPORT} # Binding port ${SERVICE}PORT to the local network - may be removed if only exposure to your Tailnet is required | ||
| # If any DNS issues arise, use your preferred DNS provider by uncommenting the config below | ||
| # dns: | ||
| # - ${DNS_SERVER} | ||
| healthcheck: | ||
| test: ["CMD", "wget", "--spider", "-q", "http://127.0.0.1:41234/healthz"] # Check Tailscale has a Tailnet IP and is operational | ||
| interval: 1m # How often to perform the check | ||
| timeout: 10s # Time to wait for the check to succeed | ||
| retries: 3 # Number of retries before marking as unhealthy | ||
| start_period: 10s # Time to wait before starting health checks | ||
| restart: always | ||
|
|
||
| postgres: | ||
| container_name: n8n-postgres | ||
| image: postgres:16 | ||
| restart: always | ||
| environment: | ||
| - POSTGRES_USER | ||
| - POSTGRES_PASSWORD | ||
| - POSTGRES_DB | ||
| - POSTGRES_NON_ROOT_USER | ||
| - POSTGRES_NON_ROOT_PASSWORD | ||
| volumes: | ||
| - ./${SERVICE}-db:/var/lib/postgresql/data | ||
| - ./init-data.sh:/docker-entrypoint-initdb.d/init-data.sh | ||
| healthcheck: | ||
| test: ['CMD-SHELL', 'pg_isready -h localhost -U ${POSTGRES_USER} -d ${POSTGRES_DB}'] | ||
| interval: 5s | ||
| timeout: 5s | ||
| retries: 10 | ||
|
|
||
| application: | ||
| image: ${IMAGE_URL} | ||
| network_mode: service:tailscale # Sidecar configuration to route ${SERVICE} through Tailscale | ||
| container_name: app-${SERVICE} | ||
| restart: unless-stopped | ||
| #ports: | ||
| # - 0.0.0.0:${SERVICEPORT}:${SERVICEPORT} # Binding port ${SERVICE}PORT to the local network - may be removed if only exposure to your Tailnet is required | ||
| # If any DNS issues arise, use your preferred DNS provider by uncommenting the config below | ||
| #dns: | ||
| # - ${DNS_SERVER} | ||
| volumes: | ||
| - ./${SERVICE}-storage:/home/node/.n8n | ||
| environment: | ||
| - N8N_HOST=n8n.${TAILNET_NAME} | ||
| - N8N_PORT=5678 | ||
| - N8N_PROTOCOL=https | ||
| - N8N_ENCRYPTION_KEY=${N8N_ENCRYPTION_KEY} | ||
| - N8N_RUNNERS_ENABLED=true | ||
| - N8N_BLOCK_ENV_ACCESS_IN_NODE=true | ||
| - N8N_GIT_NODE_DISABLE_BARE_REPOS=true | ||
| - NODE_ENV=production | ||
| - WEBHOOK_URL=https://${TAILNET_NAME}/ | ||
| - DB_TYPE=postgresdb | ||
| - DB_POSTGRESDB_HOST=postgres | ||
| - DB_POSTGRESDB_PORT=5432 | ||
| - DB_POSTGRESDB_DATABASE=${POSTGRES_DB} | ||
| - DB_POSTGRESDB_USER=${POSTGRES_NON_ROOT_USER} | ||
| - DB_POSTGRESDB_PASSWORD=${POSTGRES_NON_ROOT_PASSWORD} | ||
| # - N8N_RUNNERS_MODE=external | ||
| # - N8N_RUNNERS_AUTH_TOKEN=${RUNNERS_AUTH_TOKEN} | ||
| # - N8N_RUNNERS_BROKER_LISTEN_ADDRESS=0.0.0.0 | ||
| links: | ||
| - postgres | ||
| depends_on: | ||
| postgres: | ||
| condition: service_healthy |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow the template and change the filename to '.env'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, Updated the file name to match the template as requested