---
title: "Deploy microservices on a few servers without Kubernetes · CloudSat"
description: "Deploy microservices on two to ten servers: when to split, Compose vs Swarm vs Nomad vs Kamal, service discovery, rolling updates, data ownership and tracing."
url: https://cloudsat.io/learn/deploy-microservices-on-a-few-servers
updated: 2026-11-18T12:00:00Z
source: CloudSat (https://cloudsat.io/). Prices in USD.
---

[DevOps](https://cloudsat.io/learn/topic/devops-and-automation)

# Deploy microservices on a few servers without Kubernetes

Deploy microservices on two to ten servers: when to split, Compose vs Swarm vs Nomad vs Kamal, service discovery, rolling updates, data ownership and tracing.

CloudSat team November 18, 2026 6 min read

Most writing about microservices assumes a Kubernetes cluster and a platform team to run it. Plenty of real systems are smaller: five to twenty services, a team of a few developers, and a handful of servers. At that scale the hard problems are the same, namely packaging, discovery, rollouts, data and visibility, but the tools can be much simpler. This guide is a deployment playbook for that size.

## First, be sure you want to split

Microservices trade code complexity for operational complexity. Each service brings its own deploys, versioning, network calls that can fail, and data that can drift. They pay off when separate teams need to release independently, or when parts of the system have very different scaling or reliability needs. For a single small team, a modular monolith, one deployable with clear internal boundaries, usually ships faster and can be split later along the boundaries that turned out to matter.

If you do split, follow one rule from the start: **each service owns its data**. Two services writing to the same tables are one service with two deploy pipelines.

## Package every service the same way

Uniformity is what keeps twenty services manageable:

- **One container image per service**, built once in CI and tagged with the Git commit (`api:3f9c2e1`), never only `latest`.
- **The same image everywhere.** Staging and production run the identical tag; only configuration differs, passed through environment variables and secrets.
- **A health endpoint** such as `/healthz` that answers only when the service can do real work, including reaching its database.
- **Graceful shutdown.** On SIGTERM, stop accepting new requests, finish the current ones, then exit, within the stop timeout your orchestrator allows.
- **Structured logs to stdout**, one JSON object per line, with a request ID passed along from service to service.

## Choose an orchestrator for your size

| Option | Model | Good for | Limits |
| --- | --- | --- | --- |
| Docker Compose per host | Each server runs its own project, deployed by CI over SSH | Two or three servers with a fixed role each | No scheduling or failover across hosts |
| Docker Swarm | Built into Docker Engine; Compose-style stack files across a cluster | Three to ten servers, teams that already know Compose | Smaller ecosystem than Kubernetes; few managed add-ons |
| Nomad | Single-binary scheduler for containers and plain processes | Mixed workloads, teams that like HashiCorp tools | Moved to the Business Source License in 2023; a service mesh needs Consul alongside |
| Kamal | Deploys containers over SSH with a small proxy for zero-downtime switches | Web apps and their workers on a few hosts | No cluster scheduler; you assign roles to hosts |
| k3s | A lightweight Kubernetes distribution you run yourself | Teams that want Kubernetes APIs and tooling | You operate Kubernetes, with its upgrades and its learning curve |

For most teams in the two-to-ten-server range, Swarm is the shortest path: stack files are Compose files with a `deploy` section, and the rest of this guide uses it as the example.

## A Swarm cluster in five commands

Swarm nodes talk on TCP 2377 for cluster management, TCP and UDP 7946 between nodes, and UDP 4789 for overlay network traffic. Those ports must be reachable between nodes and from nowhere else. On servers with only public addresses, the cleanest approach is a WireGuard mesh between the nodes, with Swarm advertising the tunnel addresses:

```bash
# on the first manager (10.8.0.1 is its WireGuard address)
docker swarm init --advertise-addr 10.8.0.1
docker swarm join-token manager      # prints the join command for more managers
docker swarm join-token worker       # and for workers

# shared settings that services read at runtime
printf '%s' "$DB_PASSWORD" | docker secret create shop_db_password -
docker network create --driver overlay --attachable backend
```

Run three managers, not one or two: Swarm needs a majority of managers to keep making decisions, so three tolerate the loss of one. With WireGuard carrying cluster traffic, a CloudSat [cloud firewall](https://cloudsat.io/docs/cloud-firewalls) attached to every node only has to allow SSH, WireGuard's UDP port from the other nodes' addresses, and the public ports of your edge proxy.

## Discovery and traffic

Inside the cluster, services find each other by name: a container on the `backend` network reaches the orders service at `http://orders:8080`, and Swarm's built-in DNS and virtual IPs spread requests across healthy replicas. No separate registry is needed at this size.

At the edge, one reverse proxy terminates TLS and routes hostnames and paths to services. Traefik, Caddy and HAProxy all fit; Traefik can read routing rules from service labels, so routing changes deploy with the service. Keep internal services off the edge network entirely: only the proxy and the services it fronts should share a network with the internet-facing side.

## Rolling updates that roll back by themselves

The stack file declares how each service updates:

```yaml
services:
  api:
    image: registry.example.com/shop/api:${GIT_SHA}
    networks: [backend]
    secrets: [shop_db_password]
    healthcheck:
      test: ["CMD", "wget", "-qO-", "http://localhost:8080/healthz"]
      interval: 10s
      timeout: 3s
      retries: 3
    deploy:
      replicas: 3
      update_config:
        parallelism: 1
        order: start-first
        monitor: 30s
        failure_action: rollback
      restart_policy:
        condition: on-failure
    stop_grace_period: 30s

networks:
  backend:
    external: true
secrets:
  shop_db_password:
    external: true
```

```bash
GIT_SHA=$(git rev-parse --short HEAD) docker stack deploy -c stack.yaml shop
docker service ps shop_api            # watch tasks move to the new image
docker service rollback shop_api      # manual rollback if you need one
```

`order: start-first` starts a new task before stopping an old one, `monitor` watches each new task for 30 seconds, and `failure_action: rollback` reverts the service on its own if new tasks fail their health check. The health check runs inside the container, so the image must include the tool it calls, here `wget`. For riskier changes, run a second copy of the service under a new name and shift a share of traffic to it at the proxy before switching fully.

## Data and schema changes

Each service gets its own database, or at least its own schema and credentials, and other services reach that data only through its API or its events. Schema changes then follow the expand and contract pattern, because old and new versions run side by side during every rolling update:

1. **Expand:** add new columns or tables, nullable or with defaults; old code ignores them.
2. **Deploy** the version that writes both shapes and reads the new one.
3. **Backfill** existing rows.
4. **Contract:** remove the old columns in a later release, once nothing reads them.

Never couple a destructive migration to the deploy that needs it.

## See what is happening across services

A request that crosses four services needs three kinds of signal. **Metrics** for each service (request rate, error rate, latency) show which one is unhealthy, and the [Prometheus and Grafana guide](https://cloudsat.io/learn/prometheus-and-grafana-explained) covers collecting them. **Logs** with a shared request ID let you follow one request through every service. **Traces**, produced with OpenTelemetry SDKs and sent to a backend such as Jaeger or Grafana Tempo, show where the time went. Add tracing before the first slow request you cannot explain, not after.

## FAQ

### When should we move to Kubernetes?

When you need what its ecosystem offers and Swarm or Nomad lacks: autoscaling on custom metrics, operators that manage databases for you, policy engines, or a large catalog of ready-made deployments. Moving from Swarm is mostly translating stack files, because images, health checks and configuration habits carry over.

### Do we need a service mesh?

Rarely at this size. A mesh adds mutual TLS, retries and traffic shaping between services, but also a sidecar per service and another system to operate. Encrypt traffic between nodes with WireGuard, set timeouts and retries in your HTTP clients, and revisit the question when you have dozens of services.

### How do we keep services compatible with each other?

Version APIs explicitly, add fields without removing old ones, and test each service against the contracts its consumers rely on. Contract testing tools such as Pact automate that check in CI, so a breaking change fails a build instead of a release.

**Run it on CloudSat.** Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. [See plans](https://cloudsat.io/plans) or [deploy a server](https://dash.cloudsat.io/console/deploy).

## Keep reading

[All guides in DevOps](https://cloudsat.io/learn/topic/devops-and-automation)

- [Prometheus vs Grafana: roles, sizing and when to self-host](https://cloudsat.io/learn/prometheus-and-grafana-explained): DevOps Prometheus vs Grafana: roles, sizing and when to self-host 7 min read
- [Docker security checklist for an internet-facing server](https://cloudsat.io/learn/docker-security-checklist-for-servers): DevOps Docker security checklist for an internet-facing server 7 min read
- [Switch from Terraform to OpenTofu: what changes, what breaks](https://cloudsat.io/learn/switch-from-terraform-to-opentofu): DevOps Switch from Terraform to OpenTofu: what changes, what breaks 7 min read
- [Upgrade, pin and roll back Python packages on a server](https://cloudsat.io/learn/upgrade-pin-and-roll-back-python-packages): DevOps Upgrade, pin and roll back Python packages on a server 7 min read
