Best Practice: Docker Compose
Update Parameters provide an extremely useful capability to update deployments. Learn how to maximize efficiency by combining Docker Compose, Artifactory, and Update Parameters.
Last updated
Update Parameters provide an extremely useful capability to update deployments. Learn how to maximize efficiency by combining Docker Compose, Artifactory, and Update Parameters.
Last updated
By using three different tools together – Docker Compose, JFrog Artifactory, and JFrog Connect’s Update Parameters – you can take advantage of a highly flexible and efficient method of deploying multiple containers to your IoT devices. This page describes some best practices for using these to set up a software update.
Docker Compose is a tool for defining and running applications on multiple Docker container images. (You can also use Docker Compose to define a single container image.) With Docker Compose, you use a YAML file, also referred to as the Docker Compose File, to configure your application’s services.
Artifactory is a universal binary repository manager. Artifactory provides automation and management of binaries and artifacts throughout the application delivery process.
The Update Parameters feature enables you to parameterize fields in an action block and then enter the values upon deployment of the software update. This provides a highly flexible method of running software updates.
When you use Docker Compose with Connect, it’s best to use Artifactory to manage your binaries properly. In Artifactory, you store the YAML files in folders according to their respective version. (Learn how to work with Artifactory.) The steps below illustrate an example.
In Artifactory, create your application folder.
Inside your application folder, create a version hierarchy.
Store each version of your docker-compose.yaml
in a different version folder, keeping older versions intact.
In the Create Update Flow page, drag the Deploy Container action block to the workflow and open it for configuration. Configure the action block as follows:
Give the action block an Action Name.
Use the default settings for Registry Account and Deployment Type (e.g., JFrog Default and Docker Compose). This means that you will use a Docker Compose YAML file and it will be located in Artifactory.
For Artifactory Path, enter a fixed value for the app files folder, a variable for the version, e.g. {{version}}
, and a fixed value for the docker-compose.yaml
, as shown in the example below. Using this method, you can keep the same file name for different versions of the docker-compose.yaml
.
Enter Destination Path on Device and save the update flow.
You can deploy an update using the web UI or the Connect API. You will enter the version of your docker-compose.yaml
at the moment of deployment.
If you are using the API, you can send a Deploy Update request specifying deployment_configuration
and parameters_mapping
to define the parameter name and value. You can learn more about this in the Deploy Update API reference.
Learn more about other Connect best practices in the chapter Best Practices: Software Update.