Creating a continuously deploying static statuspage with GitHub

A status page is essentially a web page that reports the health and uptime of an organization’s various online services. GitHub has one and so does Cloudflare. Most of these are powered by an Atlassian product called Statuspage but it’s not always the cheapest solution.

For hobbyist projects without any real budget (like this site and the couple others I run), Statuspage pricing is often too steep. To this effect, many open source projects exist to let you generate your own status page through an application that handles continuous updates of it. That works too! But what if you don’t have a separate server to run the status page service on? Hosting on a server with other applications that its supposed to track is obviously not an option. Enter static_status.

static_status is a bash script that as its name suggests, generates a fully static webpage that functions as a status page for the services you ask it to monitor. You can check out how it looks at status.msfjarvis.dev. Pretty neat, right?

status.msfjarvis.dev is powered by a GitHub Action running every 30 minutes to deploy the generated static page to GitHub Pages and barely takes any time to set up. Here’s how it works.

CNAME record for status.msfjarvis.dev at Cloudflare

CNAME record for status.msfjarvis.dev at Cloudflare

GitHub repository for our status page

GitHub repository for our status page

CNAME file in repository

CNAME file in repository

name: "Update status page"
on:
  schedule:
    - cron: "*/30 * * * *"
  push:

jobs:
  update-status-page:
    runs-on: ubuntu-latest
    steps:
      - name: Install traceroute
        run: sudo apt-get install traceroute -y
      - name: Checkout config
        uses: actions/[email protected]
      - name: Checkout static_status
        uses: actions/[email protected]
        with:
          repository: Cyclenerd/static_status
          path: static_status
          clean: false
      - name: Generate status page
        run: |
          mkdir -p static_status/status/
          cp config static_status/
          cp status_hostname_list.txt static_status/
          cp CNAME static_status/status/
          cd static_status/
          rm status_maintenance_text.txt
          ./status.sh

      - name: Deploy
        uses: peaceiris/[email protected]
        env:
          PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
          PUBLISH_BRANCH: gh-pages
          PUBLISH_DIR: ./static_status/status
          SCRIPT_MODE: true
        with:
          username: "MSF-Jarvis"
          useremail: "[email protected]"

This installs traceroute which is needed by static_status, checks out my repository, clones static_status to the static_status directory, copies over config and hostname list to that folder, places the CNAME file in the static_status/status directory, runs the script to generate the status page, and finally publishes the static_status/status folder to the gh-pages branch, as my bot account.

The result of this is a simple and fast statuspage that can be hosted anywhere by simply coping the single index.html over. If you have a separate server to run this off, you can get away with replacing this entire process with a single crontab command. Being a bash script lets static_status run on essentially any Linux-based platform so you can actually deploy this from a Raspberry Pi with no effort. Hope this helps you to create your own status pages!

Comments