Multiple gateways on a single box

Hi there;

I’m interested in setting up multiple gateways in a test environment to test/validate some of the Enterprise features, but I’m wondering if I can do that by installing multiple test Ignition instances on the same server?

Thanks,
J

1 Like

It is possible but annoyingly difficult. You have to take great care to keep all files separate, and allocate unique ports for all of the networking modules in Ignition (not just the http and https ports). I recommend you use multiple VMs on a virtual network.

I’ll second what @pturmel said. Use VMs, or if you’re feeling brave and savvy, use docker instances.

I guess I’m not savvy, as I wouldn’t know how to set up docker for such a network. @Kevin.Collins ?

Thanks for pulling me in @pturmel. I agree that this is a perfect example for leveraging Docker for development. All of the constructs you need are there, including being able to specify multiple networks across which various services communicate. I’d recommend using Docker Compose, which is a way to declare how containers are to be created and arranged, more easily than doing everything on the individual docker run commands. It makes managing multiple containers so much easier.

A compose file such as the one below would satisfy the base needs of two gateways that can communicate with each other by name (gateway1 and gateway2). Feel free to mention other services if you need them, like databases, those can be easily added too!

version: "3.8"

x-common-gateway-settings:
  &common-gateway-settings
  logging:
    driver: "json-file"
    options:
      max-size: "200k"
      max-file: "10"

services:
  gateway1:
    <<: *common-gateway-settings
    image: kcollins/ignition:8.0.16
    ports:
      # Publish a port 8088 on your host (left side) to port 8088 within your container (right side)
      - 8088:8088
    volumes:
      # Preserve your gateway state via a named volume
      - gateway1-data:/var/lib/ignition/data
      # Place any third party modules you want in the bind-mount volume that will create a folder on your host
      - ./gateway1-modules:/modules
    environment:
      GATEWAY_ADMIN_PASSWORD: changeme
      
  gateway2:
    <<: *common-gateway-settings
    image: kcollins/ignition:8.0.16
    ports:
      # This time we allocate 8089 on the host, still to 8088 within the container
      - 8089:8088
    volumes:
      - gateway2-data:/var/lib/ignition/data
      - ./gateway2-modules:/modules
    environment:
      GATEWAY_ADMIN_PASSWORD: changeme

volumes:
  gateway1-data:
  gateway2-data:

Install Docker Desktop and Docker Compose (if it doesn’t come with it now, it might), then create an empty folder, place the above contents into a docker-compose.yml file and then run docker-compose up -d to bring up the stack… It will first pull the kcollins/ignition Docker Image and then proceed to launch a pair of Ignition gateways for you! You can then docker-compose down to stop things (your state will still be preserved in your volumes even though the containers will be stopped and removed).

There’s of course much more depth here with additional work in this compose stack, but the simple example above is enough to get you started and create recognition that this can be a very powerful way to model architectures in dev. Feel free to take a look at the image’s Docker Hub page for more info on how to leverage it. I’m also happy to answer additional questions and offer up some more detail. In fact, I’ve got another examples repo that can help provide some more ideas–I’ve got some more good stuff coming to that one soon too.

Hope this helps!

7 Likes

Awesome. I think it is time to retire most of my kickstarts.

@jason.millar did you end up using Docker for this?
We are also looking to have a virtualized dev environment with multiple gateways, one for each client/project site. I’m considering Docker for this rather than VMs, but I’m wondering what pitfalls there might be.