Skip to content

mox8/local-n8n

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Local n8n

A Docker-based setup for running n8n locally with nginx as a reverse proxy and ngrok for exposing webhooks to the internet.

Description

This project provides a complete, production-ready n8n workflow automation environment:

  • n8n — Workflow automation platform
  • nginx — Reverse proxy in front of n8n (port 80)
  • ngrok — Exposes the local instance via a public HTTPS URL for webhooks and external integrations

Data is persisted in Docker volumes, and workflows/credentials can be backed up to the n8n-data/ directory.


Environment Variables

Copy .env.example to .env and configure the following variables:

Variable Description
NGROK_AUTHTOKEN Your ngrok authentication token. Required for the ngrok container to tunnel traffic.
SUBDOMAIN Your ngrok reserved domain (e.g. my-app.ngrok-free.dev). Used for the public webhook URL.
N8N_ENCRYPTION_KEY Secret key used by n8n to encrypt credentials in the database. Use a strong, unique value in production.
WEBHOOK_URL Base URL for n8n webhooks. Typically https://${SUBDOMAIN} so webhooks use your ngrok domain.

Steps to Launch

Prerequisites

  • Docker and Docker Compose
  • An ngrok account and reserved domain (for webhooks)

1. Configure environment

cp .env.example .env

Edit .env and set:

  • NGROK_AUTHTOKEN — from your ngrok dashboard
  • SUBDOMAIN — your ngrok domain (e.g. my-app.ngrok-free.dev)
  • N8N_ENCRYPTION_KEY — a strong random string

2. Start the stack

make up

This builds and starts the containers, then follows logs. Press Ctrl+C to stop following logs; containers keep running.

3. Access n8n


Import and Export Data

Export (backup)

Export all workflows and credentials to n8n-data/:

make export

Creates:

  • n8n-data/workflows_all.json — all workflows
  • n8n-data/credentials_all.json — all credentials (encrypted with N8N_ENCRYPTION_KEY)

Import (restore)

Import from the backup files in n8n-data/:

make import

Imports:

  1. Workflows from n8n-data/workflows_all.json
  2. Credentials from n8n-data/credentials_all.json

Note: Use the same N8N_ENCRYPTION_KEY as when the credentials were exported, or decryption will fail.

Manual export/import

You can also run n8n CLI commands directly inside the container:

# Export workflows
docker compose exec n8n n8n export:workflow --all --output=/home/node/n8n-data/workflows_all.json

# Export credentials
docker compose exec n8n n8n export:credentials --all --output=/home/node/n8n-data/credentials_all.json

# Import workflows
docker compose exec n8n n8n import:workflow --input=/home/node/n8n-data/workflows_all.json

# Import credentials
docker compose exec n8n n8n import:credentials --input=/home/node/n8n-data/credentials_all.json

Make Commands

Command Description
make help Show available commands
make up Start containers and follow logs
make logs Start containers logs
make down Stop all containers
make downv Stop containers and remove volumes (deletes all data)
make export Export workflows and credentials to n8n-data/
make import Import workflows and credentials from n8n-data/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages