This lesson is part of the Ignition with Docker course. You can browse the rest of the lessons below.


Autoplay Off


This lesson will kick off the walkthrough of our testing environment and we'll start by adding our Ignition containers.


(open in window)

[00:00] In this lesson, we'll get started with our testing environment by creating the two Ignition gateway containers and setting up a gateway network connection between them. Let's create a docker compose file and we'll start with the frontend gateway service. For the service name we can just call it "frontend". We'll use the official Ignition image and we can specify the version we'd like, for example 8.1.21. Because we're going to eventually be connecting our gateways with a GAN connection, let's add host names to the containers. All this does is give our certificates more readable names, so it's not necessary but I like things to be readable. So let's do it. Next we can add our ports. Let's map to host port 9988. And then let's add a named volume for the gateway data. If you followed along in the previous course, we had to go through the commissioning phase for our gateways when we started them up for the first time. Let's automate this process. We can do that by adding environment variables.

[01:17] If you want to reference these variables you can find them in our user manual. The first variable we'll need is the Ignition edition which will be standard. Next we'll specify the gateway admin password. I'm just going to make this password. We don't need to specify a gateway admin username since that will automatically be admin by default. And then the last variable we need is the "ACCEPT_IGNITION_EULA". And we can make that equal to "Y". There's a link to the software license agreement on the same user manual page. And of course by passing this argument, you're agreeing that your use of the images governed by the terms in said agreement. Make sure that the "Y" is capitalized here. Finally, let's pass an Ignition runtime argument via the command key.

[02:06] We'll name this "frontend-gateway" for our frontend gateway. Since we've added a volume in our stack, we'll define it in the list of volumes after the services. Okay, let's save our compose file and take a second to check that everything is looking good before moving on to the backend gateway. Open up your command line interface and make sure that you're in the correct folder that contains this docker compose file and let's run a "docker compose config" command. We can use config to perform a syntax check before we actually create our containers and if there are any errors it will list them here. Since there are no errors, we instead get to see the built out stack objects. If for some reason you end up with errors at this point try following along with the same exact naming that I have typed out and double check your indentation and spaces. So we can see it to the work of building our volume for us. But it also added some other stuff too. Notably. It added this default network here. This automatically gets created when we use Docker Compose and docker networks allow the containers to communicate with each other.

[03:06] Let's use these to recreate the frontend and backend networks in our testing environment. Let's specify a network for the frontend gateway and we can place it right above our environment variables and we'll name it frontend. If we're adding docker networks, we'll need to list them out like we do with the volumes. Now if we save and run another config command. We can see that there's a frontend network defined. Let's start defining the backend service. Let's add the same image. And then make the hostname "backend". This time we'll specify a host port of 9989 since 9988 will be taken.

[04:03] Let's add another named volume. For the backend gateway, we want it to be able to communicate with the front end gateway. So let's add the frontend network. It also needs to communicate with the database and SMTP server, which the frontend gateway doesn't need to communicate with. So, let's add the backend network as well. Let's add the same environment variables as the frontend. And then we can name this gateway something creative like "backend -gateway". We specified a new network and volume. So we need to list them out at the bottom of the stack. Awesome. Let's save and run config. No errors, which is great. Let's start our containers.

[05:13] We should see that the networks and volumes are created and the containers are started. Let's take a look at them in the web browser. So we could use localhost in order to access the gateway web pages. However, maybe we'd like to use a specific host name in our testing and also using localhost can sometimes be bothersome as logging into one gateway will log us out of the other. In response to this we would normally modify the "hosts" file on our development machine in order to link a specific hostname back to our loopback address. If this is something that you want to pursue on your end, I would suggest Googling instructions as the location will be different depending on your operating system. Alternatively some nice people out there have created public facing Wild Card DNS resolvers that can help with this. There can be multiple options but these aren't always guaranteed to be around so you may have to do some searching to find one that works.

[06:02] I'm going to use one for these videos and it uses "". In short I can put whatever I want in front of "" and then my arbitrary name plus the "" resolve to "localhost". So in order to access the gateways, I'll be using "" port 9988. and "" port 9989 We'll say no to the Quick Start here. And here we go two Ignition gateways. Let's get that gateway network connection created. It doesn't matter which gateway we initiate the connection from, but since we'll be adding other connections on the backend, let's just try to keep everything on the backend for simplicity. Let's go to the Gateway Network page. We'll create a new outgoing connection. And for the host we just need to put "frontend". Now let's head over to the incoming connections on the frontend gateway. We can approve this certificate.

[07:13] And if we wait a few seconds. We can then approve the connection. And this should update to a running status. If we look at the status page on the frontend gateway, we see that it's connected to the backend gateway. And then the backend gateway is connected to the frontend gateway. We'll stop here now that we have our gateways created and connected. In the next lesson, we can tackle creating the next part of our testing environment, which will be the database connection.

You are editing this transcript.

Make any corrections to improve this transcript. We'll review any changes before posting them.