I have heard great things for Traefik because it integrates nicely with containers. Which webserver are you using, is there Nginx on top of Gunicorn? I'd google if youe webserver has integrations to certbot... Perhaps you need to approach from a different perspective
Docker
I second this, it is easy to set up Traefik as a reverse proxy with automatic certificate renewal.
is there Nginx on top of Gunicorn?
you are right.
The -b
in crond -b
means to run it as a daemon (in the background), though it appears that is also the default (source). This means the script will continue, but since that's the last line it exits. With the entrypoint stopped, the container also stops.
The fix should be to replace that line with exec crond -f
so the crond
process runs in the foreground and becomes the main process running in the container, replacing the entrypoint script. crond -f
without exec
should also work, but that needlessly keeps an extra process (the shell running the entrypoint script) alive.
crond -f
withoutexec
should also work, but that needlessly keeps an extra process (the shell running the entrypoint script) alive.
with exec it throws
setpgid: operation not permitted
Due to permission issues with the Docker user group, will avoid using exec as it introduces a potential security risk, which isn't a sensible trade-off just to keep a process running in the background.
guess this will get the job done.
Traefik or Caddy will do certificate management automatically for you and both of them work amazingly well as a proxy for a gunicorn server.
Just curious: What manual intervention do you need to do when renewing? That might point to a possible root cause for why it's not working
just restarting lol.
Anything in the cron logs? Maybe you could try sending the output of the cron job to a log file to see where it gets hung up.