Deploying a Service
Automatic Deployment (CI/CD)
Section titled “Automatic Deployment (CI/CD)”Most services deploy automatically when code is pushed to GitHub. The CI pipeline:
- Builds a Docker image
- Pushes to
harbor.ayinza.dev - Runs
docker service update --imageon the Swarm
No manual intervention needed if the pipeline is set up for the service.
Manual Deployment
Section titled “Manual Deployment”When you need to deploy manually (e.g., hotfix, pipeline down, or infrastructure service update):
-
SSH into Azure (the Swarm Leader):
Terminal window ssh kaks@4.180.181.86 -
Pull the new image (if needed):
Terminal window docker pull harbor.ayinza.dev/library/service-name:tag -
Update the service:
Terminal window docker service update \--image harbor.ayinza.dev/library/service-name:tag \--with-registry-auth \dev_service-name -
Verify the deployment:
Terminal window docker service ps dev_service-namedocker service logs -f dev_service-name --tail 50
Redeploying an Entire Stack
Section titled “Redeploying an Entire Stack”If you need to redeploy all services in a stack (e.g., after changing the stack YAML):
docker stack deploy -c /home/kaks/stacks/infrastructure.yml devdocker stack deploy -c /home/kaks/stacks/services.yml devdocker stack deploy -c /home/kaks/stacks/uat-infrastructure.yml uatdocker stack deploy -c /home/kaks/stacks/uat-services.yml uatdocker stack deploy -c /home/kaks/stacks/shared-infrastructure.yml shareddocker stack deploy -c /home/kaks/stacks/nginx.yml devForce Restarting a Service
Section titled “Force Restarting a Service”Sometimes a service needs a restart without an image change:
docker service update --force dev_admin-serviceThis triggers a rolling restart of all replicas.
Checking Deployment Status
Section titled “Checking Deployment Status”# See current state of all replicasdocker service ps dev_service-name
# Watch logs in real-timedocker service logs -f dev_service-name --tail 100
# See all services and their statusdocker service ls