feat(caddy): make cluster storage for Caddy default, remember 'uc caddy deploy' options

This commit is contained in:
Pasha Sviderski
2026-11-05 16:03:34 +10:00
parent 76b04dd56c
commit 22b1c68798
13 changed files with 1173 additions and 98 deletions
@@ -156,7 +156,7 @@ Waiting for the machine to be ready...
Reserved cluster domain: sh8hsb.uncld.dev
[+] Deploying service caddy 2/2
✔ Container caddy-d7uk on machine-dc3c Running 11.1s
✔ Image caddy:2.11.4 on machine-dc3c Pulled 3.7s
✔ Image ghcr.io/unlabs-dev/caddy-uncloud:0.1.3 on machine-dc3c Pulled 3.7s
Updating cluster domain records in Uncloud DNS to point to machines running caddy service...
[+] Verifying internet access to caddy service 1/1
@@ -216,9 +216,9 @@ uc ls
```
```
NAME MODE REPLICAS IMAGE ENDPOINTS
caddy global 1 caddy:2.11.4
excalidraw replicated 1 excalidraw/excalidraw:latest https://excalidraw.sh8hsb.uncld.dev → :80
NAME MODE REPLICAS IMAGE ENDPOINTS
caddy global 1 ghcr.io/unlabs-dev/caddy-uncloud:0.1.3
excalidraw replicated 1 excalidraw/excalidraw:latest https://excalidraw.sh8hsb.uncld.dev → :80
```
You can see `caddy` service listed here. That's your reverse proxy, running as a regular Uncloud service.
@@ -25,10 +25,6 @@ When you [publish a service port](2-publishing-services.md), Uncloud automatical
For advanced use cases, Uncloud allows to customise the Caddy config using the `x-caddy` extension in Compose files.
See [Custom Caddy configuration](2-publishing-services.md#custom-caddy-configuration) for details.
:::tip Shared TLS certificates
Uncloud also provides native cluster storage for Caddy. It shares TLS certificates and ACME challenge tokens across
Uncloud configures Caddy to use cluster storage by default. It shares TLS certificates and ACME challenge tokens across
machines and coordinates certificate issuance. See [Cluster storage for Caddy](4-cluster-storage-for-caddy.md)
to enable it.
:::
for details.
@@ -7,17 +7,59 @@ Deploy or upgrade Caddy reverse proxy across all machines in the cluster.
Deploy or upgrade Caddy reverse proxy across all machines in the cluster.
A rolling update is performed when updating existing containers to minimise disruption.
By default, this deploys the latest version of the Uncloud Caddy image with a global config that enables cluster
storage for TLS certificates. See https://github.com/unlabs-dev/caddy-uncloud for more details.
Values set with --image, --caddyfile, and --machine are kept for later deployments. Pass an empty value to reset
a flag to its default.
If this command didn't deploy the current caddy service, for example, it was deployed with 'uc deploy'
from a Compose file or an older version of uc, the deployment replaces its configuration.
Requires Uncloud daemon 0.22.0 or newer on all machines.
```
uc caddy deploy [flags]
```
## Examples
```
# Deploy Caddy or upgrade it to the latest version of the Uncloud Caddy image.
uc caddy deploy
# Deploy a custom image and keep it for later deployments.
uc caddy deploy --image ghcr.io/unlabs-dev/caddy-uncloud:0.1.3
# Go back to the latest version of the Uncloud Caddy image.
uc caddy deploy --image ""
# Deploy a custom image build and a custom global Caddy config and keep both for later deployments.
uc caddy deploy --image myorg/caddy-uncloud:latest --caddyfile global.Caddyfile
# Go back to the default global Caddy config but keep the custom image.
uc caddy deploy --caddyfile ""
# Deploy only to specific machines and keep them for later deployments.
uc caddy deploy --machine machine1,machine2
# Go back to deploying to all machines.
uc caddy deploy --machine ""
```
## Options
```
--caddyfile string Path to a custom global Caddy config (Caddyfile) that will be prepended to the auto-generated Caddy config.
An empty value resets it to the default config that enables cluster storage.
(default is the current custom config or the default config)
-h, --help help for deploy
--image string Caddy Docker image to deploy. (default caddy:LATEST_VERSION)
-m, --machine strings Machine names or IDs to deploy to. Can be specified multiple times or as a comma-separated list. (default is all machines)
--image string Caddy Docker image to deploy. It must include the Uncloud storage module if the Caddy config uses it.
An empty value resets it to the latest version of the Uncloud Caddy image.
(default is the current custom image or ghcr.io/unlabs-dev/caddy-uncloud:LATEST_VERSION)
-m, --machine strings Machine names or IDs to deploy to. Can be specified multiple times or as a comma-separated list.
An empty value resets it to all machines.
(default is the current machines or all machines)
```
## Options inherited from parent commands