Try both raggr-green and raggr-blue in Cronicle scheduled messages script

Shell script falls back to the other color if the primary is down,
so the trigger works regardless of which container is currently active.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-09-17 08:10:44 -04:00
parent 6e72d5f95a
commit 0e80e8b9df
3 changed files with 7 additions and 6 deletions
-2
View File
@@ -129,8 +129,6 @@ CRON_SECRET=
# Used to auto-register scheduled jobs on startup.
CRONICLE_URL=http://cronicle:3012
CRONICLE_API_KEY=
# Internal URL raggr is reachable at from within the Cronicle container
RAGGR_INTERNAL_URL=http://raggr-green:8080
# SimbaKit / PetKit Configuration
# PetKit account credentials (used by SimbaKit to poll device data)
-1
View File
@@ -63,7 +63,6 @@ x-raggr-common: &raggr-common
- CRON_SECRET=${CRON_SECRET}
- CRONICLE_URL=${CRONICLE_URL:-http://cronicle:3012}
- CRONICLE_API_KEY=${CRONICLE_API_KEY}
- RAGGR_INTERNAL_URL=${RAGGR_INTERNAL_URL:-http://raggr-green:8080}
depends_on:
postgres:
condition: service_healthy
+7 -3
View File
@@ -64,7 +64,6 @@ async def ensure_cronicle_events() -> None:
return
cron_secret = os.environ.get("CRON_SECRET", "")
raggr_url = os.environ.get("RAGGR_INTERNAL_URL", "http://raggr-green:8080")
try:
events = await _get_events()
@@ -72,9 +71,14 @@ async def ensure_cronicle_events() -> None:
logger.info("Cronicle: '%s' already registered", _SCHEDULED_MESSAGES_TITLE)
return
trigger_cmd = (
"curl -sf -X POST {url}/api/scheduled-messages/trigger"
f" -H 'X-Cron-Secret: {cron_secret}'"
)
script = (
f"curl -sf -X POST {raggr_url}/api/scheduled-messages/trigger "
f"-H 'X-Cron-Secret: {cron_secret}'"
trigger_cmd.format(url="http://raggr-green:8080")
+ " || "
+ trigger_cmd.format(url="http://raggr-blue:8080")
)
event_id = await _create_event(_SCHEDULED_MESSAGES_TITLE, script)
logger.info(