n8n logo

n8n

156207

Fair-code workflow automation platform with native AI capabilities.

#automation #workflow #ai #zapier #Screenshots
2025-11-10
2025-11-10

Getting Started

  1. Create a folder and move to the folder
    mkdir n8n && cd n8n
    
  2. Create a docker-compose.yml file and add the following content:
    docker-compose.yml
    version: '3.8'
    
    volumes:
      db_storage:
      n8n_storage:
    
    services:
      postgres:
        image: postgres:16
        restart: always
        environment:
          - POSTGRES_USER
          - POSTGRES_PASSWORD
          - POSTGRES_DB
          - POSTGRES_NON_ROOT_USER
          - POSTGRES_NON_ROOT_PASSWORD
        volumes:
          - db_storage:/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
    
      n8n:
        image: docker.n8n.io/n8nio/n8n
        restart: always
        environment:
          - 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}
        ports:
          - 5678:5678
        links:
          - postgres
        volumes:
          - n8n_storage:/home/node/.n8n
        depends_on:
          postgres:
            condition: service_healthy
    
  3. Create a init-data.sh file and add the following content:
    init-data.sh
    #!/bin/bash
    set -e;
    
    
    if [ -n "${POSTGRES_NON_ROOT_USER:-}" ] && [ -n "${POSTGRES_NON_ROOT_PASSWORD:-}" ]; then
      psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
        CREATE USER ${POSTGRES_NON_ROOT_USER} WITH PASSWORD '${POSTGRES_NON_ROOT_PASSWORD}';
        GRANT ALL PRIVILEGES ON DATABASE ${POSTGRES_DB} TO ${POSTGRES_NON_ROOT_USER};
        GRANT CREATE ON SCHEMA public TO ${POSTGRES_NON_ROOT_USER};
      EOSQL
    else
      echo "SETUP INFO: No Environment variables given!"
    fi
    
  4. Create a .env file and add the following content:
    .env
    POSTGRES_USER=changeUser
    POSTGRES_PASSWORD=changePassword
    POSTGRES_DB=n8n
    
    POSTGRES_NON_ROOT_USER=changeUser
    POSTGRES_NON_ROOT_PASSWORD=changePassword
    
  5. Run the following command to start the container:
    docker compose up -d
    
  6. Open the browser and go to http://localhost:5678 to access the n8n.
SnapDock

SnapDock

No setup hassle—just follow the steps and try the live demo!