Containers have transformed the software deployment landscape, especially for IoT application updates. They’re no longer just a cloud-native technique; they’re now integral to CI/CD processes for IoT devices. With CI/CD, changes in code automatically undergo build and test phases, ensuring seamless IoT container deployment if all tests succeed.
Qbee offers an unparalleled solution for docker container deployment in the IoT ecosystem, merging seamlessly with CI tools to embody the CD (Continuous Deployment) aspect of CI/CD. This overview provides a structural walkthrough on crafting a CI/CD workflow for IoT docker deployments using qbee.io. A container deployment deep-dive with more details can be found in our documentation.
Setting the Stage
With qbee.io’s device groupings, you can differentiate between developmental and production environments. Picture this: one device under the “Development” group and another under the “Production” group. But you can have more groups and there is no limit on how many devices that can be part of any group.
Group identifiers, found in the URL https://www.app.qbee.io/#/groups/<node_id>, are pivotal for the CI process.
Integrating the CI System
In our example, we leverage GitHub Actions for its seamless integration with qbee and because it is very well known. However, other CI tools like Jenkins, Travis, and GitLab CI are compatible. First, append essential variables like node ids, qbee.io credentials, and the targeted docker registry to your repository. For the purpose of this tutorial, we employ a qbee-specific user with exclusive configuration change permissions.
A model GitHub workflow is available at https://github.com/qbee-io/qbee-usecases/blob/ci-cd-docker/.github/workflows/main.yml.
The workflow boils down to:
- Determine Device Group and Version: Deploy to the “Development” group and assign docker tags based on either semantic versioning or the git commit id.
- Build & Dispatch Docker Image: Set up the docker environment, then build and dispatch the application’s docker image using standard actions.
- Authenticate with qbee.io: Obtain an authentication token via a custom GitHub action for upcoming Qbee API tasks.
- Modify Configuration Template for qbee.io: Without committing secrets, use GitHub’s secret management to provide login details for pulling the fresh docker image and updating its value.
- Commit Configuration: With a custom GitHub action, commit the newly crafted configuration to qbee.io.
Developing & Testing
Post-committing a new configuration on GitHub, the automation will distribute the new container to your devices in scope and start it. Continue building and testing new versions until the result passes your quality control.
Deploying to Production
Once testing concludes, the path to production awaits. Tagging the GitHub repository triggers a deployment to the “Production” group. Once the docker image of the tagged version is distributed and deployed by Qbee, you can observe a log entry and verify the application’s status on the production fleet.
CI/CD, a cornerstone in cloud computing, finds its IoT equivalent with qbee’s adaptability. It smoothly dovetails with CI platforms, playing the role of the Continuous Deployment agent for IoT container deployment. To experience this synergy first-hand, consider delving into our illustrative example: https://github.com/qbee-io/qbee-usecases/tree/ci-cd-docker and read the full technical guide about this solution here.