# Multiple gateways on a single box

**URL:** <https://forum.inductiveautomation.com/t/multiple-gateways-on-a-single-box/38395>\
**Category:** Ignition\
**Created:** [September 4, 2020, 11:22am UTC](https://forum.inductiveautomation.com/t/multiple-gateways-on-a-single-box/38395 "2020-09-04T11:22:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jason.millar](https://avatars.discourse-cdn.com/v4/letter/j/35a633/32.png) [@jason.millar](https://forum.inductiveautomation.com/u/jason.millar)\
**Post date:** [September 4, 2020, 11:22am UTC](https://forum.inductiveautomation.com/t/multiple-gateways-on-a-single-box/38395/1 "2020-09-04T11:22:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 4, 2020, 1:16pm UTC](https://forum.inductiveautomation.com/t/multiple-gateways-on-a-single-box/38395/2 "2020-09-04T13:16:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [September 4, 2020, 1:18pm UTC](https://forum.inductiveautomation.com/t/multiple-gateways-on-a-single-box/38395/3 "2020-09-04T13:18:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 4, 2020, 1:19pm UTC](https://forum.inductiveautomation.com/t/multiple-gateways-on-a-single-box/38395/4 "2020-09-04T13:19:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kevin.Collins](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.collins/32/13497_2.png) [@Kevin.Collins](https://forum.inductiveautomation.com/u/Kevin.Collins)\
**Post date:** [September 4, 2020, 1:56pm UTC](https://forum.inductiveautomation.com/t/multiple-gateways-on-a-single-box/38395/5 "2020-09-04T13:56:11Z")

</div>

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!

```auto
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](https://www.docker.com/products/docker-desktop) and [Docker Compose](https://docs.docker.com/compose/install/) (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](https://github.com/thirdgen88/ignition-docker) 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](https://hub.docker.com/r/kcollins/ignition) 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](https://github.com/thirdgen88/ignition-examples) that can help provide some more ideas–I’ve got some more good stuff coming to that one soon too.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 4, 2020, 2:01pm UTC](https://forum.inductiveautomation.com/t/multiple-gateways-on-a-single-box/38395/6 "2020-09-04T14:01:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![msteele](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/msteele/32/77889_2.png) [@msteele](https://forum.inductiveautomation.com/u/msteele)\
**Post date:** [February 22, 2022, 10:16pm UTC](https://forum.inductiveautomation.com/t/multiple-gateways-on-a-single-box/38395/7 "2022-02-22T22:16:26Z")

</div>

@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.
