Renato Pozzi's Blog

Renato Pozzi's Blog

How to keep a free Heroku Dyno up with Github Actions

How to keep a free Heroku Dyno up with Github Actions

Subscribe to my newsletter and never miss my upcoming articles

Heroku, platform as a service (PaaS) that enables developers to build, run and operate applications entirely in the cloud. Has a generous free plan with 500 hundred hours of dyno uptime, increased to 1000 hours if we insert a payment method.

The Problem

The downside of the free tier is that every free dyno will be shut down after 30 mins of inactivity, so if you need to keep up the dyno for some reason you have a problem.

The Solution

Fortunately, GitHub's actions came to our rescue! With the Github Actions, we can create a cron scheduler of the action, doing a simple cURL to our Heroku Dyno Endpoint every 15 or 20 Minutes. By doing this, we can keep up our dyno, using the Heroku Free Plan.

The Example

Here, an example of how to use the action:

name: Trigger Heroku App Every Quarter

on:
  schedule:
    - cron: '*/15 * * * *'
jobs:
  build:
    name: Trigger App
    runs-on: ubuntu-latest
    steps:
      - name: cURL request
        run: curl https://your-app-url.herokuapp.com

Thank you for reading this article, I really appreciate it.

Let's Connect!: Twitter | Linkedin

Seeya!

 
Share this