Skip to content

ducconit/n8n-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

n8n Starter Template

Docker Compose configuration template for n8n with various options, using a shared .env file.

Structure

  • docker-compose.yml: Default Docker Compose configuration for n8n (full with PostgreSQL and Redis)
  • .env: File containing environment variables for configuration
  • compose-configs/: Directory containing customized Docker Compose configurations
    • docker-compose.n8n-only.yml: Run n8n with minimal configuration
    • docker-compose.n8n-sqlite.yml: Run n8n with SQLite
    • docker-compose.n8n-postgres.yml: n8n with PostgreSQL
    • docker-compose.n8n-redis.yml: n8n with Redis
  • start.bat: Script to easily select and run configurations on Windows
  • start.ps1: PowerShell script to easily select and run configurations on Windows
  • start.sh: Script to easily select and run configurations on Linux/macOS

Requirements

  • Docker and Docker Compose installed
  • Ports used (can be changed in the .env file):
    • n8n: 5678
    • PostgreSQL: 5432
    • Redis: 6379

Usage

Configure Environment Variables

Before starting, you should check and edit the environment variables in the .env file:

# Edit .env file
nano .env

Run n8n with Different Configurations

Using the Automated Script

On Windows (Command Prompt):

start.bat

On Windows (PowerShell):

.\start.ps1

On Linux/macOS:

chmod +x start.sh
./start.sh

Manual Run

n8n only (minimal configuration):

docker-compose -f compose-configs/docker-compose.n8n-only.yml up -d

n8n with SQLite:

docker-compose -f compose-configs/docker-compose.n8n-sqlite.yml up -d

n8n with PostgreSQL:

docker-compose -f compose-configs/docker-compose.n8n-postgres.yml up -d

n8n with Redis:

docker-compose -f compose-configs/docker-compose.n8n-redis.yml up -d

Full (n8n + PostgreSQL + Redis):

docker-compose up -d

Stop n8n

To stop n8n, use the command corresponding to the configuration you chose:

# If using a file in the compose-configs directory
docker-compose -f compose-configs/docker-compose.[config-name].yml down

# If using the default configuration
docker-compose down

Example:

docker-compose -f compose-configs/docker-compose.n8n-postgres.yml down

View Logs

# If using a file in the compose-configs directory
docker-compose -f compose-configs/docker-compose.[config-name].yml logs -f

# If using the default configuration
docker-compose logs -f

View Logs for a Specific Service

# If using a file in the compose-configs directory
docker-compose -f compose-configs/docker-compose.[config-name].yml logs -f n8n

# If using the default configuration
docker-compose logs -f n8n

Configuration

You can customize the configuration in the .env file:

n8n Configuration

  • N8N_HOST: n8n hostname
  • N8N_PORT: n8n port (default: 5678)
  • N8N_PROTOCOL: Protocol (http/https)
  • N8N_ENCRYPTION_KEY: Encryption key (important for security)
  • GENERIC_TIMEZONE: Timezone (default: Asia/Ho_Chi_Minh)

Database Configuration

  • DB_POSTGRESDB_USER: PostgreSQL username
  • DB_POSTGRESDB_PASSWORD: PostgreSQL password
  • DB_POSTGRESDB_DATABASE: Database name
  • DB_POSTGRESDB_PORT: PostgreSQL port (default: 5432)

Redis Configuration

  • REDIS_HOST: Redis hostname
  • REDIS_PORT: Redis port (default: 6379)

Data Backup

Data is stored in the following directories:

  • ./postgres-data/: PostgreSQL data
  • ./redis-data/: Redis data
  • ./n8n-data/: n8n data

Security Notes

  • Change N8N_ENCRYPTION_KEY in the .env file before using in production
  • Change database passwords in the .env file for production environments
  • If deploying publicly, configure HTTPS and user authentication

About

docker compose for n8n

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published