HomeTechnologyYour own free status website with Github Actions

Your own free status website with Github Actions

If you have a couple of websites or services, I can imagine that you want to monitor them to see if they are nonetheless up and operating with possible response times. If a website takes too lengthy to launch or goes offline, you’d like to be notified so you can take action.

With this resolution, you can monitor as many websites as you want every 5 minutes.

There are so many status websites these days, what’s so special about this 1?

  • It’s free and customisable, even the footer and header (menu) can be changed.
  • It runs individually from the websites or services you want to monitor.
  • It works with Github Actions so you don’t need your own hosting.
  • Notifications are logged with Github issues and can even be sent with SMTP, Telegram, Slack etc.
  • What is restricted is that it polls every 5 minutes, but in most cases there is no need to check even faster.

Prerequisites

Action plan

Go to https://github.com/upptime/upptime and click Use this template.
As the image below shows, enter a repository name, leave Public as it is and check the ‘include all branches’ option.

github-template

github-template

Enable publishing

To get a static status website, you have to enable GitHub Pages on your new repository.

  • Go to your repository settings page
  • Go to the “Pages” sub-section on the left
  • Under “Source”, change “None” to gh-pages
  • In the folder dropdown, select /(root)
  • Skip the “Theme Chooser” option
  • Click on “Save”

Personal Access Tokens

To make commits and publish your website, Upptime requires a personal entry token (PAT) with the repo and workflow scope, stored as a repository secret GH_PAT. You can create a personal entry token by following these steps:

  • Click on your profile picture on the top-right nook and select “Settings”
  • In the left sidebar, select “Developer settings”
  • In the left sidebar, click “Personal entry tokens”
  • Click “Generate new token”
  • Select the “repo” and “workflow” scopes
  • Click “Generate token”
  • After producing your token, copy it (you will not see it again). Then, add it as a repository secret:

In your Upptime repository, select “Settings”
In the left sidebar, click “Secrets”

  • Press the button “New repository secret”
  • Enter the name of the secret as GH_PAT
    Paste your personal entry token into the Value field
    Be sure there are no spaces before or after the token and/or linebreaks after your token
    Save your PAT by selecting “Add secret”
    For more information on PATs, read article on the GitHub website: Creating a personal entry token.

Update configuration

The .upptimerc.yml file is used as the central configuration store. In that file, you can specify which endpoints you want to monitor and configure your status website. For more information about this part and to find out what’s possible, go to the Configuration of website: https://upptime.js.org/docs/configuration.

To give a simple example of what the configuration might gaze like.
Change some values to your preference.

# Change these first
proprietor: [your github username] # Your GitHub organization or username, where this repository lives
repo: [the name of the repository] # The name of this repository

websites:
  - name: Google
    url: https://google.com
    maxResponseTime: 15000

status-website:
  # Add your custom domain name, or remove the `cname` line if you don't have a domain
  # Uncomment the `baseUrl` line if you don't have a custom domain and add your repo name there
  cname: [sub.yourdomain.com]
  # baseUrl: /upptime
  logoUrl: https://raw.githubusercontent.com/upptime/upptime.js.org/master/static/img/icon.svg
  name: Status Website
  introTitle: "**Status**"
 # introMessage: This is a sample status page which uses **real-time** data from our [GitHub repository](https://github.com/upptime/upptime). No server required — just GitHub Actions, Issues, and Pages. [**Get your own for free**]
  navbar:
 #   - title: Status
 #     href: /
    - title: GitHub
      href: https://github.com/$OWNER/$REPO

Your own domain

You can land the status website on your own (sub) domain. To do this go to the repository settings.

github-own-domain-statuspage

github-own-domain-statuspage

Click Pages on the left. At Custom Domain you can enter your own (sub) domain.
Now go to your hosting website or Cloudflare if you are using this. At Cloudflare you will find these options at DNS, Add record and choose CNAME. Now type as name status and as Content your username.github.io.

Secret websites to monitor

If you have a secret website that you want to monitor, but not visible for anyone else.
Add it like this, give it a name and change the URL to $[name], so something like $secret.

websites:
  - name: G
    url: $secret

Go to the repository settings, at the left Secrets.
and add a new secret. Name: G and as Value: secret, so without the $.
now save and construct the workflow again by going to Actions. Click on Setup CI and start workflow.
Give it 5 minutes and visit the status website. the real URL should not be visible but nonetheless monitored.

More information about the project can be found here: https://upptime.js.org/

Source

Most Popular