Prevent your free-tier Render services from sleeping with automated, concurrent pinging and instant Telegram alerts.
Show your support by starring the repository or forking it to set up your own keep-alive service!
- About the Project
- Screenshots
- Features
- Deploy β Two Ways
- Telegram Notifications Setup
- Environment Variables
- Usage
- How It Works
- Project Structure
- Contributing
- License
Free-tier hosting services like Render automatically spin down your web applications after 15 minutes of inactivity. This project solves that by deploying a lightweight Python pinger as its own Render web service β it continuously pings all your endpoints concurrently every 10 minutes, keeping them alive 24/7. If any service goes down, you receive an instant Telegram alert.
The pinger also pings itself via the SELF_URL environment variable, creating a self-sustaining loop that prevents its own Render service from ever spinning down.
Real-time logs showing concurrent pings with status codes and latency for each site.
Instant Telegram notifications with site URL, status, and UTC timestamp when a service goes down.
- π One-Click Deploy β Deploy directly to Render with a single button click. Just set your env vars and go.
- β‘ Concurrent Pinging β All sites are pinged at the same time using Python's
ThreadPoolExecutor, not one-by-one. - π Smart Retry Logic β 2 automatic retries with a 5-second delay to avoid false positives from temporary network blips.
- π± Telegram Alerts β Instant notification via Telegram bot when any site is confirmed down after retries.
- β±οΈ Runs Forever β Pings every 10 minutes in an infinite loop. No cron jobs, no external schedulers.
- π Self-Ping β Pings its own URL to prevent Render from spinning down the pinger itself.
- π Health Endpoint β Built-in web server serves a JSON health check at
/with latest ping results. - π¦ Zero Dependencies β Uses only Python standard library (
urllib,threading,concurrent.futures). Nopip installneeded. - π§ Flexible Config β Provide site URLs via
SITESenv var (comma-separated) orsites.jsonfile β or both. - π .env Support β Built-in
.envfile loader for local development. On Render, use environment variables directly.
Choose the method that works best for you:
The quickest way to get started β no forking, no file editing. Just click, configure, and deploy.
-
Click the button below to deploy directly to Render:
-
Set environment variables when prompted:
SELF_URLβ Will be your new service's URL (set after first deploy, then redeploy)SITESβ Comma-separated list of URLs to keep alive:https://your-app1.onrender.com,https://your-app2.onrender.comTELEGRAM_TOKEN&TELEGRAM_CHAT_IDβ (optional) for downtime alerts
-
Done! Your pinger is live. Update
SELF_URLwith your service's URL and redeploy.
π‘ Tip: With this method, all your sites are managed through the
SITESenvironment variable in the Render dashboard. No files to edit β ever.
Best if you want full control over the repository and prefer managing sites via a config file.
-
Fork the Repository by clicking the "Fork" button at the top right of this page.
-
Edit
sites.jsonin your forked repository β list the URLs you want to keep alive:[ "https://your-app1.onrender.com", "https://your-app2.onrender.com" ]
-
Create a new Web Service on Render:
- Connect your forked GitHub repository
- Runtime:
Python - Build Command:
echo "No build step" - Start Command:
python Ping.py - Plan:
Free
-
Set Environment Variables in the Render dashboard (see Environment Variables).
π‘ Tip: You can also set the
SITESenv var alongsidesites.jsonβ both sources are merged automatically (duplicates removed).
To receive downtime alerts via Telegram:
- Create a bot with @BotFather on Telegram and copy the Bot Token.
- Get your Chat ID from @userinfobot or similar.
- Add both values as environment variables on Render (see below).
Alerts include:
- Site URL
- Status (DOWN / Timeout)
- UTC Timestamp
Set these in the Render Dashboard β your service β Environment:
| Variable | Required | Description |
|---|---|---|
SELF_URL |
Yes | Your Render service's own URL (e.g. https://render-keep-alive-xxxx.onrender.com). Enables self-ping to stay alive. |
SITES |
Yes* | Comma-separated URLs to keep alive (e.g. https://app1.onrender.com,https://app2.onrender.com). Required for one-click deploy. |
TELEGRAM_TOKEN |
Optional | Telegram bot token from @BotFather. |
TELEGRAM_CHAT_ID |
Optional | Chat ID where alerts are sent. |
PORT |
Auto | Render sets this automatically. No need to configure. |
*
SITESis required if you're using one-click deploy. If you forked the repo and added URLs tosites.json, thenSITESis optional.
Tip: For local development, create a
.envfile in the project root. The script loads it automatically.
Once deployed and configured, the service runs fully autonomously:
-
Automatic β Pings all sites from
SITESenv var and/orsites.jsonevery 10 minutes, forever. -
Self-sustaining β The
SELF_URLself-ping keeps the pinger itself from sleeping on Render's free tier. -
Add or Remove Sites β Update the
SITESenv var in Render dashboard (one-click deploy) or editsites.jsonand push (fork deploy). -
Health Check β Visit your service URL in a browser to see a live JSON report:
{ "status": "alive", "timestamp": "1970-01-01 00:00:00 UTC", "cycle": 42, "total_sites": 3, "up": 3, "down": 0, "results": [ { "url": "https://your-app1.onrender.com", "status": "up", "code": 200, "latency_ms": 285.3 }, { "url": "https://your-app2.onrender.com", "status": "up", "code": 200, "latency_ms": 312.7 } ] }
- Startup β
Ping.pystarts a web server on the port Render provides and spawns a background pinger thread. - Load Sites β Merges URLs from the
SITESenv var andsites.jsonfile (duplicates removed), then appendsSELF_URL(if set). - Concurrent Ping β Every 10 minutes, all sites are pinged simultaneously using
ThreadPoolExecutor. Each request uses a GET method with a 10-second timeout. - Retry on Failure β If a site fails, it retries up to 2 more times with a 5-second delay between attempts.
- Alert β If all retries fail, a Telegram alert is sent with the site URL, status, and timestamp.
- Self-Ping β The pinger's own URL is included in the ping list, creating an inbound request that resets Render's 15-minute inactivity timer.
- Health Endpoint β The web server responds to any incoming request with a JSON report of the latest ping cycle results.
Render-Keep-Alive/
βββ Ping.py # Main script β web server + background pinger
βββ render.yaml # Render Blueprint β enables one-click deploy
βββ sites.json # List of URLs to keep alive (fork-based deploy)
βββ .env.example # Example environment variables
βββ Screenshots/ # README screenshots
β βββ Logs.png
β βββ TelegramNotification.png
βββ LICENSE # MIT License
βββ README.md # This file
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.

