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.
Overview
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
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
Artifactory is a universal binary repository manager. Artifactory provides automation and management of binaries and artifacts throughout the application delivery process.
Update Parameters
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.
Configure a Deployment
Create the Artifactory Folders
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.
Configure the Deploy Container Action Block
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 thedocker-compose.yaml
, as shown in the example below. Using this method, you can keep the same file name for different versions of thedocker-compose.yaml
.
Enter Destination Path on Device and save the update flow.
Deploy the Software Update
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.
What’s Next?
Learn more about other Connect best practices in the chapter Best Practices: Software Update.
Last updated