Learn Docker With My Newest Course

Dive into Docker takes you from "What is Docker?" to confidently applying Docker to your own projects. It's packed with best practices and examples. Start Learning Docker →

Create a Health Check URL in Your Web App and Monitor Its Uptime

create-a-health-check-url-in-your-web-app-and-monitor-its-uptime.jpg

In this video, we'll go over how to set up a health check endpoint in Flask and use the free UptimeRobot service to monitor your uptime.

Quick Jump:

After watching this 5 minute video you’ll know how to create a custom health check endpoint in your app that double checks your database connection and also get notified by email from a free monitoring service if your site ever happens to go down.

# Demo Video

Timestamps

  • 0:35 – Creating a health check endpoint in a Flask app
  • 2:41 – UptimeRobot (free) monitors and notifies you by email if your site goes down

Code

An example of creating a minimal /healthy health check endpoint in Flask which also checks your database to make sure it’s able to be connected to.

@page.route('/healthy')
def healthy():
    db.engine.execute('SELECT 1')

    return ''

Reference Links

How do you have your health check endpoint set up? Let me know below.

Never Miss a Tip, Trick or Tutorial

Like you, I'm super protective of my inbox, so don't worry about getting spammed. You can expect a few emails per year (at most), and you can 1-click unsubscribe at any time. See what else you'll get too.



Comments