Open-source status page, incident response and uptime monitoring
TypeScript alertingincident-managementmcpmcp-servermonitoringmonitoring-as-codeobservabilityon-callopen-sourcesrestatus-pagestatuspagesynthetic-monitoringterraformtinybirdtursouptimeuptime-checkeruptime-monitor
fix: incident status banner (#1487)
Maximilian Kaske24c9fbbec164
diff --git a/apps/docs/src/content/docs/concept/getting-started.mdx b/apps/docs/src/content/docs/concept/getting-started.mdxindex 57b6d4d65..595a8b24f 100644--- a/apps/docs/src/content/docs/concept/getting-started.mdx+++ b/apps/docs/src/content/docs/concept/getting-started.mdx@@ -6,9 +6,6 @@ title: Getting StartedHere’s some content to help you get started with the concept behind OpenStatus.- [Uptime Monitoring](/concept/uptime-monitoring)-- [Best Practices for Status Pages](/concept/best-practices-status-page)-- [Uptime Monitoring as Code](/concept/uptime-monitoring-as-code)-- [Latency vs Response Time](/concept/latency-vs-response-time)diff --git a/apps/docs/src/content/docs/guides/getting-started.mdx b/apps/docs/src/content/docs/guides/getting-started.mdxindex 85367e2dc..43829e7a2 100644--- a/apps/docs/src/content/docs/guides/getting-started.mdx+++ b/apps/docs/src/content/docs/guides/getting-started.mdx@@ -10,11 +10,7 @@ Here's some guides for the getting started with OpenStatus.- [How to monitor your MCP Server using OpenStatus](/guides/how-to-monitor-mcp-server/)-- [How to run synthetic tests in your GitHub Actions](/guides/how-to-run-synthetic-test-github-action/)-- [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)diff --git a/apps/docs/src/content/docs/tutorial/getting-started.mdx b/apps/docs/src/content/docs/tutorial/getting-started.mdxindex a615c8b02..040868a41 100644--- a/apps/docs/src/content/docs/tutorial/getting-started.mdx+++ b/apps/docs/src/content/docs/tutorial/getting-started.mdx@@ -6,4 +6,6 @@ Here are some tutorials to help you get started with OpenStatus:- [How to create your first monitor with OpenStatus](/tutorial/how-to-create-monitor)- [How to create a status page?](/tutorial/how-to-create-status-page)-- [Get Started with openstatus CLI](/tutorial/get-started-with-openstatus-cli)+- [How to configure a status page? (beta)](/tutorial/how-to-configure-status-page)+- [How to create a private location? (beta)](/tutorial/how-to-create-private-location)+- [Get Started with openstatus CLI](/tutorial/get-started-with-openstatus-cli)\ No newline at end of filediff --git a/apps/docs/src/content/docs/tutorial/how-to-create-private-location.mdx b/apps/docs/src/content/docs/tutorial/how-to-create-private-location.mdxindex 2e591668a..769a355cc 100644--- a/apps/docs/src/content/docs/tutorial/how-to-create-private-location.mdx+++ b/apps/docs/src/content/docs/tutorial/how-to-create-private-location.mdx@@ -18,6 +18,8 @@ Private locations are crucial for verifying *performance and availability* of in3. in the private location settings, choose which monitors to track (or vice versa, configure it in your monitor settings)4. done (within a couple of minutes, we'll check the everything)+We have published a blog post on how we [deployed the docker image on a Raspberry Pi (2016)](https://www.openstatus.dev/blog/deploy-private-locations-raspberry-pi).+### What is missing?- Incidents will not be created (yet) if you run your monitors via privat regions. That means you should still use the openstatus regions to get alerts if a monitor is down.diff --git a/apps/status-page/src/app/(public)/client.tsx b/apps/status-page/src/app/(public)/client.tsxindex e42ada4df..9789193aa 100644--- a/apps/status-page/src/app/(public)/client.tsx+++ b/apps/status-page/src/app/(public)/client.tsx@@ -9,6 +9,7 @@ import {SectionHeader,SectionTitle,} from "@/components/content/section";+import { recomputeStyles } from "@/components/status-page/floating-button";import {Status,StatusContent,@@ -33,11 +34,7 @@ import {import { monitors } from "@/data/monitors";import { useTRPC } from "@/lib/trpc/client";import { cn } from "@/lib/utils";-import {- THEMES,- THEME_KEYS,- generateThemeStyles,-} from "@openstatus/theme-store";+import { THEMES, THEME_KEYS } from "@openstatus/theme-store";import { useQuery } from "@tanstack/react-query";import { useTheme } from "next-themes";import { useQueryStates } from "nuqs";@@ -56,21 +53,20 @@ const MAIN_COLORS = [export function Client() {const { resolvedTheme } = useTheme();- const [mounted, setMounted] = useState(false);+ const [isMounted, setIsMounted] = useState(false);const [searchParams, setSearchParams] = useQueryStates(searchParamsParsers);const { q, t } = searchParams;const theme = t ? THEMES[t as keyof typeof THEMES] : undefined;useEffect(() => {- setMounted(true);+ setIsMounted(true);}, []);useEffect(() => {- const themeStyles = document.getElementById("theme-styles");- if (t && themeStyles) {- themeStyles.innerHTML = generateThemeStyles(t);+ if (isMounted && t) {+ recomputeStyles(t);}- }, [t]);+ }, [t, isMounted]);return (<SectionGroup>@@ -125,7 +121,7 @@ export function Client() {);}).map((k) => {const theme = THEMES[k];- const style = mounted+ const style = isMounted? theme[resolvedTheme as "dark" | "light"]: undefined;@@ -145,7 +141,7 @@ export function Client() {}}}>- {mounted ? (+ {isMounted ? (<divclassName="absolute h-full w-full bg-background text-foreground"style={style as React.CSSProperties}@@ -179,7 +175,7 @@ export function Client() {? style[color.key]: undefined;- if (!mounted) {+ if (!isMounted) {return (<Skeletonkey={color.key}diff --git a/apps/status-page/src/app/(status-page)/[domain]/(public)/page.tsx b/apps/status-page/src/app/(status-page)/[domain]/(public)/page.tsxindex 4e50db8c5..5b181b198 100644--- a/apps/status-page/src/app/(status-page)/[domain]/(public)/page.tsx+++ b/apps/status-page/src/app/(status-page)/[domain]/(public)/page.tsx@@ -28,6 +28,7 @@ import { useTRPC } from "@/lib/trpc/client";import { cn } from "@/lib/utils";import { useQuery } from "@tanstack/react-query";import { useParams } from "next/navigation";+import { useMemo } from "react";export default function Page() {const { domain } = useParams<{ domain: string }>();@@ -48,6 +49,20 @@ export default function Page() {}),);+ // NOTE: we need to filter out the incidents as we don't want to show all of them in the banner - a single one is enough+ // REMINDER: we could move that to the server - but we might wanna have the info of all openEvents actually+ const events = useMemo(() => {+ let hasIncident = false;+ return (+ page?.openEvents.filter((e) => {+ if (e.type !== "incident") return true;+ if (hasIncident) return false;+ hasIncident = true;+ return true;+ }) ?? []+ );+ }, [page]);+if (!page) return null;return (@@ -57,13 +72,13 @@ export default function Page() {<StatusTitle>{page.title}</StatusTitle><StatusDescription>{page.description}</StatusDescription></StatusHeader>- {page.openEvents.length > 0 ? (+ {events.length > 0 ? (<StatusContent><StatusBannerTabs- defaultValue={`${page.openEvents[0].type}-${page.openEvents[0].id}`}+ defaultValue={`${events[0].type}-${events[0].id}`}><StatusBannerTabsList>- {page.openEvents.map((e, i) => {+ {events.map((e, i) => {return (<StatusBannerTabsTriggervalue={`${e.type}-${e.id}`}@@ -71,7 +86,7 @@ export default function Page() {key={e.id}className={cn(i === 0 && "rounded-tl-lg",- i === page.openEvents.length - 1 && "rounded-tr-lg",+ i === events.length - 1 && "rounded-tr-lg",)}>{e.name}@@ -79,7 +94,7 @@ export default function Page() {);})}</StatusBannerTabsList>- {page.openEvents.map((e) => {+ {events.map((e) => {if (e.type === "report") {const report = page.statusReports.find((report) => report.id === e.id,@@ -122,6 +137,16 @@ export default function Page() {</StatusBannerTabsContent>);}+ if (e.type === "incident") {+ return (+ <StatusBannerTabsContent+ value={`${e.type}-${e.id}`}+ key={e.id}+ >+ <StatusBanner status={e.status} />+ </StatusBannerTabsContent>+ );+ }return null;})}</StatusBannerTabs>diff --git a/apps/status-page/src/app/globals.css b/apps/status-page/src/app/globals.cssindex 4af968ad7..1e7a013f5 100644--- a/apps/status-page/src/app/globals.css+++ b/apps/status-page/src/app/globals.css@@ -184,4 +184,12 @@.rounded-full {border-radius: calc(var(--radius) * 99999999);}+ .rounded-b-full {+ border-bottom-left-radius: calc(var(--radius) * 99999999);+ border-bottom-right-radius: calc(var(--radius) * 99999999);+ }+ .rounded-t-full {+ border-top-left-radius: calc(var(--radius) * 99999999);+ border-top-right-radius: calc(var(--radius) * 99999999);+ }}diff --git a/apps/status-page/src/components/status-page/floating-button.tsx b/apps/status-page/src/components/status-page/floating-button.tsxindex 89320f74f..f39b5d720 100644--- a/apps/status-page/src/components/status-page/floating-button.tsx+++ b/apps/status-page/src/components/status-page/floating-button.tsx@@ -89,13 +89,17 @@ export function StatusPageProvider({const [communityTheme, setCommunityTheme] = useState<CommunityTheme>(defaultCommunityTheme,);+ const [isMounted, setIsMounted] = useState(false);useEffect(() => {- const themeStyles = document.getElementById("theme-styles");- if (themeStyles) {- themeStyles.innerHTML = generateThemeStyles(communityTheme);+ setIsMounted(true);+ }, []);++ useEffect(() => {+ if (isMounted) {+ recomputeStyles(communityTheme);}- }, [communityTheme]);+ }, [communityTheme, isMounted]);return (<StatusPageContext.Provider@@ -253,12 +257,10 @@ export function FloatingButton({</SelectContent></Select></div>- {IS_DEV ? (- <div className="space-y-2">- <Label htmlFor="theme">Theme</Label>- <ThemeSelect id="theme" className="w-full" />- </div>- ) : null}+ <div className="space-y-2">+ <Label htmlFor="theme">Theme</Label>+ <ThemeSelect id="theme" className="w-full" />+ </div><div className="space-y-2"><Label htmlFor="community-theme">Community Theme</Label><Popover>@@ -337,3 +339,16 @@ export function FloatingButton({</div>);}++export function recomputeStyles(newTheme: CommunityTheme) {+ // FIXME: only on prod, we have two style elements with the same id+ // we need to get rid of all of them except the one we want to update+ const allThemeStyles = document.querySelectorAll("style[id='theme-styles']");+ allThemeStyles.forEach((style, index) => {+ if (index === 0) {+ style.textContent = generateThemeStyles(newTheme);+ } else {+ style.remove();+ }+ });+}diff --git a/apps/status-page/src/components/status-page/status-tracker.tsx b/apps/status-page/src/components/status-page/status-tracker.tsxindex 81dfbd802..bb435a4ff 100644--- a/apps/status-page/src/components/status-page/status-tracker.tsx+++ b/apps/status-page/src/components/status-page/status-tracker.tsx@@ -253,7 +253,10 @@ export function StatusTracker({ data }: { data: UptimeData }) {{item.bar.map((segment, segmentIndex) => (<divkey={`${item.day}-${segment.status}-${segmentIndex}`}- className="w-full rounded-full transition-all"+ className={cn("w-full transition-all", {+ "rounded-t-full": segmentIndex === 0,+ "rounded-b-full": segmentIndex === item.bar.length - 1,+ })}style={{height: `${segment.height}%`,backgroundColor: chartConfig[segment.status].color,