Help running a Caddy v2 instance on Fly?

I’m trying to spin up a Caddy v2 instance on Fly to use as a reverse proxy, but I’m having a hard time configuring it all, and docker isn’t my strong suit. If anyone has an example toml file or a guide somewhere, I’d really appreciate it.

Normally I’d run it on some VPS as a systemd service, and manage it using the json admin API.

I’ve spun up an app on here from the latest caddy docker image on dockerhub, but I’m not sure how to get it to behave the same way as I described above, or really how to interact with it at all. My toml file is:

app = "young-haze-8747"

kill_signal = "SIGINT"
kill_timeout = 5

  image = "caddy/caddy"


  http_checks = []
  internal_port = 8080
  protocol = "tcp"
  script_checks = []

    hard_limit = 25
    soft_limit = 20
    type = "connections"

    handlers = ["http"]
    port = 80

    handlers = ["tls", "http"]
    port = 443

    grace_period = "1s"
    interval = "15s"
    restart_limit = 6
    timeout = "2s"

Any help I can get will be really appreciated!

I had a Google but was unable to find a relevant example for you.

You’re likely going to want to extend the caddy/caddy image, creating a new image FROM caddy/caddy that includes a configuration file using ADD ... or COPY ....

Alternatively, you can use caddy/caddy but you’ll need to then add a volume to your Fly app to include Caddy configuration.

One thing to bear in mind is that you’ll need to default to IPv6 endpoints if your proxied (origin) services are other Fly apps or tunneled through WireGuard.

1 Like