DEV Community 👩‍💻👨‍💻

Cover image for Prevent Heroku Server from Sleeping for FREE
Jatin Sharma
Jatin Sharma

Posted on

Prevent Heroku Server from Sleeping for FREE

In this article, I am gonna tell you about how you can run the Heroku server free for a lifetime. So let's get into it.

As you may have known that Heroku does not allow your app to run for more than 1 hour. When an app on Heroku has only one web dyno and that dyno doesn't receive any traffic in 1 hour, the dyno goes to sleep.

When someone accesses the app, the dyno manager automatically wakes up the web dyno to run the web process type. This causes a short delay for this first request, but subsequent requests perform normally.

So now how can we run it forever without sleep? so that web process or API request doesn't have any kind of delay.

Heroku

Firstly you need to have a Heroku app which can be a new or old one. if you don't have a Heroku app Click Here

Create an Heroku App

Now the next part is the domain of the app if you know the domain then you can skip this part. To get the domain you can go to Settings > Domain.

domain

UptimeRobot

Now is the main part we need to use service called UptimeRobot. Create an account for free and then you will see the dashboard same as below -

dashboard

Click on the Add New Monitor on the Top Left corner. It will open a dialog box

dialog

Monitor Type - should be HTTPs
Friendly Name - Name of your app (anything)
URL or IP - root domain of heroku app such as https://your-domain-name.herokuapp.com/
Monitoring Interval - the time difference between two requests. (recommended 20 minutes)
Monitor Timeout - the max time it wait for the server to respond

Then Click on Create monitor on the bottom right corner.

After that, it will create the monitor server which will send requests to the Heroku server constantly for a lifetime and you can even check the details of the monitor and the server response time.

res

Conclusion

With the help of UptimeRobot, we create the robot server which sends automatic requests to the server after the certain time period which we have specified earlier.

If you like it then you can now extend your support by buying me a Coffee.😊👇

Buy Me A Coffee

You might be interested in -

Top comments (2)

Collapse
 
segoy89 profile image
segoy89

There's also kaffeine.herokuapp.com/
No sign up but also no dashboard nor status page.

Collapse
 
j471n profile image
Jatin Sharma Author

Yes this could also work, thanks for sharing :)

🌚 Browsing with dark mode makes you a better developer by a factor of exactly 40.

It's a scientific fact.