Coder Social home page Coder Social logo

eidam / cf-workers-status-page Goto Github PK

View Code? Open in Web Editor NEW
2.0K 2.0K 1.2K 1.56 MB

Monitor your websites, showcase status including daily history, and get Slack/Telegram/Discord notification whenever your website status changes. Using Cloudflare Workers, CRON Triggers, and KV storage.

Home Page: https://status-page.eidam.dev

License: MIT License

JavaScript 97.57% CSS 2.43%
cloudflare-workers cloudflare-workers-cron cloudflare-workers-kv discord flareact monitoring slack-notifications status-page telegram-notification wrangler

cf-workers-status-page's People

Contributors

adaptive avatar aexvir avatar anthonygraignic avatar cmbuckley avatar corvofeng avatar dependabot[bot] avatar eidam avatar endriu3314 avatar gregbrimble avatar kolaente avatar pilotkid avatar rexhaugen avatar vlazic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cf-workers-status-page's Issues

Custom website domain

When you go via Workers domain, everything is fine, but if you attach your own, you get this (screenshot below)

image

__STATIC_CONTENT_MANIFEST is not defined error when deploying components manually

Hi,

I have just deployed the status page using my GitHub pipeline.
In order to deploy it with my own pipeline with terraform my idea was to check all the components (script, NS, KV, bindings, triggers) of the newly deployed status page and try to deploy these parts using terraform. I managed to create the worker, namespaces, bindings however when I open the status page none of the .js or .css files load on the site.
Upon opening these assets I can see "__STATIC_CONTENT_MANIFEST is not defined" error on the site.
Based on the name in the error message I suppose I was missing a variable binding so I created a new with variable __STATIC_CONTENT_MANIFEST pointing to the __cf-workers-status-page-production-workers_sites_assets namespace despite the fact that the wrangler deployed worker does not have that variable binding. After that I stumbled upon the following error (example): "could not find logo-192x192.png in your content namespace".

In my terraform manifest I create 2x namespaces, 2x bindings, 1x script [copied from the original worker], 1x trigger [every 2 mins], file uploads [1 file to cf-workers-status-page-KV_STATUS_PAGE namespace & 12 files to __cf-workers-status-page-production-workers_sites_assets namespace].

Is there any component in the worker's setup that cannot be deployed manually that could cause such error?

Thanks.
D.

Could we get line charts too

It would be great if we could request a JSON and get some data from it to plot on a line graph. For example, we could have a section called "Request Rate" which calls /api/v1/stats/requests which returns {"1m": 1000} and you can specify the 1m value.

A good example of what this would look like is Reddit's Status Page - https://redditstatus.com/

How to specify url port?

Is port specification in the config url expected to work?
Like url: 'https://www.whatever.com:10001/'.
I can't get this to work. Thx.

Limiting check locations - Feature

It may, or may not be possible due to the underlying workers stack, but is it possible that you could "Select" a subset of locations to check from? If not, check from all locations but only display the locations that you are interested in? At the moment, I seem to have a lot of checks from Australia which couldn't be further from our websites and sometimes it says that it's offline.

Additionally, there is a section in the helper.js file defining "locations", I thought this could be the place but it does not seem to respect that, what is this section for?

Must use import to load ES Module

Hi!
I updated dept for your status page to fix a myriad of security vulnerabilities and trying to deploy via CD here: https://github.com/iron-security/status/runs/4650294217?check_suite_focus=true#step:7:174

However, this results in the following error:

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /github/workspace/node_modules/node-fetch/src/index.js
175
require() of ES modules is not supported.
176
require() of /github/workspace/node_modules/node-fetch/src/index.js from /github/workspace/src/cli/gcMonitors.cjs is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
177
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /github/workspace/node_modules/node-fetch/package.json.
178

179
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1015:13)
180
    at Module.load (internal/modules/cjs/loader.js:863:32)
181
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
182
    at Module.require (internal/modules/cjs/loader.js:887:19)
183
    at require (internal/modules/cjs/helpers.js:74:18)
184
    at Object.<anonymous> (/github/workspace/src/cli/gcMonitors.cjs:2:15)
185
    at Module._compile (internal/modules/cjs/loader.js:999:30)
186
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
187
    at Module.load (internal/modules/cjs/loader.js:863:32)
188
    at Function.Module._load (internal/modules/cjs/loader.js:708:14) {
189
  code: 'ERR_REQUIRE_ESM'
190
}

Any idea how best to fix here? Thank you!

unhandled promise; can't deploy

Deploy fails with an UnhandledPromiseRejectionWarning.

(node:324) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '/github/workspace/out/_flareact/static/build-manifest.json'
    at Object.openSync (fs.js:462:3)
    at Object.readFileSync (fs.js:364:35)
    at Object.<anonymous> (/github/workspace/node_modules/flareact/configs/webpack.worker.config.js:19:8)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/github/workspace/node_modules/flareact/webpack.js:1:18)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
(node:324) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:324) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
thread 'main' panicked at 'could not parse wranglerjs output: Error("EOF while parsing a value", line: 1, column: 0)', src/wranglerjs/mod.rs:49:43
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Unable to disable workers_dev route

