Setting Up GitHub Actions for OpenUptimes Ping System
This document explains how to set up the GitHub Actions workflow to power the OpenUptimes ping system.
Overview
The OpenUptimes ping system uses GitHub Actions to schedule and execute regular ping checks of your monitored services. This approach offers several advantages:
- Reliable scheduling with GitHub's infrastructure
- Independent execution outside your application server
- Better handling of cold starts and server issues
- Detailed run history and logs in GitHub
Setup Steps
1. Repository Configuration
- Make sure your OpenUptimes application is in a GitHub repository
- The repository can be public or private
2. Create Required Secrets
- Go to your repository on GitHub
- Navigate to Settings > Secrets and variables > Actions
- Add the following secrets:
PING_API_KEY: A secure random string to authenticate ping requests (you define this)
3. Add Repository Variables
- In the same section, go to the Variables tab
- Add the following variable:
APP_URL: The full URL to your deployed OpenUptimes application (e.g.,https://status.example.com)
4. GitHub Actions Workflow File
The application includes a .github/workflows/ping.yml file that defines the workflow. This file should already be in your repository.
Key configurations in the workflow file:
- Schedule: Defined by the cron expression in the on.schedule section
- Authentication: Uses the PING_API_KEY secret
- Application URL: Uses the APP_URL variable
5. Application Configuration
- Go to the Ping Debug page in your OpenUptimes application
- Configure the GitHub Actions settings:
- Schedule: The cron expression for your desired check frequency (e.g.,
*/5 * * * *for every 5 minutes) - Repository: Your repository name (e.g.,
username/openuptimes) - Workflow: The name of the workflow file (default:
ping.yml) - Secret Name: The name of the secret containing the API key (default:
PING_API_KEY) - Enabled: Toggle to enable/disable GitHub Actions scheduling
6. Manually Trigger a Workflow Run
To test your setup: 1. Go to the Actions tab in your GitHub repository 2. Select the "OpenUptimes Ping Check" workflow 3. Click "Run workflow" and then "Run workflow" again to confirm 4. Check the logs to ensure the ping was successful
Troubleshooting
Common Issues
- Workflow not running on schedule
- GitHub may delay scheduled workflows during periods of high demand
-
Ensure your repository has activity; GitHub may disable schedules for inactive repositories
-
HTTP errors in workflow logs
- Verify your
APP_URLis correct and accessible from the internet -
Check that your application is running and the ping endpoint is accessible
-
Authentication failures
- Ensure the
PING_API_KEYsecret matches what your application expects
Viewing Logs
- Go to the Actions tab in your GitHub repository
- Click on any workflow run
- Expand the "Ping Service Check" job
- View the "Perform Ping" step to see detailed logs