Fix certificate renewal cron job and add host-side scheduling
All checks were successful
HAProxy Manager Build and Push / Build-and-Push (push) Successful in 1m0s

- Fixed crontab permissions (600) and ownership for proper cron execution
- Added PATH environment variable to crontab to prevent command not found issues
- Created dedicated renewal script with comprehensive logging and error handling
- Added retry logic (3 attempts) for HAProxy reload with socket health checks
- Implemented host-side renewal script for external cron scheduling via docker exec
- Added crontab configuration examples for various renewal schedules
- Updated README with detailed certificate renewal documentation

This resolves issues where the cron job would not run or hang during execution.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-28 17:36:48 -07:00
parent 288f4eb8a9
commit 76b2e85ca8
5 changed files with 229 additions and 1 deletions

View File

@@ -0,0 +1,26 @@
# HAProxy Manager - Host-side Crontab Example
# Add this to your host machine's crontab to schedule certificate renewals
#
# Edit your crontab with: crontab -e
# View your crontab with: crontab -l
#
# The script will run inside the container and handle all logging internally.
# Host-side logs will be written to /var/log/haproxy-manager-host-renewal.log
# Run certificate renewal every 12 hours at the top of the hour
0 */12 * * * /path/to/haproxy-manager-base/scripts/host-renew-certificates.sh
# Alternative: Run at specific times (e.g., 2 AM and 2 PM daily)
# 0 2,14 * * * /path/to/haproxy-manager-base/scripts/host-renew-certificates.sh
# Alternative: Run once daily at 3 AM
# 0 3 * * * /path/to/haproxy-manager-base/scripts/host-renew-certificates.sh
# Custom container name example (if your container has a different name):
# 0 */12 * * * CONTAINER_NAME=my-haproxy /path/to/haproxy-manager-base/scripts/host-renew-certificates.sh
# Custom log file location example:
# 0 */12 * * * LOG_FILE=/custom/path/renewal.log /path/to/haproxy-manager-base/scripts/host-renew-certificates.sh
# With both custom settings:
# 0 */12 * * * CONTAINER_NAME=my-haproxy LOG_FILE=/custom/path/renewal.log /path/to/haproxy-manager-base/scripts/host-renew-certificates.sh