Firstly I tried editing the wrangler.toml file, but noticed that the deploy.yml action adds an [env.production] section to the file, so that will not work. I then modified the deploy action to have the additional content, and it now automatically sets my route, but does not seem to set the workers_dev property.

  echo "[env.production]" >> wrangler.toml
+ echo "routes = [\"my.domain.here/*\"]" >> wrangler.toml
+ echo "workers_dev = false" >> wrangler.toml
  echo "kv_namespaces = [{binding=\"KV_STATUS_PAGE\", id=\"${KV_NAMESPACE_ID}\"}]" >> wrangler.toml

image

Private URL / IP addresses from Github secrets

"Never publish your home address in the internet," they say.

Looking for a way to set up a monitor that consumes a GitHub secret for the URL field. Should be safe to have that consumed into the Cloudflare worker, but need a way to avoid the URL/IP address being exposed through GH action.

Andrew

Cloudflare free tier limits issues.

I have been using this status page for a few months now. (thanks btw โค๏ธ )

Cloudflare sends out a 50% limit email every day, which is normal.
But today for the first time ever it sent me a 90% email.
I have not changed anything in the last 2-3 months, so im not sure what caused this.
Also i asked a friend that also uses this project, he seems to have gotten the same email/issue.
If what is happening continues, i will most likely hit the 100% limit in about an hour so.
I attached some photos.

image
image
image

Ill keep this thread updated if something else happens.

Feature Request: Option to show uptime as a percentage, instead of how many incidents occurred

The title is rather self explanatory. This would allow status pages to show the uptime of a website as a percentage of time online that day, instead of the number of incidents that day.

