Skip to content

Open-source status page, incident response and uptime monitoring

Automate the dev environment with Devbox (#1169)

Mike73cc277ba949
diff --git a/.gitignore b/.gitignore
index 52b6a2802..7274504ca 100644
--- a/.gitignore
+++ b/.gitignore
@@ -60,6 +60,7 @@ openstatus-test.db-wal
.wrangler
apps/web/.env.dev
packages/db/.env.dev
+openstatus-dev.db
openstatus-dev.db-wal
openstatus-dev.db-shm
apps/ingest-worker/.production.vars
diff --git a/README.md b/README.md
index 905d69b5c..4b68fb27b 100644
--- a/README.md
+++ b/README.md
@@ -84,6 +84,21 @@ Made with [Contrib.rocks](https://contrib.rocks)
## Getting Started 🚀
+### With Devbox
+
+You can use [Devbox](https://www.jetify.com/devbox/) and get started with the following commands:
+
+1. Install Devbox
+ ```sh
+ curl -fsSL https://get.jetify.com/devbox | bash
+ ```
+2. Install project dependencies, build and start services
+ ```sh
+ devbox services up
+ ```
+
+Alternatively, follow the instructions below.
+
### Requirements
- [Node.js](https://nodejs.org/en/) >= 20.0.0
diff --git a/devbox.json b/devbox.json
new file mode 100644
index 000000000..553eedd10
--- /dev/null
+++ b/devbox.json
@@ -0,0 +1,10 @@
+{
+ "$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.10.6/.schema/devbox.schema.json",
+ "packages": ["turso-cli@latest", "nodejs@20", "bun@latest", "sqld@latest"],
+ "env": {
+ "DEVBOX_COREPACK_ENABLED": "true"
+ },
+ "shell": {
+ "init_hook": ["yes | pnpm -v &> /dev/null"]
+ }
+}
diff --git a/devbox.lock b/devbox.lock
new file mode 100644
index 000000000..86d824ea0
--- /dev/null
+++ b/devbox.lock
@@ -0,0 +1,214 @@
+{
+ "lockfile_version": "1",
+ "packages": {
+ "bun@latest": {
+ "last_modified": "2025-01-13T08:04:02Z",
+ "resolved": "github:NixOS/nixpkgs/ef56e777fedaa4da8c66a150081523c5de1e0171#bun",
+ "source": "devbox-search",
+ "version": "1.1.43",
+ "systems": {
+ "aarch64-darwin": {
+ "outputs": [
+ {
+ "name": "out",
+ "path": "/nix/store/wg9x0cb4rl5jrvmkak6ihljdxl811h62-bun-1.1.43",
+ "default": true
+ }
+ ],
+ "store_path": "/nix/store/wg9x0cb4rl5jrvmkak6ihljdxl811h62-bun-1.1.43"
+ },
+ "aarch64-linux": {
+ "outputs": [
+ {
+ "name": "out",
+ "path": "/nix/store/6yszhl10ah05n17lf35kpnyzrqlsg3hl-bun-1.1.43",
+ "default": true
+ }
+ ],
+ "store_path": "/nix/store/6yszhl10ah05n17lf35kpnyzrqlsg3hl-bun-1.1.43"
+ },
+ "x86_64-darwin": {
+ "outputs": [
+ {
+ "name": "out",
+ "path": "/nix/store/4rjyabjj3fj3qd01sv6aii0qcnxb6jyx-bun-1.1.43",
+ "default": true
+ }
+ ],
+ "store_path": "/nix/store/4rjyabjj3fj3qd01sv6aii0qcnxb6jyx-bun-1.1.43"
+ },
+ "x86_64-linux": {
+ "outputs": [
+ {
+ "name": "out",
+ "path": "/nix/store/k8yj5s89swbhlh1i8lp25ha2hw9171yr-bun-1.1.43",
+ "default": true
+ }
+ ],
+ "store_path": "/nix/store/k8yj5s89swbhlh1i8lp25ha2hw9171yr-bun-1.1.43"
+ }
+ }
+ },
+ "nodejs@20": {
+ "last_modified": "2024-05-03T15:42:32Z",
+ "plugin_version": "0.0.2",
+ "resolved": "github:NixOS/nixpkgs/5fd8536a9a5932d4ae8de52b7dc08d92041237fc#nodejs_20",
+ "source": "devbox-search",
+ "version": "20.12.2",
+ "systems": {
+ "aarch64-darwin": {
+ "outputs": [
+ {
+ "name": "out",
+ "path": "/nix/store/844n9zrm2sindml9hvla57shgwavwyjn-nodejs-20.12.2",
+ "default": true
+ },
+ {
+ "name": "libv8",
+ "path": "/nix/store/zsss2v62ff4wxbbv6zizjk6zmlhkqjzh-nodejs-20.12.2-libv8"
+ }
+ ],
+ "store_path": "/nix/store/844n9zrm2sindml9hvla57shgwavwyjn-nodejs-20.12.2"
+ },
+ "aarch64-linux": {
+ "outputs": [
+ {
+ "name": "out",
+ "path": "/nix/store/4lpbv14w1bhh1z2v3sjhv9xcp05pgn2d-nodejs-20.12.2",
+ "default": true
+ },
+ {
+ "name": "libv8",
+ "path": "/nix/store/lhiqlp28jmnhqibsr550yf6fqbx5c9c7-nodejs-20.12.2-libv8"
+ }
+ ],
+ "store_path": "/nix/store/4lpbv14w1bhh1z2v3sjhv9xcp05pgn2d-nodejs-20.12.2"
+ },
+ "x86_64-darwin": {
+ "outputs": [
+ {
+ "name": "out",
+ "path": "/nix/store/49d07knzwmlaggcq86d98fpzqa70a2ya-nodejs-20.12.2",
+ "default": true
+ },
+ {
+ "name": "libv8",
+ "path": "/nix/store/idmhy1hnfndv43ncd6yy60vdwin1nyfa-nodejs-20.12.2-libv8"
+ }
+ ],
+ "store_path": "/nix/store/49d07knzwmlaggcq86d98fpzqa70a2ya-nodejs-20.12.2"
+ },
+ "x86_64-linux": {
+ "outputs": [
+ {
+ "name": "out",
+ "path": "/nix/store/71r8n7ckcpvav9qwshlr12hjd5nlchds-nodejs-20.12.2",
+ "default": true
+ },
+ {
+ "name": "libv8",
+ "path": "/nix/store/zyp86pvn1l7fsw0s7kgv5iwmn14z0vg7-nodejs-20.12.2-libv8"
+ }
+ ],
+ "store_path": "/nix/store/71r8n7ckcpvav9qwshlr12hjd5nlchds-nodejs-20.12.2"
+ }
+ }
+ },
+ "sqld@latest": {
+ "last_modified": "2024-12-03T12:40:06Z",
+ "resolved": "github:NixOS/nixpkgs/566e53c2ad750c84f6d31f9ccb9d00f823165550#sqld",
+ "source": "devbox-search",
+ "version": "0.24.18",
+ "systems": {
+ "aarch64-darwin": {
+ "outputs": [
+ {
+ "name": "out",
+ "path": "/nix/store/znd6nm9kkpkdwk4db7h6j7fkk5p5k6wa-sqld-0.24.18",
+ "default": true
+ }
+ ],
+ "store_path": "/nix/store/znd6nm9kkpkdwk4db7h6j7fkk5p5k6wa-sqld-0.24.18"
+ },
+ "aarch64-linux": {
+ "outputs": [
+ {
+ "name": "out",
+ "path": "/nix/store/dm4jsc4acixxznds5xdpxg1isd2scg8a-sqld-0.24.18",
+ "default": true
+ }
+ ],
+ "store_path": "/nix/store/dm4jsc4acixxznds5xdpxg1isd2scg8a-sqld-0.24.18"
+ },
+ "x86_64-darwin": {
+ "outputs": [
+ {
+ "name": "out",
+ "path": "/nix/store/rsvrgk3b71b149a0d5hxf7zhcn42d7qm-sqld-0.24.18",
+ "default": true
+ }
+ ],
+ "store_path": "/nix/store/rsvrgk3b71b149a0d5hxf7zhcn42d7qm-sqld-0.24.18"
+ },
+ "x86_64-linux": {
+ "outputs": [
+ {
+ "name": "out",
+ "path": "/nix/store/gfxfxqnj208jhld4m56zab3byhhq63dc-sqld-0.24.18",
+ "default": true
+ }
+ ],
+ "store_path": "/nix/store/gfxfxqnj208jhld4m56zab3byhhq63dc-sqld-0.24.18"
+ }
+ }
+ },
+ "turso-cli@latest": {
+ "last_modified": "2024-12-23T21:10:33Z",
+ "resolved": "github:NixOS/nixpkgs/de1864217bfa9b5845f465e771e0ecb48b30e02d#turso-cli",
+ "source": "devbox-search",
+ "version": "0.97.2",
+ "systems": {
+ "aarch64-darwin": {
+ "outputs": [
+ {
+ "name": "out",
+ "path": "/nix/store/0lddbdg4y9fyiqvvlp82zblmmcrnji3c-turso-cli-0.97.2",
+ "default": true
+ }
+ ],
+ "store_path": "/nix/store/0lddbdg4y9fyiqvvlp82zblmmcrnji3c-turso-cli-0.97.2"
+ },
+ "aarch64-linux": {
+ "outputs": [
+ {
+ "name": "out",
+ "path": "/nix/store/dyfpmyx65n26c44dvw6h80aa66s5cabf-turso-cli-0.97.2",
+ "default": true
+ }
+ ],
+ "store_path": "/nix/store/dyfpmyx65n26c44dvw6h80aa66s5cabf-turso-cli-0.97.2"
+ },
+ "x86_64-darwin": {
+ "outputs": [
+ {
+ "name": "out",
+ "path": "/nix/store/b6k6gkc2np7dhlrd6r2347pd2zgp7dg5-turso-cli-0.97.2",
+ "default": true
+ }
+ ],
+ "store_path": "/nix/store/b6k6gkc2np7dhlrd6r2347pd2zgp7dg5-turso-cli-0.97.2"
+ },
+ "x86_64-linux": {
+ "outputs": [
+ {
+ "name": "out",
+ "path": "/nix/store/fxgjr95908fmpysl9wamziaa6lq50kws-turso-cli-0.97.2",
+ "default": true
+ }
+ ],
+ "store_path": "/nix/store/fxgjr95908fmpysl9wamziaa6lq50kws-turso-cli-0.97.2"
+ }
+ }
+ }
+ }
+}
diff --git a/packages/db/src/seed.mts b/packages/db/src/seed.mts
index 81a0e5e61..194f795a5 100644
--- a/packages/db/src/seed.mts
+++ b/packages/db/src/seed.mts
@@ -49,6 +49,7 @@ async function main() {
paidUntil: null,
},
])
+ .onConflictDoNothing()
.run();
await db
@@ -91,6 +92,7 @@ async function main() {
body: '{"hello":"world"}',
},
])
+ .onConflictDoNothing()
.run();
await db
@@ -105,6 +107,7 @@ async function main() {
customDomain: "",
published: true,
})
+ .onConflictDoNothing()
.run();
await db
@@ -117,13 +120,19 @@ async function main() {
photoUrl: "",
})
+ .onConflictDoNothing()
.run();
await db
.insert(usersToWorkspaces)
.values({ workspaceId: 1, userId: 1 })
+ .onConflictDoNothing()
.run();
- await db.insert(monitorsToPages).values({ monitorId: 1, pageId: 1 }).run();
+ await db
+ .insert(monitorsToPages)
+ .values({ monitorId: 1, pageId: 1 })
+ .onConflictDoNothing()
+ .run();
await db
.insert(notification)
.values({
@@ -133,10 +142,12 @@ async function main() {
data: '{"email":"[email protected]"}',
workspaceId: 1,
})
+ .onConflictDoNothing()
.run();
await db
.insert(notificationsToMonitors)
.values({ monitorId: 1, notificationId: 1 })
+ .onConflictDoNothing()
.run();
await db
@@ -149,6 +160,7 @@ async function main() {
status: "investigating",
updatedAt: new Date(),
})
+ .onConflictDoNothing()
.run();
await db
@@ -160,6 +172,7 @@ async function main() {
message: "Message",
date: new Date(),
})
+ .onConflictDoNothing()
.run();
await db
@@ -172,6 +185,7 @@ async function main() {
status: "investigating",
updatedAt: new Date(),
})
+ .onConflictDoNothing()
.run();
await db
@@ -183,18 +197,23 @@ async function main() {
message: "Message",
date: new Date(),
})
+ .onConflictDoNothing()
.run();
- await db.insert(monitorsToStatusReport).values([
- {
- monitorId: 1,
- statusReportId: 2,
- },
- {
- monitorId: 2,
- statusReportId: 2,
- },
- ]);
+ await db
+ .insert(monitorsToStatusReport)
+ .values([
+ {
+ monitorId: 1,
+ statusReportId: 2,
+ },
+ {
+ monitorId: 2,
+ statusReportId: 2,
+ },
+ ])
+ .onConflictDoNothing()
+ .run();
await db
.insert(incidentTable)
@@ -205,6 +224,7 @@ async function main() {
createdAt: new Date(),
startedAt: new Date(),
})
+ .onConflictDoNothing()
.run();
await db
@@ -216,6 +236,7 @@ async function main() {
createdAt: new Date(),
startedAt: new Date(Date.now() + 1000),
})
+ .onConflictDoNothing()
.run();
// on status update
await db
@@ -231,6 +252,7 @@ async function main() {
message: "test",
date: new Date(),
})
+ .onConflictDoNothing()
.run();
process.exit(0);
}
diff --git a/process-compose.yaml b/process-compose.yaml
new file mode 100644
index 000000000..3f321e4a6
--- /dev/null
+++ b/process-compose.yaml
@@ -0,0 +1,34 @@
+version: "0.5"
+is_strict: true
+processes:
+ init_dependencies:
+ namespace: init
+ command: |
+ pnpm install
+ is_tty: true
+ init_turso:
+ namespace: init
+ command: |
+ turso dev --db-file openstatus-dev.db
+ is_tty: true
+ availability:
+ restart: "no"
+ init_dx:
+ namespace: init
+ command: |
+ pnpm dx
+ kill $(pgrep -f "turso dev")
+ is_tty: true
+ depends_on:
+ init_dependencies:
+ condition: process_completed_successfully
+ init_turso:
+ condition: process_started
+ dev:
+ namespace: dev
+ command: |
+ pnpm dev:web
+ is_tty: true
+ depends_on:
+ init_dx:
+ condition: process_completed_successfully