The only other Caddy add-on I could find is geared more towards simple proxying using the Hass.io config while this add-on just let’s you supply a Caddyfile. I hope someone finds it useful!
To accomplish your goal, you’ll need a few pieces.
All of your services (zoneminder, etc) will need either static/reserved IPs or (better yet) DNS names set in your local DNS.
You’ll need a DDNS service (e.g. duckdns) if you can’t get a static IP from your ISP (doubtful) so you can access your router from the internet.
I really suggest you also set up Letsencrypt. It’s easy and it secures all of your services. You can add several subdomains to one certificate.
You’ll want to use separate subdomains for each service, e.g. mqtt.xxx.duckdns.org, appdaemon.xxx.duckdns.org, etc. You could theoretically use subpaths on a single domain, but some services don’t make it easy (or possible) to do this setup.
Then you set up a separate section in your Caddyfile for each service like:
Port forward 80 and 443 in your router to your Hass.io IP.octop, and you should be good to go.
If you want to use the same dns names in your local network, you’ll need to add each subdomain as a primary zone to your local dns and point it to the service.
You mention not using HTTPS or duckdns, but I don’t know how you’ll be able to do this without either.
Another nice add-on from @korylprince. Thanks for that!
May I suggest that you provide a single add-on repository url for all your add-ons? That way its easier not to miss anything from you. I’ve noticed your other add-ons only by accident and that’s a shame.
Okay, back to topic:
I’m currently running into rate limits by Let’s Encrypt. Presumably because I instruct Caddy to request a certificate for my domain (using tls [email protected]) instead of providing any *.pem files. It looks like cryptographic assets requested that way are not stored in ssl/... but in Caddy’s working directory (see The .caddy folder):
Is there any chance to alter this behavior or do I have to use another add-on to keep my certs up to date?
Honestly, with what you’re trying to do, the other Caddy add-on would probably be better/easier to use. It can do LetsEncrypt and the proxying all through the JSON config.
So you would do:
internet -> router – (forward 80, 443) --> rpi3( Caddy add-on and duckdns) – (internal IPs and ports) --> internal services
I may consider adding a single repository, but it involves a lot of duplication of configs and commits with the way the current system works.
I just pushed version 1.1 that sets CADDYPATH to /ssl so Caddy won’t request every time it starts and you can use it’s certificates in other add-ons. Sorry I missed that!
Okay, thanks for the clarification regarding the single repository. It’s completely understandable that you want to avoid code duplication.
I’ve tried v1.1 but ran into a problem.
Complete log:
starting version 3.2.4
2018/02/02 13:29:13 could not save user: making user directory: mkdir /ssl/acme: read-only file system
Activating privacy features...
Is there anything I can do on my side to solve it?
I can report it works as expected now. Several restarts and no more rate limits by Let’s Encrypt.
What I’ve noticed though is, that the add-on does not start (or at least not successfully) when rebooting the host OS. The Boot option is configured to auto. I can’t find any logs regarding that topic. Manually starting or restarting the add-on never fails.
I’d also like to know if/how to use the input field in the add-on’s “Options”. It’s configured {} by default. Is it intended to provide Caddy command line flags here? I’m thinking about using -disable-http-challenge removing the need to open port 80 on my router just for the challenge. It’s nothing major if this isn’t possible, but I thought I’d ask if it is.
I’ve added a flags configuration option in version 1.3. See the documentation here.
As for the issue with it not starting, the startup is set to “services” which means it starts before homeassistant is started. Are you referencing the “homeassistant” hostname in your Caddyfile?
Have you checked both the supervisor as well as the add-on logs?
I’ve replaced localhost in my caddyfile with 127.0.0.1 then but that didn’t change a thing. I’m still getting the message from above saying localhost has timed out…
I’ve googled that message and it looks like it is related to docker images themselves and not caddy. A user stated that may relate to the engine responding to slow under high load. Some user had success increasing the read timeout, other not.
Unfortunately I’m not able to evaluate if this might be a possible solution in this case but I can report that the add-on never fails to start when everything else is already up and running.
My test setup is a Raspberry Pi 3 running Mosquitto, SSH, Samba and (your) Node-RED next to this add-on.
The timeout was increased to 300s. Judging by the supervisor’s release history, I would expect it to be in version 0.86 which should come out within a couple weeks (total guess.)
hi! Trying to use your addon, but I cna’t connect. I think (think) I followed weel all the instructions, but can’t connect from outside.
I have static IP, a duckdns account, forwarded port 80 and 443 to HASSIO, where I ran your addon, with the above config.
Is there any log somewhere?
EDIT:
I had to wait a minute or so, I can now log from outside the network, cool.