Skip to content
Dropsolid Help Center home page
Product documentation
Integrations

Installing N8N locally

What is n8n or an integration hub?

Don't know yet what n8n is or what an integration hub does? Find more information on that on our blog.

Basic (LOCAL) install

Simple local install

To install n8n globally using npm:

npm install n8n -g

After the installation, start n8n running the following command:

    n8n
    # or
    n8n start

Local install from clone (to change)

Clone the repository:

    npm install -g npm@6
    npm install
    lerna bootstrap --hoist
    npm run build
    npm run dev  

Detailed instructions

npm: n8n

Docker compose install

I’m still working on this docker-compose file:

docker-compose.yml gist

This is the preferred way. Given you have an existing docker-compose file.

 n8n:
    image: n8nio/n8n
    restart: always
    domainname: n8n
    ports:
      - "127.0.0.1:80:5678"
    networks:
      - default
      - traefik
    environment:
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER
      - N8N_BASIC_AUTH_PASSWORD
      - N8N_HOST=${DOMAIN_NAME}
      - N8N_PORT=5678
      - N8N_PROTOCOL=http
      - NODE_ENV=production
      - WEBHOOK_TUNNEL_URL=http://${DOMAIN_NAME}/
      - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
    volumes:
      - ${DATA_FOLDER}/.n8n:/home/node/.n8n
    extra_hosts:
      - "n8n_mautic.docker.localhost:host-gateway"
    #links:
    #  - "mautic:floristacoddmmerce.docker.localhost"

My .env file:

# Folder where data should be saved
DATA_FOLDER=/Users/frederikwouters/.dropsolid_launchpad/projects/n8n/data
# The top level domain to serve from
DOMAIN_NAME=127.0.0.1
#DOMAIN_NAME=host.docker.internal
# The subdomain to serve from
SUBDOMAIN=
# DOMAIN_NAME and SUBDOMAIN combined decide where n8n will be reachable from
# above example would result in: https://n8n.example.com
# The user name to use for autentication - IMPORTANT ALWAYS CHANGE!
N8N_BASIC_AUTH_USER=user
# The password to use for autentication - IMPORTANT ALWAYS CHANGE!
N8N_BASIC_AUTH_PASSWORD=password
# Optional timezone to set which gets used by Cron-Node by default
# If not set New York time will be used
GENERIC_TIMEZONE=Europe/Berlin
# The email address to use for the SSL certificate creation
SSL_EMAIL=user@example.com

Follow the logs wit this command:

docker-compose logs -f -t

The n8n interface will be accessible via

projectname.docker.localhost:5678

In my case: http://floristacommerce.docker.localhost:5678/workflow/2

n8n start

Logging stuff

Create a Drupal endpoint

See code in florista example

Create the n8n node

Add a http request Node

  • authentication none
  • request method POST
  • ignore SSL issues (for now)
  • response format JSON
  • run 'execute node'

n8n run

Triggering from Drupal

Create n8n Webhook node

Create the node (do not link yet)

Create a Drupal Webhook

  • Get the webhook details visible in n8n

  • Create new webhook in Drupal

Test Webhook node

Create the node (do not link yet)

  • Trigger event in Drupal

  • Show in Drupal watchdog Log

  • Show output in n8n

n8n example

Triggering from Mautic

n8n Mautic

Install Mautic (SKIP for PRES)

Add Mautic Database to Docker compose

 mauticdb:
    image: percona/percona-server:5.7
    container_name: mauticdb
    volumes:
      - mysql_data:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=mysecret
    command:
      --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci
    networks:
      - default

Add Mautic to docker compose

  mautic:
    image: mautic/mautic:latest
    container_name: mautic
    domainname: mautic
    links:
      - mauticdb:mysql
    depends_on:
      - mauticdb
    ports:
      - 8080:80
    networks:
      - default
      - traefik
    volumes:
      - mautic_data:/var/www/html
    environment:
      - MAUTIC_DB_HOST=mauticdb
      - MYSQL_PORT_3306_TCP=3306
      - MAUTIC_DB_USER=root
      - MAUTIC_DB_PASSWORD=mysecret
      - MAUTIC_DB_NAME=mautic
      - MAUTIC_RUN_CRON_JOBS=true
    labels:
      - "traefik.docker.network=traefik"
      - "traefik.enable=true"
      - "traefik.port=8080"
      - "traefik.frontend.priority=1000"
      - traefik.http.routers.n8n.rule=Host(`mautic`)

I personally added them to /etc/hosts too

127.0.0.1       mautic
127.0.0.1       n8
docker-compose up -d 

To spin the instance up, surf to Mautic and go trough the installation.

Inspiration

Put the site in offline mode if temperature rises above 20 degrees (GO OUTSIDE!)

n8n Mautic

  • Drupal to Mautic to Microsoft dynamics (Over flow)

  • Gmail to Drupal

  • Google Calendar to Drupal (or vice versa)

  • Reddit to Drupal

  • Weather to Drupal

  • hacker news to Drupal

  • Mailchimp to Drupal

  • Drupal to Dropbox

  • What is your crazy requirement?

Example:

1
Put Drupal in maintenance mode when temperature drops below 5 degrees Celcius.

Send us your question

Do you still have unanswered questions or do you want to make some adjustments to your project? Don't hesitate to ask us your question at support@dropsolid.com or at +3293950290.