Open-source status page, incident response and uptime monitoring
TypeScript alertingincident-managementmcpmcp-servermonitoringmonitoring-as-codeobservabilityon-callopen-sourcesrestatus-pagestatuspagesynthetic-monitoringterraformtinybirdtursouptimeuptime-checkeruptime-monitor
build: improve biuld (#2296)
Thibault Le Ouay59c35ef85607
diff --git a/.github/workflows/restart-workflows.yml b/.github/workflows/restart-workflows.ymlnew file mode 100644index 000000000..02f64b445--- /dev/null+++ b/.github/workflows/restart-workflows.yml@@ -0,0 +1,33 @@+name: Restart Workflows Machines++# Periodic rolling restart to cap the native libsql embedded-replica memory growth+# (see apps/workflows/research.md). Restarts machines one at a time so the app stays up.+on:+ schedule:+ - cron: "0 */12 * * *"+ workflow_dispatch: {}++concurrency:+ group: restart-workflows+ cancel-in-progress: false++jobs:+ restart:+ name: Rolling restart+ runs-on: ubuntu-latest+ timeout-minutes: 10+ steps:+ - uses: superfly/flyctl-actions/setup-flyctl@master+ - name: Restart machines one at a time+ env:+ FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}+ FLY_APP: openstatus-workflows+ run: |+ set -euo pipefail+ ids=$(flyctl machines list -a "$FLY_APP" --json | jq -r '.[].id')+ for id in $ids; do+ echo "Restarting machine $id"+ flyctl machine restart "$id" -a "$FLY_APP"+ # Let the machine pass its health check before touching the next one.+ sleep 45+ donediff --git a/apps/server/.dockerignore b/apps/server/.dockerignoreindex c8236a8b4..36b713083 100644--- a/apps/server/.dockerignore+++ b/apps/server/.dockerignore@@ -1,4 +1,4 @@-# This file is generated by Dofigen v2.7.0+# This file is generated by Dofigen v2.8.0# See https://github.com/lenra-io/dofigennode_modulesdiff --git a/apps/server/Dockerfile b/apps/server/Dockerfileindex bb3d41d99..f4c19c32f 100644--- a/apps/server/Dockerfile+++ b/apps/server/Dockerfile@@ -1,5 +1,5 @@# syntax=docker/dockerfile:1.19.0-# This file is generated by Dofigen v2.7.0+# This file is generated by Dofigen v2.8.0# See https://github.com/lenra-io/dofigen# install@@ -52,10 +52,10 @@ pnpm install --prod --frozen-lockfile --verboseEOF# build-FROM oven/bun@sha256:f20d9cf365ab35529384f1717687c739c92e6f39157a35a95ef06f4049a10e4a AS build+FROM oven/bun@sha256:0733e50325078969732ebe3b15ce4c4be5082f18c4ac1a0f0ca4839c2e4e42a7 AS buildLABEL \- org.opencontainers.image.base.digest="sha256:f20d9cf365ab35529384f1717687c739c92e6f39157a35a95ef06f4049a10e4a" \- org.opencontainers.image.base.name="docker.io/oven/bun:1.3.6" \+ org.opencontainers.image.base.digest="sha256:0733e50325078969732ebe3b15ce4c4be5082f18c4ac1a0f0ca4839c2e4e42a7" \+ org.opencontainers.image.base.name="docker.io/oven/bun:1.3.11" \org.opencontainers.image.stage="build"ENV NODE_ENV="production"WORKDIR /app/apps/server@@ -79,7 +79,7 @@ RUN bun build --compile --sourcemap src/index.ts --outfile=app# runtimeFROM debian@sha256:cd1bc32f233a49f1b82149c9edb8ef34fb1e6c45f37211445c51a97603468604 AS runtimeLABEL \- io.dofigen.version="2.7.0" \+ io.dofigen.version="2.8.0" \org.opencontainers.image.authors="OpenStatus Team" \org.opencontainers.image.base.digest="sha256:cd1bc32f233a49f1b82149c9edb8ef34fb1e6c45f37211445c51a97603468604" \org.opencontainers.image.base.name="docker.io/debian:bullseye-slim" \diff --git a/apps/server/dofigen.lock b/apps/server/dofigen.lockindex d9ad0a9f9..b2a4213e3 100644--- a/apps/server/dofigen.lock+++ b/apps/server/dofigen.lock@@ -10,14 +10,43 @@ effective: |- /packages/api- /packages/integrations/vercelbuilders:+ build:+ fromImage:+ path: oven/bun+ digest: sha256:0733e50325078969732ebe3b15ce4c4be5082f18c4ac1a0f0ca4839c2e4e42a7+ label:+ org.opencontainers.image.stage: build+ org.opencontainers.image.base.name: docker.io/oven/bun:1.3.11+ org.opencontainers.image.base.digest: sha256:0733e50325078969732ebe3b15ce4c4be5082f18c4ac1a0f0ca4839c2e4e42a7+ workdir: /app/apps/server+ env:+ NODE_ENV: production+ copy:+ - paths:+ - .+ target: /app/+ - fromBuilder: install+ paths:+ - /app/node_modules+ target: /app/node_modules+ - fromBuilder: install+ paths:+ - /app/apps/server/node_modules+ target: /app/apps/server/node_modules+ - fromBuilder: install+ paths:+ - /app/packages+ target: /app/packages+ run:+ - bun build --compile --sourcemap src/index.ts --outfile=appinstall:fromImage:path: nodedigest: sha256:242549cd46785b480c832479a730f4f2a20865d61ea2e404fdb2a5c3d3b73ecflabel:- org.opencontainers.image.stage: install- org.opencontainers.image.base.digest: sha256:242549cd46785b480c832479a730f4f2a20865d61ea2e404fdb2a5c3d3b73ecforg.opencontainers.image.base.name: docker.io/node:24-slim+ org.opencontainers.image.base.digest: sha256:242549cd46785b480c832479a730f4f2a20865d61ea2e404fdb2a5c3d3b73ecf+ org.opencontainers.image.stage: installworkdir: /app/run:- corepack enable pnpm@@ -95,46 +124,17 @@ effective: |source: packages/services/package.json- target: packages/importers/package.jsonsource: packages/importers/package.json- build:- fromImage:- path: oven/bun- digest: sha256:f20d9cf365ab35529384f1717687c739c92e6f39157a35a95ef06f4049a10e4a- label:- org.opencontainers.image.base.name: docker.io/oven/bun:1.3.6- org.opencontainers.image.base.digest: sha256:f20d9cf365ab35529384f1717687c739c92e6f39157a35a95ef06f4049a10e4a- org.opencontainers.image.stage: build- workdir: /app/apps/server- env:- NODE_ENV: production- copy:- - paths:- - .- target: /app/- - fromBuilder: install- paths:- - /app/node_modules- target: /app/node_modules- - fromBuilder: install- paths:- - /app/apps/server/node_modules- target: /app/apps/server/node_modules- - fromBuilder: install- paths:- - /app/packages- target: /app/packages- run:- - bun build --compile --sourcemap src/index.ts --outfile=appfromImage:path: debiandigest: sha256:cd1bc32f233a49f1b82149c9edb8ef34fb1e6c45f37211445c51a97603468604label:- org.opencontainers.image.title: OpenStatus Server+ io.dofigen.version: 2.8.0org.opencontainers.image.authors: OpenStatus Teamorg.opencontainers.image.source: https://github.com/openstatusHQ/openstatus+ org.opencontainers.image.title: OpenStatus Server+ org.opencontainers.image.base.digest: sha256:cd1bc32f233a49f1b82149c9edb8ef34fb1e6c45f37211445c51a97603468604org.opencontainers.image.vendor: OpenStatusorg.opencontainers.image.description: REST API server with Hono framework for OpenStatus- org.opencontainers.image.base.digest: sha256:cd1bc32f233a49f1b82149c9edb8ef34fb1e6c45f37211445c51a97603468604- io.dofigen.version: 2.7.0org.opencontainers.image.base.name: docker.io/debian:bullseye-slimuser:user: '1000'@@ -162,20 +162,20 @@ effective: |retries: 3images:docker.io:+ oven:+ bun:+ 1.3.11:+ digest: sha256:0733e50325078969732ebe3b15ce4c4be5082f18c4ac1a0f0ca4839c2e4e42a7library:- debian:- bullseye-slim:- digest: sha256:cd1bc32f233a49f1b82149c9edb8ef34fb1e6c45f37211445c51a97603468604node:24-slim:digest: sha256:242549cd46785b480c832479a730f4f2a20865d61ea2e404fdb2a5c3d3b73ecf- oven:- bun:- 1.3.6:- digest: sha256:f20d9cf365ab35529384f1717687c739c92e6f39157a35a95ef06f4049a10e4a+ debian:+ bullseye-slim:+ digest: sha256:cd1bc32f233a49f1b82149c9edb8ef34fb1e6c45f37211445c51a97603468604resources:dofigen.yml:- hash: 4cc23ad9bfc0f05d70c6249323f4baaad4fc11aa5cd7f61660abba8221aa6755+ hash: 4ad3de79c65a09ba1ba428b29a15ab9131c66e271eb7c4376b4fdcc825ebd770content: |# Files to exclude from Docker contextignore:@@ -240,7 +240,7 @@ resources:# Stage 2: Build application (compile to binary)build:- fromImage: oven/bun:1.3.6+ fromImage: oven/bun:1.3.11workdir: /app/apps/serverlabels:org.opencontainers.image.stage: builddiff --git a/apps/server/dofigen.yml b/apps/server/dofigen.ymlindex d48bcded7..bdb9641f6 100644--- a/apps/server/dofigen.yml+++ b/apps/server/dofigen.yml@@ -61,7 +61,7 @@ builders:# Stage 2: Build application (compile to binary)build:- fromImage: oven/bun:1.3.6+ fromImage: oven/bun:1.3.11workdir: /app/apps/serverlabels:org.opencontainers.image.stage: builddiff --git a/apps/workflows/.dockerignore b/apps/workflows/.dockerignoreindex d5d76ff57..6ae672226 100644--- a/apps/workflows/.dockerignore+++ b/apps/workflows/.dockerignore@@ -1,4 +1,4 @@-# This file is generated by Dofigen v2.7.0+# This file is generated by Dofigen v2.8.0# See https://github.com/lenra-io/dofigennode_modulesdiff --git a/apps/workflows/Dockerfile b/apps/workflows/Dockerfileindex ec6ee2efd..42ee8271f 100644--- a/apps/workflows/Dockerfile+++ b/apps/workflows/Dockerfile@@ -1,5 +1,5 @@# syntax=docker/dockerfile:1.19.0-# This file is generated by Dofigen v2.7.0+# This file is generated by Dofigen v2.8.0# See https://github.com/lenra-io/dofigen# docker@@ -85,25 +85,21 @@ COPY \RUN bun build --compile --target bun --sourcemap src/index.ts --outfile=app# libsql-FROM node@sha256:242549cd46785b480c832479a730f4f2a20865d61ea2e404fdb2a5c3d3b73ecf AS libsql+FROM oven/bun@sha256:0733e50325078969732ebe3b15ce4c4be5082f18c4ac1a0f0ca4839c2e4e42a7 AS libsqlLABEL \- org.opencontainers.image.base.digest="sha256:242549cd46785b480c832479a730f4f2a20865d61ea2e404fdb2a5c3d3b73ecf" \- org.opencontainers.image.base.name="docker.io/node:24-slim"+ org.opencontainers.image.base.digest="sha256:0733e50325078969732ebe3b15ce4c4be5082f18c4ac1a0f0ca4839c2e4e42a7" \+ org.opencontainers.image.base.name="docker.io/oven/bun:1.3.11"WORKDIR /app/COPY \--from=docker \--link \"/app/apps/build-docker/package.json" "/app/package.json"-RUN <<EOF-corepack enable pnpm-pnpm install --prod --lockfile-only-pnpm install --prod --frozen-lockfile --config.node-linker=hoisted-EOF+RUN bun install --production# runtimeFROM debian@sha256:cd1bc32f233a49f1b82149c9edb8ef34fb1e6c45f37211445c51a97603468604 AS runtimeLABEL \- io.dofigen.version="2.7.0" \+ io.dofigen.version="2.8.0" \org.opencontainers.image.authors="OpenStatus Team" \org.opencontainers.image.base.digest="sha256:cd1bc32f233a49f1b82149c9edb8ef34fb1e6c45f37211445c51a97603468604" \org.opencontainers.image.base.name="docker.io/debian:bullseye-slim" \diff --git a/apps/workflows/dofigen.lock b/apps/workflows/dofigen.lockindex f8180e800..cb7e8ab90 100644--- a/apps/workflows/dofigen.lock+++ b/apps/workflows/dofigen.lock@@ -17,8 +17,8 @@ effective: |path: oven/bundigest: sha256:0733e50325078969732ebe3b15ce4c4be5082f18c4ac1a0f0ca4839c2e4e42a7label:- org.opencontainers.image.base.name: docker.io/oven/bun:1.3.11org.opencontainers.image.base.digest: sha256:0733e50325078969732ebe3b15ce4c4be5082f18c4ac1a0f0ca4839c2e4e42a7+ org.opencontainers.image.base.name: docker.io/oven/bun:1.3.11workdir: /app/apps/workflowscopy:- paths:@@ -31,9 +31,9 @@ effective: |path: nodedigest: sha256:242549cd46785b480c832479a730f4f2a20865d61ea2e404fdb2a5c3d3b73ecflabel:- org.opencontainers.image.base.digest: sha256:242549cd46785b480c832479a730f4f2a20865d61ea2e404fdb2a5c3d3b73ecf- org.opencontainers.image.base.name: docker.io/node:24-slimorg.opencontainers.image.stage: install+ org.opencontainers.image.base.name: docker.io/node:24-slim+ org.opencontainers.image.base.digest: sha256:242549cd46785b480c832479a730f4f2a20865d61ea2e404fdb2a5c3d3b73ecfworkdir: /app/run:- corepack enable pnpm@@ -107,11 +107,11 @@ effective: |source: packages/status-fetcher/package.jsonlibsql:fromImage:- path: node- digest: sha256:242549cd46785b480c832479a730f4f2a20865d61ea2e404fdb2a5c3d3b73ecf+ path: oven/bun+ digest: sha256:0733e50325078969732ebe3b15ce4c4be5082f18c4ac1a0f0ca4839c2e4e42a7label:- org.opencontainers.image.base.digest: sha256:242549cd46785b480c832479a730f4f2a20865d61ea2e404fdb2a5c3d3b73ecf- org.opencontainers.image.base.name: docker.io/node:24-slim+ org.opencontainers.image.base.name: docker.io/oven/bun:1.3.11+ org.opencontainers.image.base.digest: sha256:0733e50325078969732ebe3b15ce4c4be5082f18c4ac1a0f0ca4839c2e4e42a7workdir: /app/copy:- fromBuilder: docker@@ -119,17 +119,15 @@ effective: |- /app/apps/build-docker/package.jsontarget: /app/package.jsonrun:- - corepack enable pnpm- - pnpm install --prod --lockfile-only- - pnpm install --prod --frozen-lockfile --config.node-linker=hoisted+ - bun install --productionbuild:fromImage:path: oven/bundigest: sha256:0733e50325078969732ebe3b15ce4c4be5082f18c4ac1a0f0ca4839c2e4e42a7label:org.opencontainers.image.base.name: docker.io/oven/bun:1.3.11- org.opencontainers.image.base.digest: sha256:0733e50325078969732ebe3b15ce4c4be5082f18c4ac1a0f0ca4839c2e4e42a7org.opencontainers.image.stage: build+ org.opencontainers.image.base.digest: sha256:0733e50325078969732ebe3b15ce4c4be5082f18c4ac1a0f0ca4839c2e4e42a7workdir: /app/apps/workflowsenv:NODE_ENV: production@@ -155,14 +153,14 @@ effective: |path: debiandigest: sha256:cd1bc32f233a49f1b82149c9edb8ef34fb1e6c45f37211445c51a97603468604label:- org.opencontainers.image.source: https://github.com/openstatusHQ/openstatus- io.dofigen.version: 2.7.0+ org.opencontainers.image.description: Background job processing and probe scheduling for OpenStatus+ org.opencontainers.image.authors: OpenStatus Teamorg.opencontainers.image.base.digest: sha256:cd1bc32f233a49f1b82149c9edb8ef34fb1e6c45f37211445c51a97603468604+ org.opencontainers.image.title: OpenStatus Workflows+ org.opencontainers.image.source: https://github.com/openstatusHQ/openstatusorg.opencontainers.image.base.name: docker.io/debian:bullseye-slim- org.opencontainers.image.authors: OpenStatus Team+ io.dofigen.version: 2.8.0org.opencontainers.image.vendor: OpenStatus- org.opencontainers.image.title: OpenStatus Workflows- org.opencontainers.image.description: Background job processing and probe scheduling for OpenStatusworkdir: /app/copy:- fromBuilder: build@@ -200,7 +198,7 @@ images:digest: sha256:0733e50325078969732ebe3b15ce4c4be5082f18c4ac1a0f0ca4839c2e4e42a7resources:dofigen.yml:- hash: 84357196743d6620d9e8adb7b2a0a599060e730c7f5a4f55f29e9306c023528a+ hash: 9ad08ee36ff20abe093e58fc36235d056b6ed3e22b8ae2f3fb30399e34cdaebecontent: |ignore:- node_modules@@ -292,18 +290,16 @@ resources:run: bun run src/build-docker.tslibsql:- fromImage: node:24-slim+ fromImage: oven/bun:1.3.11workdir: /app/copy:- fromBuilder: dockersource: /app/apps/build-docker/package.jsontarget: /app/package.json- run:- - corepack enable pnpm- - pnpm install --prod --lockfile-only- # node-linker=hoisted gives a flat node_modules (like npm/bun) so the compiled bun- # binary can resolve the libsql native addon (@libsql/<platform>) from disk at runtime.- - pnpm install --prod --frozen-lockfile --config.node-linker=hoisted+ # bun install is hoisted by default -> flat node_modules so the compiled bun binary can+ # resolve the libsql native addon (@libsql/<platform>) from disk at runtime. No lockfile+ # is needed (the generated package.json pins one exact version), so a single install does it.+ run: bun install --productionfromImage: debian:bullseye-slimworkdir: /app/diff --git a/apps/workflows/dofigen.yml b/apps/workflows/dofigen.ymlindex 2d8a81b00..89c086ddd 100644--- a/apps/workflows/dofigen.yml+++ b/apps/workflows/dofigen.yml@@ -88,18 +88,16 @@ builders:run: bun run src/build-docker.tslibsql:- fromImage: node:24-slim+ fromImage: oven/bun:1.3.11workdir: /app/copy:- fromBuilder: dockersource: /app/apps/build-docker/package.jsontarget: /app/package.json- run:- - corepack enable pnpm- - pnpm install --prod --lockfile-only- # node-linker=hoisted gives a flat node_modules (like npm/bun) so the compiled bun- # binary can resolve the libsql native addon (@libsql/<platform>) from disk at runtime.- - pnpm install --prod --frozen-lockfile --config.node-linker=hoisted+ # bun install is hoisted by default -> flat node_modules so the compiled bun binary can+ # resolve the libsql native addon (@libsql/<platform>) from disk at runtime. No lockfile+ # is needed (the generated package.json pins one exact version), so a single install does it.+ run: bun install --productionfromImage: debian:bullseye-slimworkdir: /app/diff --git a/apps/workflows/src/incident/index.ts b/apps/workflows/src/incident/index.tsindex fe2f0a711..770d9fb02 100644--- a/apps/workflows/src/incident/index.ts+++ b/apps/workflows/src/incident/index.ts@@ -1,9 +1,8 @@-import { schema } from "@openstatus/db";+import { db, schema } from "@openstatus/db";import { and, eq, inArray, isNull, ne } from "drizzle-orm";import { Hono } from "hono";import { env } from "../env";-import { db } from "../lib/db";export const incidentRoute = new Hono({ strict: false });