Caddyfile Dynamodb Configuration Syntax

1. Caddy version (caddy version):

2.4.5

2. How I run Caddy:

a. System environment:

Docker for macOS v20.10.8
macOS 11.3.1

b. Command:

In folder containing Dockerfile and Caddyfile:

docker build -t caddy-test .
docker run -e "DYNAMODB_TABLE=caddy-storage" -e "DYNAMODB_REGION=us-east-2" -p 80:80 -p 443:443 caddy-test

c. Service/unit/compose file:

Dockerfile

FROM caddy:2.4.5-builder-alpine AS builder
RUN xcaddy build --with github.com/silinternational/certmagic-storage-dynamodb@2.0.1

FROM caddy
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
COPY Caddyfile /etc/caddy/Caddyfile

d. My complete Caddyfile or JSON config:

{
	on_demand_tls {
		ask https://www.oursite.com/api/domain/verification
	}

	storage dynamodb {$DYNAMODB_TABLE} {
		aws_region {$DYNAMODB_REGION}
		lock_polling_interval 5s
		lock_timeout 5m
	}
}

https:// {
	tls {
		on_demand
	}

	handle {
		rewrite * /web?uri={path}&host={host}

		reverse_proxy https://www.oursite.com {
			header_up Host {upstream_hostport}
			header_up X-Forwarded-Host {host}
		}
	}
}

3. The problem I’m having:

Neither the lock_polling_interval nor the lock_timeout from the storage config seem to be accepted by Caddy. It works if I omit those two options, but I prefer declarative, explicit configuration values as opposed to relying on implicit defaults.

Does the Caddyfile support the lock options for the dynamodb storage plugin?

4. Error messages and/or full log output:

{"level":"info","ts":1636041834.6633754,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}
run: adapting config using caddyfile: parsing caddyfile tokens for 'storage': /etc/caddy/Caddyfile:8 - Error during parsing: unrecognized parameter 'lock_timeout'

and (depending on which of the lock options is first in the config)

run: adapting config using caddyfile: parsing caddyfile tokens for 'storage': /etc/caddy/Caddyfile:8 - Error during parsing: unrecognized parameter 'lock_polling_interval'

5. What I already tried:

It works if I omit the values. I also tried removing the underscores, e.g. lockpollinginterval but to no avail.

The documentation for the JSON config has underscores: Modules - Caddy Documentation

And this github issue for the dynamodb storage plugin mentions the lock options:

6. Links to relevant resources:

N/A

I don’t think the Caddyfile adapter supports that option. See the code:

Best if you open an issue with the plugin repo and ask for help, since this is a third party plugin.

2 Likes

This topic was automatically closed after 30 days. New replies are no longer allowed.