An alternative would be listing how long an incident actually occurs (as it's not uncommon for a website to very briefly restart and be unavailable for <1 minute).

Feel free to respond with any questions that you have.

Possibility to check the websites from a static location

Hello @eidam,

I successfully deployed the status-page to my Cloudflare workers and the status checks are executed according to the cron trigger.
After deploying the status-page I realized that on the website I am monitoring geoblock is enabled so it can be viewed only from certain locations, meaning that the status check fails in case the code is executed on a worker that is located in a restricted country. According to the current Cloudflare capabilities the code cannot be executed from a specific Cloudflare location all the time and preferably I would like to avoid whitelisting the Cloudflare IP ranges.

Is there any way to kind of replace/spoof the original location of the worker (in code) with a static one to avoid the block?

Thanks,
D.

[Feature Request] Disable links option

Hello, let's say that you want to have a status page that is open to the public, that shows the status of your front end and your backend. However, you do not want to openly publish your API server's URL. As of now, you have no control as to who can see/click on the URL of the server. I propose adding a setting to the config.yml file to allow the link to become disabled on the home page.

For example, a configuration file would look like this

monitors:
  - id: workers-cloudflare-com # unique identifier
    name: workers.cloudflare.com
    description: 'You write code. They handle the rest.' # default=empty
    url: 'https://workers.cloudflare.com/' # URL to fetch
    method: GET # default=GET
    expectStatus: 200 # operational status, default=200
    followRedirect: false # should fetch follow redirects, default=false
    linkable: true #default=true
    
  - id: www-cloudflare-com
    name: www.cloudflare.com
    description: 'Built for anything connected to the Internet.'
    url: 'https://www.cloudflare.com'
    method: GET
    expectStatus: 200
    linkable: false

Which in turn produces this result
image

Discord default icon

Hello. I think it would be great to custom the Discord Webhook bot name and image, or leave it the default you configure. AFAIK, you can override the image and name of the webhook with the Discord API.

Add custom header

Would it possible to add custom headers to a monitor? E.g. Basic Authentication

optimize KV operations in favor of KV free tier

  • run monitors gc after deployment

    • currently runs on each scheduled event - this can be handled by postCommands after deployment
  • cache rendered frontend for longer and invalidate cache on changes from CRONs

  • document how to change CRON trigger schedule to fit into free tier

TypeError for src/cli/gcMonitors @ Publish stage of deploy

$ node ./src/cli/gcMonitors.js
TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at /github/workspace/src/cli/gcMonitors.js:67:12
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

image

Line 67:
image

Doesn't actually upload to workers, left with the default template from Cloudflare.

First time load, not working

I'm trying to run this for the first time and this is what I get, any help would be great
`(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 29965 files and directories currently installed.)
Preparing to unpack .../libonig4_6.1.3-2+deb9u2_amd64.deb ...
Unpacking libonig4:amd64 (6.1.3-2+deb9u2) ...
Selecting previously unselected package libjq1:amd64.
Preparing to unpack .../libjq1_1.5+dfsg-1.3_amd64.deb ...
Unpacking libjq1:amd64 (1.5+dfsg-1.3) ...
Selecting previously unselected package jq.
Preparing to unpack .../jq_1.5+dfsg-1.3_amd64.deb ...
Unpacking jq (1.5+dfsg-1.3) ...
Setting up libonig4:amd64 (6.1.3-2+deb9u2) ...
Setting up libjq1:amd64 (1.5+dfsg-1.3) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Setting up jq (1.5+dfsg-1.3) ...
Secret SECRET_SLACK_WEBHOOK_URL not set, creating dummy one...
Secret SECRET_TELEGRAM_API_TOKEN not set, creating dummy one...
Secret SECRET_TELEGRAM_CHAT_ID not set, creating dummy one...
Secret SECRET_DISCORD_WEBHOOK_URL not set, creating dummy one...
Installing wranglerjs v1.19.2...
npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/watchpack-chokidar2/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

added 343 packages from 201 contributors and audited 345 packages in 6.67s

8 packages are looking for funding
run npm fund for details

found 1 moderate severity vulnerability
run npm audit fix to fix them, or npm audit for details
(node:325) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '/github/workspace/out/_flareact/static/build-manifest.json'
at Object.openSync (fs.js:462:3)
at Object.readFileSync (fs.js:364:35)
at Object. (/github/workspace/node_modules/flareact/configs/webpack.worker.config.js:19:8)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object. (/github/workspace/node_modules/flareact/webpack.js:1:18)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
(node:325) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:325) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Oops! Wrangler encountered an error:

panicked at 'could not parse wranglerjs output: Error("EOF while parsing a value", line: 1, column: 0)', src/wranglerjs/mod.rs:50:43

Please help Cloudflare debug this issue by submitting the error report
(/github/workspace/errors/1630693934729.log)

To submit this error report to Cloudflare, run:

$ wrangler report

Enter the secret text you'd like assigned to the variable SECRET_SLACK_WEBHOOK_URL on the script named cf-workers-status-page-production:
Creating the secret for script name cf-workers-status-page-production
Worker cf-workers-status-page-production doesn't exist in the API yet. Creating a draft Worker so we can create new secret.
Error: No such file or directory (os error 2)`

Can this support more domains to track?

You can try to use self request(making request to itself and add a parameter of the subrequest) and each subrequest can track 25 domains so that it's able to track 50*25 domains.

Telegram bot not working

I just finished one hour of debugging and looking for an error with my telegram bot. The reason why that happened is that I had dots (.) in names in my config.yaml, and markdown parser in telegram API doesn't like unescaped dots.

Posting it here as maybe somebody will have a similar problem ๐Ÿ˜‰.

Maybe add an entry in README about it or some checks in code to prevent this ๐Ÿค”

Protect status page

Hi there!

Are there any plans to add status page protection with a password or third party apps? Would be great can have private status pages for internal team.

Btw, is this project open for contributions like that?

Thank you!

Question: How do you stop it?

I have had this deployed through the free worker tier for a while now, but for the life of me can't find an easy off button. How do you turn this service off?

Record % uptime

Wants

Is it possible to show the overall % uptime, as shown in the attached?

Deploy action fails with several error messages relating to kv-namespace id and compatibility_date

When looking at the deploy action log file, several error messages are given:

Error:  Your configuration file is missing the field ["kv-namespace id"] which is required to publish your worker!
 Your configuration file is missing compatibility_date, so a distant past date is assumed. To get the latest possibly-breaking bug fixes, add this line to your wrangler.toml:

    compatibility_date = "2021-09-22"

 For more information about compatibility dates, see: https://developers.cloudflare.com/workers/platform/compatibility-dates

Upon debugging, it appears that Cloudflare is responding to the wrangler kv:namespace list on Line 31 of /.github/workflows/deploy.yaml with that notice about the missing compatibility date in front of the kv-namespace id json which is causing jq to fail parsing.

The solution for me was to add compatibility_date = "2021-07-23" to /wrangler.yaml since that was the last date of update to the main branch. After that, deployment happened automatically and without error.

I have created a pull request for this issue: #65

IMPORTANT: Workers/Pages Status Page v2

Ola!

Thank you all for using this project to monitor your websites. I never thought about reaching such a high number of forks and stars! ๐Ÿ”ฅ

I plan to open-source a new version of a full stack Monitoring & Status Page, which is still completely running on the Cloudflare edge. However, to make it properly, I would like to use some products (Durable Objects, D1, Analytics Engine) that are not part of the free tier, so my question is:

How many folks are using the current version on the Workers free tier, and would you mind upgrading to Paid ($5) for hosting the new version?

This will help me understand the users of this project and better scope the v2 release. Thank you!

Tiny correction: the new version might actually use Pages instead of Workers, lets's see how it goes!

Eidam

gcMonitors.js (TypeError)

problem:

> [email protected] kv-gc /github/workspace
> node ./src/cli/gcMonitors.js
TypeError: Cannot read property 'checks' of undefined
    at /github/workspace/src/cli/gcMonitors.js:80:51
    at Array.map (<anonymous>)
    at /github/workspace/src/cli/gcMonitors.js:67:41
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

problem solved:

// remove monitor data from state if missing in config //false
(configMonitors.length === Object.keys(stateMonitors.monitors).length)  //false

reproduce steps:

  • remove rows (73-83)
  • run
  • add's rows back (73-83)
  • run again

Incident list

Currently we can see which day incidents happened, but we don't have a list of incidents with date and time in the UI.

It would be awesome if there were a list of incidents below the status bars, or opening the incident list when clicking on a bar item

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.