How keep running your free Heroku Dyno?

In my last post I explained how to host your playwright code on heroku. In my code I am running a task once a day. Basically, my dyno instance is doing nothing for 99.9% of the time. Its the most ideal a server can be.

After deploying it I realized Heroku was changing the state of the dyno server to ideal and the service was stopped. At the time the URL was hit again in a day it would bring the service up but not the cron job i was running because that was exposed to an API that I had to hit manually.

To overcome this there were two options I write the logic in my code where I would update the server startup code to start the cron job at the same time or add some metrics to to my API which will automatically check the health of my API. I choose the later and checked if there are options to add new reliec or something to my dyno server but I couldn’t find it for free.

I looked at the options outside of heroku and finalized on UptimeRobot. Its a very simple service which gives you 5 URLs to monitor for free. I just added the health endpoint of my service to monitor now which it checks every 20 minutes. This was my service is never ideal as every 20 minutes a request goes to check if its up or not and I am getting the monitoring metrics from uptime as well.

Hope you learned something from from this short article. Leave your comments for any feedback and suggestions. Happy learning happy coding.

--

--

--

#IBMER #JS-Advocate #SoftwareEngineer #TechnologyLover #Learner #intermediatetennisplayer #lifebetweenthebraces{}

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Ray: A Distributed Framework for Reinforcement Learning Applications

Don’t use Rails console sandbox in production

Database Synchronization with SymmetricDS: Performance Tips

Business Logic Error Methodology (easy way) + PoC-s

Functional Dynamic Programming With Haskell

How Much Does It Cost To Develop a YouTube Mobile App?

Creating a RESTful API for techno events: Introduction

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Akshay Mattoo

Akshay Mattoo

#IBMER #JS-Advocate #SoftwareEngineer #TechnologyLover #Learner #intermediatetennisplayer #lifebetweenthebraces{}

More from Medium

Clone of Internshala

CLONING RELIANCE DIGITAL

Pros and Cons of Chrome Extension for indie developer

COMBINATION OF REACT TO WORDPRESS.