einschmidt / addon-caddy-2

Caddy 2 is a powerful, open source web server with automatic HTTPS
MIT License
30 stars 9 forks source link

Caddyfile not loaded in one of latest updates #230

Open llevering opened 2 weeks ago

llevering commented 2 weeks ago

After the (for me) last update I couldn´t reach my Home Assistant sitting behind the reverse proxy of this proxy addon anymore. Took me quite some time to realise what was going on and then how to resolve it.

Behore I had my Caddyfile /config/caddy/Caddyfile and it worked like a charm. I gather it know has to be in /addon_configs/c80c7555_caddy-2 . Did I miss some warning about this change? And might it be possible to move the config automatically?

Hopefully this issue at least helps some people who are searching why their Caddy setup broke out of nowhere. :)

And to be clear, I am still very happy and thankful that you package Caddy for us as an addon, it is a great tool to use!

trickinit commented 2 weeks ago

This change was listed in the release notes with instructions to move custom caddyfiles to the new directory.

Lukeslowly commented 2 weeks ago

It’s not so celar how to access to the new folder. Could someone explain how to do it?

thanks

llevering commented 2 weeks ago

@trickinit Ok so it is a issue of HA OS installing major versions automatically. I have to find out how to prevent that, without getting bothered by all the minor updates.

@Lukeslowly you can access it via ssh or smb sharing (the last one depending how it is setup). It is one level up from the config directory, which is a little inconvenient as the standard file browser and vscode add-on by default restricted to the config folder.

cmussoni commented 6 days ago

I have exactly the same problem. Where exactly should the new folder "/addon_configs/c80c7555_caddy-2" be created, under or above the /config folder? If I revert to version 1.5.3 everything works fine. The Caddy2 log still gives me this:

s6-rc: info: service legacy-services successfully started
INFO: Prepare Caddy... 
INFO: Checking path: /config/caddy 
INFO: Use built-in Caddy v2.8.4 h1:q3pe0wpBj1OcHFZ3n/1nl4V4bxBrYoSoab7rL9BMYNk= 
INFO: Prepare Caddyfile... 
**INFO: No Caddyfile found** 
INFO: Use non_caddyfile_config 
INFO: Run Caddy... 
{"level":"info","ts":1727343226.047366,"msg":"using config from file","file":"/etc/caddy/Caddyfile"}.

This is my Caddy2 configuration:

non_caddyfile_config: 
  email: your@email.com 
  domain: xxxx.duckdns.org:9000 
  destination: localhost
  port: 8123 
args: 
  - "--watch" 
env_vars: []
log_level: info
config_path: /addon_configs/c80c7555_caddy-2/Caddyfile.

Thanks for any response.

trickinit commented 6 days ago

@cmussoni I don't believe you have to create the folder. Updating Caddy2 should have already done so. The /addon_configs folder should be in the root of your Home Assistant installation, so up a level from the /config folder you've been using.

Lukeslowly commented 6 days ago

@cmussoni You have to modify the setting of the file editor adding installed in your HA. Go in file editor configuration page then disabling enforce basepath. Restart the addon, then you were able to go up one level in file editor addon and finally you will be able to access to the caddy 2 folder where you can place the config file.

Honestly speaking the installation instruction of caddy 2 addon it’s not so clear….

cmussoni commented 6 days ago

@trickinit @Lukeslowly Perfect, so I finally solved it. It wasn't that clear to me. Thank you very much.

Lukeslowly commented 5 days ago

🤙😎