Caddy — a fast web server and reverse proxy with automatic HTTPS. Deployed as a host-networked Nomad service with a Caddyfile rendered from a variable and a data volume that persists ACME certificates. Edit the caddyfile variable to serve files or reverse-proxy your apps.
Save as values.hcl, edit, then run:
# The name of the Nomad job.
job_name = "caddy"
# The Nomad namespace to deploy into.
namespace = "default"
# The datacenters to deploy to.
datacenters = ["*"]
# The Caddy container image. Pin a tag in production.
image = "caddy:2"
# Host port for HTTP.
http_port = 80
# Host port for HTTPS (automatic TLS when you use a domain in the Caddyfile).
https_port = 443
# The full Caddyfile. The default responds on http_port; replace it to serve files (`root * /srv` + `file_server`) or reverse-proxy (`reverse_proxy 127.0.0.1:PORT`). For automatic HTTPS, use a real domain as the site address.
caddyfile = <<-EOT
:80 {
respond "Caddy is running on nomploy — edit the caddyfile variable to add sites."
}
EOT
# Named volume for Caddy's data — ACME certificates and state (/data).
data_volume = "caddy_data"
# Placement constraints. Pin to the node holding the volume. On a nomploy cluster: attribute = "$${meta.nomploy_control_plane}", operator = "=", value = "true".
constraints = []
# The task resources.
resources = {
cpu = 300
memory = 256
}
| Name | Type | Default | Description |
|---|---|---|---|
| job_name | string | "caddy" | The name of the Nomad job. |
| namespace | string | "default" | The Nomad namespace to deploy into. |
| datacenters | list | ["*"] | The datacenters to deploy to. |
| image | string | "caddy:2" | The Caddy container image. Pin a tag in production. |
| http_port | number | 80 | Host port for HTTP. |
| https_port | number | 443 | Host port for HTTPS (automatic TLS when you use a domain in the Caddyfile). |
| caddyfile | string | <<-EOT
:80 {
respond "Caddy is running on nomploy — edit the caddyfile variable to add sites."
}
EOT | The full Caddyfile. The default responds on http_port; replace it to serve files (`root * /srv` + `file_server`) or reverse-proxy (`reverse_proxy 127.0.0.1:PORT`). For automatic HTTPS, use a real domain as the site address. |
| data_volume | string | "caddy_data" | Named volume for Caddy's data — ACME certificates and state (/data). |
| constraints | list | [] | Placement constraints. Pin to the node holding the volume. On a nomploy cluster: attribute = "$${meta.nomploy_control_plane}", operator = "=", value = "true". |
| resources | object | {
cpu = 300
memory = 256
} | The task resources. |
No variables match.
Caddy — a fast web server and reverse proxy with automatic HTTPS.
Host-networked Nomad service with a Caddyfile rendered from a variable and a /data volume that
persists ACME certificates.
nomad-pack registry add nomploy https://github.com/Nomploy/nomad-packs
nomad-pack run caddy --registry=nomploy
| Variable | Default | Description |
|---|---|---|
http_port |
80 |
HTTP port. |
https_port |
443 |
HTTPS port (auto-TLS with a domain). |
caddyfile |
a :80 placeholder |
The full Caddyfile — replace it. |
data_volume |
caddy_data |
/data — ACME certificates and state. |
image |
caddy:2 |
Container image. Pin a tag in production. |
resources |
{ cpu = 300, memory = 256 } |
Task resources. |
Reverse proxy with automatic HTTPS (domain must resolve here, 80/443 reachable):
app.example.com {
reverse_proxy 127.0.0.1:8096
}
Static file server:
:80 {
root * /srv
file_server
}
Certificates persist on the data_volume; pin the job to that node with constraints.