Skip to content
This repository was archived by the owner on Aug 23, 2025. It is now read-only.
/ tun8n Public archive

πŸš€ Tun8n - Dockerized n8n with Ngrok integration for instant webhook exposure. Deploy your automation workflows in minutes with custom domain support.

Notifications You must be signed in to change notification settings

ahmadrizal1st/tun8n

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

77 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Tun8n - N8N + Ngrok Docker Starter

A complete CLI tool to create and manage n8n (workflow automation) with Docker and expose it to the internet using Ngrok with custom domain support.

πŸš€ Features

  • βœ… Easy CLI Setup - Create new projects with one command
  • βœ… n8n latest version with Docker Compose
  • βœ… Ngrok integration with custom domain support
  • βœ… Secure environment variables handling
  • βœ… Health checks and auto-restart
  • βœ… Persistent data storage
  • βœ… Multi-platform support (macOS, Windows, Linux)
  • βœ… Complete CLI interface for easy management
  • βœ… Automatic script management with proper permissions
  • βœ… Environment validation and error checking
  • βœ… Fallback mechanisms for robust operation

πŸ“¦ Installation

Method 1: Install via npm (Recommended)

# Install globally or from the latest GitHub version
npm install -g tun8n@latest
npm install github:ahmadrizal1st/tun8n

# Verify installation
tun8n --version
tun8n -v

Method 2: Manual Setup (if preferred)

# Clone the repository
git clone https://github.com/ahmadrizal1st/tun8n.git
cd tun8n

# Install dependencies(optional)
npm install

# Link for local development
npm link

πŸš€ Quick Start

1. Create a New Project

# Create new n8n project
tun8n create my-automation-project

# Navigate to project
cd my-automation-project

2. Initialize Environment

# Setup environment configuration
tun8n init

# Edit .env file with your settings
nano .env  # or use your favorite editor

3. Configure Environment

Edit the .env file:

# Ngrok Configuration
NGROK_AUTHTOKEN=your_ngrok_auth_token_here
NGROK_DOMAIN=your_custom_domain.ngrok-free.app  # Optional for paid plans

# n8n Configuration
N8N_PORT=5678
N8N_PROTOCOL=http
WEBHOOK_URL=your_ngrok_url
TZ=Asia/Jakarta

# Optional: Basic Auth (recommended)
# N8N_BASIC_AUTH_USER=admin
# N8N_BASIC_AUTH_PASSWORD=secure_password_here

⚠️ IMPORTANT: Get your Ngrok auth token from Ngrok Dashboard

4. Start Services

# Start n8n with Ngrok tunnel
tun8n start

πŸ› οΈ CLI Commands

Project Management

# Create new project
tun8n create <project-name>

# Initialize environment (create .env from template)
tun8n init

# Update to latest version
tun8n update

Service Control

# Start all services
tun8n start

# Check service status
tun8n status

# View debug information and logs
tun8n debug

# Stop all services
tun8n stop

Information

# Show version
tun8n --version
tun8n -v

# Show help
tun8n --help

πŸ“‹ Prerequisites

Required Software

  • Docker - Install Guide
  • Docker Compose - Usually included with Docker Desktop
  • Node.js (v14+) - Only required for CLI tool

Ngrok Setup

  1. Create free account at ngrok.com
  2. Get your auth token from dashboard
  3. (Optional) Reserve custom domain for paid plans

πŸ”§ Project Structure

my-automation-project/
β”œβ”€β”€ docker-compose.yml    # Docker compose configuration
β”œβ”€β”€ .env                  # Environment variables (created by tun8n init)
β”œβ”€β”€ .env.example          # Environment template and dependencies
β”œβ”€β”€ .gitignore           # Git ignore rules
β”œβ”€β”€ package.json          # Project metadata
└── README.md            # Project documentation

🌐 Access Points

After starting services:

πŸ“Š Monitoring

Check Service Status

tun8n status

# Or manually
docker-compose ps
docker stats

View Logs

tun8n debug

# Or follow specific logs
docker-compose logs -f n8n-app
docker-compose logs -f n8n-ngrok

πŸ›‘ Stopping Services

Graceful Shutdown

# Using CLI
tun8n stop

# Using Docker directly
docker-compose down

Complete Cleanup

# Remove everything (including volumes)
docker-compose down -v

# Clean Docker system
docker system prune -f

πŸ” Troubleshooting

Common Issues

  1. Port 5678 already in use

    # Change N8N_PORT in .env file
    N8N_PORT=5679
  2. Ngrok authentication errors

  3. Docker permission issues (Linux)

    sudo usermod -aG docker $USER
    newgrp docker
  4. Script permission issues

    # Grant execute permissions to scripts
    chmod +x bin/scripts/*.js

Debug Commands

# Check Ngrok tunnel status
docker exec n8n-ngrok curl -s http://localhost:4040/api/tunnels | jq

# Test n8n health
curl http://localhost:5678/healthz

# View container logs
docker logs n8n-app --tail 50

πŸ”’ Security Notes

  1. Never commit .env file to version control
  2. Use strong passwords for basic authentication
  3. Regularly rotate Ngrok authentication tokens
  4. Monitor access logs frequently
  5. Consider VPN for production use

πŸ“ž Support

Useful Links

Getting Help

  1. Check logs: tun8n debug
  2. Verify Ngrok token is correct
  3. Ensure Docker is running
  4. Check port availability
  5. Validate environment variables: tun8n init and check .env file

🎯 Example Usage

# Complete workflow example
tun8n create my-n8n-project
cd my-n8n-project
tun8n init

# Edit .env with your Ngrok token and settings
nano .env

tun8n start
tun8n status

# When done working
tun8n stop

πŸ“ License

MIT License - feel free to use this project for your automation needs!


Happy Automating! πŸš€

For issues and contributions, please check the project repository.

πŸ”„ Changelog

Version 1.3.28

  • Enhanced CLI with better error handling and fallback mechanisms
  • Automatic script permissions management
  • Environment validation with helpful warnings
  • Improved project structure with dedicated scripts directory
  • Better Docker compatibility checks
  • Template-based .env initialization
  • Comprehensive .gitignore for security

Key Improvements

  • βœ… Automatic script permission setting (chmod 755)
  • βœ… Environment variable validation with warnings
  • βœ… Fallback to direct docker commands if scripts fail
  • βœ… Better error messages and user guidance
  • βœ… Template-based project creation with proper structure
  • βœ… Enhanced security with comprehensive .gitignore

Note: This tool automatically handles script permissions and provides fallback mechanisms for robust operation across different environments.

About

πŸš€ Tun8n - Dockerized n8n with Ngrok integration for instant webhook exposure. Deploy your automation workflows in minutes with custom domain support.

Topics

Resources

Stars

Watchers

Forks

Packages