Skip to content

Keep Render Services Alive #9119

Keep Render Services Alive

Keep Render Services Alive #9119

name: Keep Render Services Alive
on:
schedule:
- cron: '*/2 * * * *'
workflow_dispatch:
push:
branches:
- main
- master
jobs:
ping-services:
runs-on: ubuntu-latest
steps:
- name: Ping API Gateway
id: ping-api
run: |
echo "Sending ping to API Gateway..."
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" -X POST https://codebrewery-api-gateway.onrender.com/execute \
-H "Content-Type: application/json" \
-d '{"language":"python","code":"print(\"Keeping service alive\")"}')
echo "Received status code: $HTTP_STATUS"
if [[ "$HTTP_STATUS" -ge 200 && "$HTTP_STATUS" -lt 300 ]]; then
echo "API Gateway ping successful!"
else
echo "::warning::API Gateway ping returned status code $HTTP_STATUS"
fi
- name: Ping Code Execution Service
id: ping-execution
run: |
echo "Sending ping to Code Execution Service..."
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" -X POST https://codebrewery-code-execution-service.onrender.com/execute \
-H "Content-Type: application/json" \
-d '{"language":"python","code":"print(\"Keeping service alive\")"}')
echo "Received status code: $HTTP_STATUS"
if [[ "$HTTP_STATUS" -ge 200 && "$HTTP_STATUS" -lt 300 ]]; then
echo "Code Execution Service ping successful!"
else
echo "::warning::Code Execution Service ping returned status code $HTTP_STATUS"
fi
- name: Timestamp
run: echo "Services pinged at $(date)"