Usage
Options
Path to a custom global Caddy config (Caddyfile) that will be prepended to the auto-generated configuration
Caddy Docker image to deploy (default: latest stable version from Docker Hub)
Machine names or IDs to deploy to. Can be specified multiple times or as a comma-separated list. If not specified, deploys to all machines
Description
Thecaddy deploy command deploys or upgrades the Caddy reverse proxy service across your cluster. Caddy runs in global mode, meaning one container runs on each machine to handle incoming HTTP/HTTPS traffic.
What It Does
- Checks current state: Inspects any existing Caddy deployment
- Creates deployment plan: Shows what will change (new containers, updates, removals)
- Asks for confirmation: Prompts you to approve the plan
- Performs rolling update: Updates containers one at a time to avoid downtime
- Updates DNS records: Configures cluster domain to point to reachable machines
Rolling Updates
When upgrading an existing Caddy deployment, containers are updated one at a time:- New container starts on a machine
- Health checks verify it’s working
- Old container stops
- Process repeats for the next machine
Examples
Initial Caddy deployment
Deploy Caddy for the first time:Upgrade Caddy version
Upgrade to a specific Caddy version:Deploy with custom Caddyfile
Add custom global configuration (rate limiting, authentication, etc.):custom-caddy.conf:
Deploy to specific machines
Deploy Caddy only to edge machines:Deploying to specific machines is useful for edge deployments or when you want to control which machines handle public traffic.
DNS Record Updates
After deployment, Caddy automatically updates your cluster domain DNS records to point to machines running Caddy containers. Only internet-reachable machines are included in the DNS records. If no machines are reachable from the internet:Configuration Priority
Caddy uses configuration from multiple sources in this order:- Custom Caddyfile (via
--caddyfileflag) - prepended first - Auto-generated config - created from service port definitions
- Service-specific Caddy config - from
x-caddyin compose files
When to Use
Runuc caddy deploy:
- After initializing your first cluster
- When upgrading to a new Caddy version
- After adding new machines to the cluster
- When modifying global Caddy configuration
- To fix Caddy containers that stopped unexpectedly
Related Commands
uc caddy config- View current Caddy configurationuc service ls- Check Caddy service statusuc dns show- View cluster domainuc machine ls- List machines in cluster
