DEV Community

Cover image for Workflow on Docker Swarm
Ramon Lima
Ramon Lima

Posted on

Workflow on Docker Swarm

After that cluster up and running the first that comes to mind is what is next? What can I do with a cluster and how can I work with that cluster? This is my first approach here, is the low-code high productivity so I don't have to spend too much time and effort on doing anything in the new setup.

Low-Code = Visual Development

I work with low-code and I love the low-code concept due to the productivity and believe it or not the first thing I searched for was: Is there a workflow engine open source or something that I could stick into the cluster I just built and start working with it? How about an open source alternative to Power Automate or something close to that? Initially I was thinking I was dreaming too much but reality proved me wrong and there's such a thing in which I will cover below.

The Options

Initially I saw a couple of alternatives and I liked it but not as much as my final choice which in the following order.

  1. N8n - https://n8n.io/
  2. Project Flogo - https://www.flogo.io/
  3. Apache Nifi - https://nifi.apache.org/

Apache Nifi has a nice approach but I was feeling like it was an old interface or something, I'm used to Nintex Workflow and Power Automate and they look prettier it should be about the usability but the UI makes a difference so I putted Nifi in the back burner because of that because in my head it was somehow using older technology.

Project Flogo by TIBCO is prettier than Nifi but the drawbacks are that basically TIBCO didn't get much traction around this project and it's open source but if you want to customize anything you have to do it in go-lang or you can just write in go-lang instead of the UI. It seems like a better alternative than the Nifi so I left it in 2nd place.

After looking at those two projects the time came to implement it so I searched a bit more again and found the n8n which is a Berlin based startup and did a fair-code license approach but the huge difference is that visually it looks a lot like the commercial products (Nintex Workflow and Power Automate) but also with the other part which is build your own nodes from code and having a bunch of nodes out of the box is just perfect. Not only that but they also have a workflow marketplace so you can grab a workflow for your needs and start working with it in your own environment. This is it, it was my choice and I will start playing around with it in the coming days and weeks, the most important connector I already found which is "Execute Command" to run some shell on the server that means we can automate some docker commands to spin off some stacks or services or whatever other thing I can think of.

The setup

You can setup using the following docker compose in your swarm or your kubernetes, you are in charge.

If you have swarmpit you can just copy and paste this and hit deploy and you're done for the day.

Docker stack deploy: https://docs.docker.com/engine/reference/commandline/stack_deploy/

docker stack deploy docker-compose.yml n8n

Implement the following docker-compose.yml to your environment, please change the values of ADMINUSER and ADMINPASSWORD.

version: '3.3'
services:
  n8n:
    image: n8nio/n8n:latest
    command:
     - /bin/sh
     - -c
     - sleep 5; n8n start
    environment:
      N8N_BASIC_AUTH_ACTIVE: 'true'
      N8N_BASIC_AUTH_PASSWORD: ADMINPASSWORD
      N8N_BASIC_AUTH_USER: ADMINUSER
    ports:
     - 5678:5678
    volumes:
     - n8n-web:/root/.n8n
    networks:
     - default
    logging:
      driver: json-file
networks:
  default:
    driver: overlay
volumes:
  n8n-web:
    driver: local

OBS: Please note that in the docker-compose setup I didn't put a database they say it's best with postgres but I didn't like the way the setup is at the moment for that DB so I'm talking with them in the community channel to see if we can get something better going towards this postgres setup. Without the postgres it's just running on SQLite OOTB.

Open ports

TCP: 5678
Obs: For this compose setup if you have virtual hosts going you can setup a subdomain instead.

What I have seen of n8n

It looks like an active project, has been in high upvotes in product hunt and it's activily hiring in Berlin for more than 1 position. They're going to launch pretty soon a n8n cloud which is going to be the paid product release based upon the project. It seems like it's going to have a great future this project my best wishes and blessing to these guys, genius way to enter the workflow market!

Watch-out Nintex Workflow and Power Automate here comes n8n.

Top comments (0)