Snap caddy cant find Caddyfile

caddy version
v2.4.5 h1:P1mRs6V2cMcagSPn+NWpD+OEYUYLIf6ecOa48cFGeUg=

installed with
snap install caddy --edge

on Raspberry Pi
Linux pi 5.10.60-v7+ #1449 SMP Wed Aug 25 15:00:01 BST 2021 armv7l GNU/Linux

i created a file /tmp/Caddyfile but Caddy insists it does not exists and refuses to start :confused:

root@pi:/tmp# ls -lh /tmp/Caddyfile*
-rw-r--r-- 1 pi pi 122 Sep 29 12:00 /tmp/Caddyfile
root@pi:/tmp# cat /tmp/Caddyfile 
localhost:81 {
    respond "Hello, world!"
}
localhost:82 {
    respond "Goodbye, world!"
}
root@pi:/tmp# caddy adapt
adapt: input file required when there is no Caddyfile in current directory (use --config flag)
root@pi:/tmp# caddy adapt --config Caddyfile --validate
adapt: reading input file: open Caddyfile: no such file or directory
root@pi:/tmp# caddy adapt --config /tmp/Caddyfile 
adapt: reading input file: open /tmp/Caddyfile: no such file or directory
root@pi:/tmp# caddy start
start: opening listener for success confirmation: listen tcp 127.0.0.1:0: listen: operation not permitted

The snap is not an official installation method. Please use one of these installation methods instead:

You shouldn’t put your config in /tmp, that’s not a good location for it. The typical location is in /etc/caddy/Caddyfile, and is where our official installation methods puts a default Caddyfile.

I think the problem you’re running into is that the caddy snap is completely isolated from the rest of your system. That’s how snaps work, they run in an isolated environment with very limited permissions. This makes them extremely difficult to work with, despite all the “ease of use” marketing. I can’t recommend it for Caddy.

thanks @francislavoie

the tmp folder is just for testing purposes.

i will switch to one of the official installs and try again.

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