1
0
mirror of https://github.com/tormachris/cf-workers-status-page.git synced 2024-11-11 02:26:08 +01:00
on-prem infra status
Go to file
Adam Janiš 308d9844c5
Merge pull request #1 from GregBrimble/patch-1
Hide description icon if no description present
2020-11-14 15:12:06 +01:00
.gitbook/assets GitBook: [main] one page and one asset modified 2020-11-14 01:40:58 +00:00
.github/workflows feat(cicd): deploy from github actions 2020-11-14 00:42:24 +01:00
out init 2020-11-08 22:36:21 +01:00
pages Hide description icon if no description present 2020-11-14 14:05:20 +00:00
public init 2020-11-08 22:36:21 +01:00
src chore(index): update links 2020-11-14 02:57:28 +01:00
.cargo-ok init 2020-11-08 22:36:21 +01:00
.gitignore init 2020-11-08 22:36:21 +01:00
.prettierrc init 2020-11-08 22:36:21 +01:00
config.yaml feat(cicd): deploy from github actions 2020-11-14 00:42:24 +01:00
flareact.config.js init 2020-11-08 22:36:21 +01:00
index.js init 2020-11-08 22:36:21 +01:00
package-lock.json feat(cicd): deploy from github actions 2020-11-14 00:42:24 +01:00
package.json init 2020-11-08 22:36:21 +01:00
README.md GitBook: [main] one page and one asset modified 2020-11-14 01:40:58 +00:00
SUMMARY.md GitBook: [main] 2 pages modified 2020-11-13 23:45:26 +00:00
wrangler.toml feat(cicd): deploy from github actions 2020-11-14 00:42:24 +01:00
yarn.lock feat(cicd): deploy from github actions 2020-11-14 00:42:24 +01:00

Cloudflare Worker - Status Page

Monitor your websites, showcase status including daily history, and get Slack notification whenever your website status changes. Using Cloudflare Workers, CRON Triggers, and KV storage. Check my status page out! 🚀

Status Page

Slack notifications

Pre-requisites

You'll need a Cloudflare Workers account with

  • A workers domain set up
  • The Workers Bundled subscription $5/mo
  • Some websites/APIs to watch 🙂

Also, prepare the following secrets

  • Cloudflare API token with Edit Cloudflare Workers permissions
  • Slack incoming webhook optional

Getting started

You can either deploy with Cloudflare Deploy Button using GitHub Actions or deploy on your own.

Deploy with Cloudflare Deploy Button

Deploy to Cloudflare Workers

  1. Click the button and follow the instructions, you should end up with a clone of this repository

  2. Navigate to your new GitHub repository > Settings > Secrets and add the following secrets:

    - Name: CF_API_TOKEN (should be added automatically)
    
    - Name: CF_ACCOUNT_ID (should be added automatically)
    
    - Name: SECRET_SLACK_WEBHOOK_URL
    - Value: your-slack-webhook-url
    
  3. Edit config.yaml to adjust configuration and list all of your websites/APIs you want to monitor

    settings:
      title: "Status Page"
      url: "https://status-page.eidam.dev" # used for Slack messages
      logo: logo-192x192.png # image in ./public/ folder
      daysInHistogram: 90 # number of days you want to display in histogram
    
      # configurable texts across the status page
      allmonitorsOperational: "All Systems Operational"
      notAllmonitorsOperational: "Not All Systems Operational"
      monitorLabelOperational: "Operational"
      monitorLabelNotOperational: "Not Operational"
      monitorLabelNoData: "No data"
      dayInHistogramNoData: "No data"
      dayInHistogramOperational: "All good"
      dayInHistogramNotOperational: "Some checks failed"
    
    # list of monitors
    monitors:
      - id: status-page-eidam-dev # unique identifier
        name: Eidam's Status Page
        description: 'https://status-page.eidam.dev' # default=empty
        url: 'https://status-page.eidam.dev/' # URL to fetch
        method: GET # default=GET
        expectStatus: 200 # operational status, default=200
        followRedirect: false # should fetch follow redirects, default=false
    
  4. Push to main branch to trigger the deployment

  5. 🎉

  6. (optional) Go to Cloudflare Workers settings and assign custom domain/route

    • e.g. status-page.eidam.dev/* (make sure you include /* as the Worker also serve static files)
  7. (optional) Edit wrangler.toml to adjust Worker settings or CRON Trigger schedule

Deploy on your own

You can clone the repository yourself and use Wrangler CLI to develop/deploy, extra list of things you need to take care of:

  • create KV namespace and add the KV_STATUS_PAGE binding to wrangler.toml
  • create Worker secrets (optional)
    • SECRET_SLACK_WEBHOOK_URL

Known issues

  • Max 25 monitors to watch in case you are using Slack notifications, due to the limit of subrequests Cloudflare Worker can make 50.

    The plan is to support up to 49 by sending only one Slack notification per scheduled run.

  • KV replication lag - You might get Slack notification instantly, however it may take couple of more seconds to see the change on your status page as Cron Triggers are usually running on underutilized quiet hours machines.