Disabling file storage

1. The problem I’m having:

We are deploying Caddy combined with FrankenPHP in Kubernetes, and we’d like to disable most (if not all) “automated” things in Caddy as they’re taken care of by Kubernetes. I’ve already managed to disable admin, auto ssl, config persist etc.

The last thing I’d like to disable is the data directory / storage by Caddy. I don’t think it has any use at this point, and I’m trying to make my containers read-only. This is the only thing that seems to hold me back from that.

How can I disable storage in Caddy (and is it even possible)?

2. Details

Config

{
	frankenphp {
		{$FRANKENPHP_CONFIG}
	}

    servers {
        # Enable metrics
        metrics
    }

    admin off
	persist_config off
    auto_https off

	log default {
		output stdout
		format json
        level {$CADDY_LOG_LEVEL:INFO}
	}
}

:9253 {
    log

    # Enable metrics endpoint 
    metrics
}

:8080 {
    log

	root * public/
	encode zstd br gzip

	php_server
}

Logs

❯ docker run -p 8080:8080 -p 9253:9253 test:latest
{"level":"info","ts":1727424319.6830907,"msg":"using config from file","file":"/etc/caddy/Caddyfile"}
{"level":"info","ts":1727424319.6843498,"msg":"adapted config to JSON","adapter":"caddyfile"}
{"level":"warn","ts":1727424319.6843605,"msg":"Caddyfile input is not formatted; run 'caddy fmt --overwrite' to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":6}
{"level":"info","ts":1727424319.6846898,"msg":"redirected default logger","from":"stderr","to":"stdout"}
{"level":"warn","ts":1727424319.6846974,"logger":"admin","msg":"admin endpoint disabled"}
{"level":"info","ts":1727424319.684908,"logger":"http.auto_https","msg":"automatic HTTPS is completely disabled for server","server_name":"srv0"}
{"level":"info","ts":1727424319.6849177,"logger":"http.auto_https","msg":"automatic HTTPS is completely disabled for server","server_name":"srv1"}
{"level":"info","ts":1727424319.6850004,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc00067af00"}
{"level":"info","ts":1727424319.6853867,"msg":"FrankenPHP started 🐘","php_version":"8.3.11","num_threads":16}
{"level":"info","ts":1727424319.6870286,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]}
{"level":"info","ts":1727424319.6873245,"logger":"http.log","msg":"server running","name":"srv1","protocols":["h1","h2","h3"]}
{"level":"info","ts":1727424319.687359,"msg":"serving initial configuration"}
{"level":"info","ts":1727424319.691644,"logger":"tls","msg":"cleaning storage unit","storage":"FileStorage:/data/caddy"}
{"level":"info","ts":1727424319.692011,"logger":"tls","msg":"finished cleaning storage units"}

test:latest is my locally build Docker image build from FrankenPHP + Caddy.

Data still seems to be present in /data/caddy within the Docker container:

www-data@b74ad1dbdbb1:/data/caddy$ ls -lah
total 8.0K
drwxr-xr-x. 1 www-data www-data  66 Sep 27 08:06 .
drwxr-xr-x. 1 root     root      10 Sep 26 04:02 ..
-rw-------. 1 www-data www-data  36 Sep 27 08:06 instance.uuid
-rw-------. 1 www-data www-data 107 Sep 27 08:06 last_clean.json
drwx------. 1 www-data www-data   0 Sep 27 08:06 locks

3. Caddy version:

FrankenPHP v1.2.5 PHP 8.3.11 Caddy v2.8.4

4. How I installed and ran Caddy:

By using a pre-build FrankenPHP Docker container (1.2.5-php8.3.11-bookworm).

a. System environment:

containerd

Thanks!

I don’t understand, you’ve already turned off the things that actually do any writes to storage.

Please completely fill out the help topic template as per the forum rules. Your config and logs are relevant here to understand your concerns.

1 Like

I’m sorry, my mistake. Should’ve added that from the get go. Thank you for your response.

I’ve added the necessary details, also showing the files that’re still generated.

I see, thanks. This should do what you need:

2 Likes

That seems awesome. Thank you very much for your fast response and MR! Did not except it so quickly.

1 Like