Cron Launches
Cron Launches
Automatic Launch Update Configuration
This document explains how to configure the scheduled task to automatically update the launch statuses of channels at 8:00 AM UTC every day.
How it Works
The launch system works as follows:
- Channels are initially in
SCHEDULEDstatus with a programmed launch date. - At 8:00 AM UTC on the launch day, the status changes to
ONGOING. - At 8:00 AM UTC the next day, the status changes to
LAUNCHED.
Configuration on Coolify
1. Add Environment Variables
Add the following environment variables to your application on Coolify:
CRON_API_KEY=your_secret_key_here
APP_URL=https://your-domain.comCRON_API_KEY: A secret key to secure the API (generate a complex random string).APP_URL: The base URL of your application.
2. Configure the Scheduled Task
In Coolify, create a new scheduled task with the following parameters:
- Name:
update-launches - Command:
/app/scripts/update-launches.sh - Frequency:
0 8 * * *(every day at 8:00 AM UTC) - Container Name: The name of your application container.
3. Make the Script Executable
Ensure the script is executable by running this command in the container:
chmod +x /app/scripts/update-launches.shManual Test
To manually test the launch update, you can run:
curl -X GET \
-H "Authorization: Bearer your_secret_key_here" \
-H "Content-Type: application/json" \
"https://your-domain.com/api/cron/update-launches"Logging
Scheduled task logs are available in Coolify under the "Logs" tab of the scheduled task.
Troubleshooting
If the scheduled task fails, check the following:
CRON_API_KEYandAPP_URLenvironment variables are correctly defined.- The
/app/scripts/update-launches.shscript is executable. - The
/api/cron/update-launchesAPI is accessible. - Application logs to see potential errors.