SteveLTN / https-portal

A fully automated HTTPS server powered by Nginx, Let's Encrypt and Docker.
MIT License
4.46k stars 295 forks source link

Use s6-overlay mechanisms for cron environment #262

Closed MarcelWaldvogel closed 3 years ago

MarcelWaldvogel commented 3 years ago

While trying to understand the s6-overlay and https-portal workings more in depth for #261, I noticed that s6-overlay provides with-contenv. Using that obviates the need for maintaining the environment in /etc/cron_env.sh a second time. This PR makes things more s6-overlay-ish (and simplifies operation). This addresses question 1 from #260.

(When reading the s6-overlay documentation, I got the impression that just setting S6_KEEP_ENV globally (i.e., from the Dockerfile) would make the Dockerfile environment available to all processes. However, this does not seem to be the case, it just suppressed reloading the environment in child with-contenv-based processes.)

SteveLTN commented 3 years ago

I will try it. I made the mistake before, trusting some documentation and cron jobs ended up not having the ENVs. One need to actually see the job running from cron (not manually trigger it in bash) to confirm.

MarcelWaldvogel commented 3 years ago

Yes, documentation can indeed be misleading.

I am running this version on the two servers I mentioned previously and have

  1. created a debug entry, which would ran env or with-contenv env every minute, and without with-contenv, it just prints HOME, LOGNAME, PATH, SHELL, and PWD; with with-contenv, it prints DOMAINS etc. as well.
  2. changed the crontab firing time for renew and logrotate. I got output for all the renewal deferrals. It did not rotate logs, however (see another issue).