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.
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
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.
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.
I love the explanation you gave here, but one thing that's not really clear to me is the other volume mounted to the container: - ./ignition_client_gateway.gwbk:/restore.gwbk is it the path to where the ignition volume is stored or I'll first run backup, store it in a file and use the file path as the /restore.gwbk
No, this is incorrect. The left side of the volume configuration should contain an absolute or relative path to a gateway backup file on the host. The right side (after the :) is then where you want to bind-mount that inside the container.
Thank you, I've seen the examples, but I still don't seem to understand it fully, the .gwbk file, does it get created automatically or I'm missing the step of creating it. I think my issue now is how to get the base.gwbk file or anything I want to call the name.
Ahhh, yes, those examples reference an already-existing GWBK that you're mounting into the container to restore on the first launch. You don't need that if you're just wanting to start up an Ignition container in its default initial state.
Now, I have a gateway which I deployed using compose file, I have some projects on the gateway and I want to restore all my project on another gateway, can I achieve this without having to manually download the backup file on the webpage? Just curious.
And one more thing is how to manage the license key during the process. Thank you
You can bind-mount a path from your host into the container and target that container path in a Scheduled Backups configuration.
The gateway backup file will not contain any information about licensing. If you're using containers, you should probably be using Leased Activation licensing with an 8-digit license key.