Docker Gateway Restore with Compose

I am trying to setup a gateway to automatically restore from a backup in startup, following the documentation, and there is a command line argument mentioned (-r) that I am unable to find in even Dockers documentation!

Does anyone potentially know what that argument is? So that I can use it in a docker-compose file, because without it the restore doesn’t seem to happen. It says “runtime argument”, but I am not sure if its the same thing as --runtime or just a poor wording coincidence.

Documentation Section

Automating the Restore of a Gateway Backup
The following feature is new in Ignition version 8.1.7
Click here to check out the other new features

You can automate the restore of a gateway backup on first-launch of your gateway container. This allows for having a new Ignition Gateway restore to a known initial state automatically, without waiting for the commissioning steps.

To leverage this feature, bind-mount a gateway backup into the container and then use the -r runtime argument to specify the location and command the restore. Additionally, supply the ACCEPT_IGNITION_EULA=Y environment variable to accept the Ignition EULA (see the Licensingsection below) and bypass that gateway commissioning step.

docker run -d -p 9088:8088 --name ignition- test \
    - v gw-data:/usr/local/bin/ignition/data \
    - v /path/to/gateway.gwbk:/restore.gwbk \
    -e ACCEPT_IGNITION_EULA=Y \
    inductiveautomation/ignition:8.1.7 \
    -n docker-test -a localhost -h 9088 -s 9043 \
    -r /restore.gwbk

Everything after the image reference in a docker run is sent to the container as command-line arguments. So it is our entrypoint script that is consuming arguments such as -r /path/to/gateway.gwbk.

1 Like

Ahhh, that makes sense.

Then my new question becomes, how can I pass that command line argument to the entrypoint in a compose?

Here is my current yaml:

version: "3"

services:  
  example_gateway:
    image:  inductiveautomation/ignition
    ports:
    - "8088"
    env_file:
    - 'variables.env'
    volumes:
    - ./ignition_gateway.gwbk:/restore.gwbk

As of right now it doesn’t seem to be doing the restore

Use the following format:

services:
  gateway:
    ...
    command: >
      -n Ignition-gateway-name
      -r /path/to/restore.gwk

The above makes use of YAML Block Styles, the above condenses to -n ... -r ... all on one line, but offers the convenience of multi-line representation in the YAML file for easy viewing/editing.

EDIT: This example ​in our documentation also shows this technique, combined with the supplying of JVM/Wrapper/Gateway args after the double-hyphen

1 Like

So does the /path/to/restore.gwbk need to be defined in the volumes and in the command argument? And is Gateway name required?

(It may be useful to try and explain this a little more in the doc page, its not entirely clear from a user perspective that the -r argument is a command and not like the other tags. Potentially just adding it into the example you mentioned may help?)

EDIT: I shortly realized that the /path/to/restore.gwbk is the path once INSIDE the container, not the path outside the container. So I definitely see why it should be defined both times.

The path that you point to with the -r <path to gwbk file> runtime argument does need to exist within the container filesystem. This might be something you bind-mount in via a volume declaration, or it might be something you bake in via a derived image of your own.

I think that the section on runtime arguments in the docs does mention where these options/flags should be supplied. All of those are optional.

2 Likes

You are definitely right, I just didn’t tie those two sections together in my brain!

As always, I appreciate the clarification Kevin.

For completeness sake, here is the above mentioned compose with the updated content:

version: "3"

services:
  example_gateway:
    image:  inductiveautomation/ignition:latest
    ports:
    - "8088"
    env_file:
    - 'variables.env'
    volumes:
    - ./ignition_client_gateway.gwbk:/restore.gwbk
    command: >
      -n example_gateway_name
      -r /restore.gwbk

You’re welcome! Don’t forget to use explicit image tags in your image: declarations! While we provide latest tags, I definitely don’t recommend their use in most cases, as it rarely guarantees that you’re using the latest, rather that you’re only using the last latest that you pulled. :laughing:

1 Like