Docker Rollout Action simplifies deploying Docker Compose services with zero downtime directly from GitHub Actions. It automates the process over SSH, ensuring your new containers are only served when healthy. This action includes automatic rollbacks, migration handling, and enhanced security, making it ideal for hassle-free deployments without Kubernetes.
Docker Rollout Action
The Docker Rollout Action enables zero-downtime deployments for Docker Compose services directly from GitHub Actions, leveraging SSH for secure communication with your server. This tool is designed for users who need a reliable and straightforward way to deploy updates while maintaining service availability.
Key Features
Zero Downtime Deployments: Ensure continuous service availability by verifying new deployments under load. Tests automatically fail if any requests return errors during the deployment.
Automatic Rollback: If a newly deployed container does not pass its health checks, it is rolled back seamlessly, ensuring that the previous version continues to serve traffic without interruptions.
Migration Hook Support: The action supports database migrations by allowing commands to be executed before the service switch, preventing operational issues related to schema changes.
Comprehensive Management: Rollouts manage the entire stack, updating services alongside their dependencies with a simple docker compose up -d command.
Security-First Approach: All operations are executed over a single SSH session, ensuring that sensitive data such as SSH keys and registry credentials are handled securely. Temporary Docker configurations are used and cleaned up post-deployment.
Simplicity: Built with plain Bash, no additional installations are required on the runner. Missing components such as the docker-rollout plugin are automatically installed on the server as needed.
Usage Example
The following YAML snippet illustrates how to configure the Docker Rollout Action within a GitHub Actions workflow:
Deployments are orchestrated in a single SSH session, performing the following steps:
Upload specified files to the server.
Install the docker-rollout plugin if it is not present.
Authenticate to the Docker registry using temporary credentials.
Pull images and ensure the services are healthy before rolling out the new containers.
Execute any pre-deployment commands, including database migrations.
Begin the rollout sequence for the designated services.
Update any additional services as specified.
Perform post-deployment tasks such as cleaning up old images if needed.
Requirements
Server: Must have Docker with the Compose v2 plugin, Bash 4.4+, and an SSH user in the Docker group.
GitHub Runner: Any Linux runner capable of SSH and base64 operations.
Conclusion
The Docker Rollout Action is a robust solution for developers looking to automate their deployment pipelines while ensuring high availability and reliability. It simplifies the deployment process, provides necessary security features, and integrates seamlessly into existing CI/CD workflows.
Comments
0Start the conversation
Share the first comment.