Open-source status page, incident response and uptime monitoring
TypeScript alertingincident-managementmcpmcp-servermonitoringmonitoring-as-codeobservabilityon-callopen-sourcesrestatus-pagestatuspagesynthetic-monitoringterraformtinybirdtursouptimeuptime-checkeruptime-monitor
📄 Cf guide (#1499)
Thibault Le Ouay0fb7a0c5e437
diff --git a/apps/docs/astro.config.mjs b/apps/docs/astro.config.mjsindex b42c821f7..54b2aeb6e 100644--- a/apps/docs/astro.config.mjs+++ b/apps/docs/astro.config.mjs@@ -130,6 +130,10 @@ export default defineConfig({label: "How to use React Status Widget",slug: "guides/how-to-use-react-widget",},+ {+ label: "How to deploy probes on Cloudflare Containers ",+ slug: "guides/how-to-deploy-probes-cloudflare-containers",+ },],},{diff --git a/apps/docs/src/assets/guides/how-to-deploy-probes-cf-containters/cloudflare-log.png b/apps/docs/src/assets/guides/how-to-deploy-probes-cf-containters/cloudflare-log.pngnew file mode 100644index 000000000..1bd069dd5Binary files /dev/null and b/apps/docs/src/assets/guides/how-to-deploy-probes-cf-containters/cloudflare-log.png differdiff --git a/apps/docs/src/assets/guides/how-to-deploy-probes-cf-containters/private-location.jpg b/apps/docs/src/assets/guides/how-to-deploy-probes-cf-containters/private-location.jpgnew file mode 100644index 000000000..21169afeaBinary files /dev/null and b/apps/docs/src/assets/guides/how-to-deploy-probes-cf-containters/private-location.jpg differdiff --git a/apps/docs/src/content/docs/guides/getting-started.mdx b/apps/docs/src/content/docs/guides/getting-started.mdxindex 43829e7a2..e5003b078 100644--- a/apps/docs/src/content/docs/guides/getting-started.mdx+++ b/apps/docs/src/content/docs/guides/getting-started.mdx@@ -14,3 +14,4 @@ Here's some guides for the getting started with OpenStatus.- [Export Metrics to your OTLP endpoint](/guides/how-to-export-metrics-to-otlp-endpoint)- [How to Add an SVG Status Badge to your GitHub README](/guides/how-to-add-svg-status-badge)- [How to use React Status Widget](/guides/how-to-use-react-widget)+- [How to deploy private location on Cloudflare Containers](/guides/how-to-deploy-probes-cloudflare-containers)diff --git a/apps/docs/src/content/docs/guides/how-to-deploy-probes-cloudflare-containers.mdx b/apps/docs/src/content/docs/guides/how-to-deploy-probes-cloudflare-containers.mdxnew file mode 100644index 000000000..acb780e18--- /dev/null+++ b/apps/docs/src/content/docs/guides/how-to-deploy-probes-cloudflare-containers.mdx@@ -0,0 +1,128 @@+---+title: How to deploy the openstatus probe to Cloudflare Containers+description: Learn how to use OpenStatus monitoring data and deploy your own Status Page to cloudflare pages.+sidebar:+ label: Deploy private probes on Cloudflare Containers+---+import { Image } from 'astro:assets';+import log from '../../../assets/guides/how-to-deploy-probes-cf-containters/cloudflare-log.png';+import os from '../../../assets/guides/how-to-deploy-probes-cf-containters/private-location.jpg';+++In this guide we will show you how to deploy the OpenStatus probe to Cloudflare Containers.++Cloudflare Containers is a platform that allows you to run serverless containers in the Cloudflare network.++Cloudflare containers automatically scales down after a given time. We will push a cron worker that will keep our container alive and running on Cloudflare Containers platform.++The code showcased in this guide is available on [GitHub](https://github.com/openstatusHQ/private-location-cloudflare-container)++### Requirements+- A Cloudflare Account.+- An [openstatus](https://www.openstatus.dev) Account.++++### Create a private location on OpenStatus++1. Go to the OpenStatus dashboard.+2. Click on the `Private locations` in the sidebar.+3. Click on the `Create Private Location` button.+4. Give it a human readable name.+5. Save token.+6. Click submit to save the newly created private location.++### Create a Cloudflare Container++1. Create a new cloudflare workers container template using the following command:++```bash+pnpm create cloudflare@latest --template=cloudflare/templates/containers-template+```++2. Fetch openstatus private location image from Docker Hub, we need to specify the platform to linux/amd64 because Cloudflare Containers currently only supports amd64 architecture.:++```bash+docker docker pull --platform linux/amd64 ghcr.io/openstatushq/private-location:latest+```++3. Tag the image, be aware we cannot use the `latest` tag on Cloudflare Containers:++```bash+docker tag ghcr.io/openstatushq/private-location:latest openstatus-private-location:v1+```++4. Push the image to Cloudflare Container Registry:++```bash+pnpm wrangler containers push openstatus-private-location:v1+```++5. Update the `wrangler.toml` file to use the pushed image:++```toml+[containers]+ image = "registry.cloudflare.com/GENERATED_ID/openstatus-private-location:cf-1"+```++6. Update the worker to use a cron trigger to keep the container alive, add the following to your `wrangler.toml` file:++```toml+triggers = { cron = ["*/2 * * * *"] }+```++7. Update the `index.ts` file to run a simple command to keep the container alive:++```ts+sleepAfter = "150s";+```+and++```ts+async scheduled(_controller: any, env: Env) {+ try {+ const container = getContainer(env.MY_CONTAINER);+ await container.start({+ envVars: {+ OPENSTATUS_KEY: env.OPENSTATUS_KEY,+ },+ });+ } catch (e) {+ console.error("Error in scheduled task:", e);+ }++ return new Response("ok");+},+```++9. Add you OpenStatus API secret++```bash+pnpm wrangler secret put OPENSTATUS_KEY+```+++10. Deploy the container to Cloudflare Containers:++```bash+pnpm wrangler deploy+```+++++## Conclusion++You have successfully deployed the openstatus private location probe to Cloudflare Containers. Thus you can monitor your endpoint from Cloudflare's global network.+++ <Image+ src={log}+ alt="OpenStatus Private Location on Cloudflare Containers"+ caption="Cloudflare Workers Logs showing OpenStatus Private Location running"+ />++ <Image+ src={os}+ alt="OpenStatus Private Location on Cloudflare Containers"+ />