I am using the docker-compose
module to create an artifact and deploy my application. I need to automatically restart my Docker containers whenever there are changes in the configuration file (/var/lib/mender-configure/device-config.json
).
JFI, uses Ubuntu OS which is installed manually and installed mender client and other necessary packages.
One approach is to use a shell script, package it as an artifact, and deploy it. However, this works only once—subsequent deployments of the same artifact will be considered “already installed,” preventing re-execution.
What would be a better approach to achieve this use case? Any suggestions would be appreciated!
Hi @vimoxshah,
Thanks for reaching out. I think the easiest approach is to version your configuration, so not recreate the artifact with the exact same name and version when you have a change, but give it a version or timestamp. Then the “already installed” will not apply. You can find more information here: Software versioning | Mender documentation
Side note, there is a “Force installation” flag you can set during deployment creation which can make the device reinstall an artifact regardless of its current state, but I think it is not available on all plans.
Greetz,
Josef
Hey @TheYoctoJester Is there any way where I can restart the docker containers on deploying the mender config using APIs?