Running caddy using supervisor

I need help with running the caddy program using supervisor. Caddy runs without any problems when I run it from the terminal using

sudo caddy -conf="/home/myusername/Caddyfile

However, when I use the following supervisor script to run caddy; it fails to serve the website. The log shows that Caddy is asking for my email. Since supervisor is running it, I don’t know how to give it the email address. Caddy asked me for the email the first time I ran from the terminal (using sudo caddy). I gave it the email addresses at that time; and now it does not ask me for email when I run it from the terminal directly.

In short, how do I run Caddy using supervisor? Thank you.

[program:caddy] command=caddy -conf="/home/myusername/Caddyfile" autostart=true autorestart=true user=myusername redirect_stderr=true stdout_logfile=/var/log/supervisor/caddy.log stdout_logfile_maxbytes=50MB stdout_logfile_backups=10

I don’t know how to use supervisor, but the CLI page recommends flags you should set when running in automated environments.

Thank you, I can try giving email (and the other options) at the command line.

The problem appears to be that currently I am running caddy as a root user (using sudo). I tried running it without sudo after executing

setcap cap_net_bind_service=+ep /usr/local/bin/caddy

But it did not run because for some reason it was not able to save the certificate in the appropriate location (within the .caddy folder).

Now it seems I have hit the rate limit. So, I have to wait for some time before I try the above solution, or I will try with staging server.

Thanks for your suggestion.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.