Skip to content

Deploying a Service

Most services deploy automatically when code is pushed to GitHub. The CI pipeline:

  1. Builds a Docker image
  2. Pushes to harbor.ayinza.dev
  3. Runs docker service update --image on the Swarm

No manual intervention needed if the pipeline is set up for the service.

When you need to deploy manually (e.g., hotfix, pipeline down, or infrastructure service update):

  1. SSH into Azure (the Swarm Leader):

    Terminal window
    ssh kaks@4.180.181.86
  2. Pull the new image (if needed):

    Terminal window
    docker pull harbor.ayinza.dev/library/service-name:tag
  3. Update the service:

    Terminal window
    docker service update \
    --image harbor.ayinza.dev/library/service-name:tag \
    --with-registry-auth \
    dev_service-name
  4. Verify the deployment:

    Terminal window
    docker service ps dev_service-name
    docker service logs -f dev_service-name --tail 50

If you need to redeploy all services in a stack (e.g., after changing the stack YAML):

Terminal window
docker stack deploy -c /home/kaks/stacks/infrastructure.yml dev
docker stack deploy -c /home/kaks/stacks/services.yml dev

Sometimes a service needs a restart without an image change:

Terminal window
docker service update --force dev_admin-service

This triggers a rolling restart of all replicas.

Terminal window
# See current state of all replicas
docker service ps dev_service-name
# Watch logs in real-time
docker service logs -f dev_service-name --tail 100
# See all services and their status
docker service ls