How can I use Auto DevOps progressive deployment to migrate a small application without downtime in GitLab?
0 reputation · 28 Aug 2021, 01:01 UTC
0 reputation · 28 Aug 2021, 01:01 UTC
A small monolithic application hosted on GitLab needs to be migrated to a new version with zero downtime. The goal is to rely on a supported GitLab feature rather than custom scripts. The application already uses Auto DevOps for CI/CD, and the progressive deployment strategy offered by Auto DevOps is being considered.
Questions:
26525 reputation · 28 Aug 2021, 06:02 UTC
1. Enable Auto DevOps for the project (Project → Settings → CI/CD → Auto‑DevOps). The pipeline must include the Auto‑DevOps template.
2. Turn on progressive deployment in the same settings page – the toggle “Auto‑DevOps progressive deployment” should read Enabled.
3. Define environments in .gitlab-ci.yml (e.g., staging and production) and tag the runner with the corresponding environment name.
4. Set the strategy variable in the pipeline configuration or as a protected variable:
variables:
DEPLOYMENT_STRATEGY: "progressive"
# Optional: control traffic split
PROGRESSIVE_DEPLOYMENT_PERCENT: "10"
5. Run a pipeline. The Auto DevOps job will deploy the new container image to a canary instance first. The job logs will show a stage named Deploy to production (progressive) that creates two deployment records – one for the old revision and one for the new canary.
6. Verify health checks for the canary URL (GitLab exposes the URL in the job artifacts). If the canary passes, the pipeline automatically shifts traffic to the new revision using the load balancer’s traffic‑splitting feature.
7. Monitor metrics during the shift. If any error threshold is exceeded, the pipeline rolls back to the previous stable revision. The rollback is automatic and visible in the deployment history.
8. Clean up after a successful shift – the old deployment is marked finished and resources are released.
Deploy to production (progressive) stage with two deployment entries.To ensure the traffic‑splitting works as expected, could you confirm which load balancer or ingress controller your cluster is using (e.g., NGINX Ingress, Traefik, AWS ALB, etc.)? This may affect the exact configuration needed for zero‑downtime rollouts.
Auto DevOps progressive deployment is a built‑in canary strategy that relies on the pipeline to create two parallel deployments. The new revision is first exposed on a distinct path or port; the old revision keeps serving traffic. Once the canary passes health checks, the pipeline updates the load balancer to route all requests to the new revision. If the new revision fails, the pipeline automatically reverts to the old deployment, ensuring no downtime.
Key assumptions:
Because the feature depends on the underlying load balancer, verify that your environment supports zero‑downtime rollouts before relying solely on this approach.
Use comments to ask for clarification. Post a solution as an answer.
26,525 reputation · 28 Aug 2021, 02:23 UTC
While the pipeline handles the traffic split, it is important to note that progressive deployment creates a period where two different versions of the application are active and accessing the same database simultaneously. To maintain zero downtime and prevent crashes, your database migrations must be backward-compatible.
You can verify the concurrent state by running kubectl get pods during the progressive stage to confirm both versions are healthy before promoting the canary.