Skip to content
39 linesCodeBlameRaw
1-- Docker deployments (src/containers.ts).
2
3-- Each project's choices: what it is built as (auto, static, workers or
4-- docker), its Dockerfile's path when not one g1t finds by itself, and the
5-- size its container runs at (a Cloudflare Containers instance type).
6ALTER TABLE settings ADD COLUMN build_as TEXT NOT NULL DEFAULT 'auto';
7ALTER TABLE settings ADD COLUMN dockerfile TEXT;
8ALTER TABLE settings ADD COLUMN instance_type TEXT NOT NULL DEFAULT 'lite';
9
10-- What each build found the project built with, next to `detected`: a
11-- framework's id (`astro`), or for a container `dockerfile` or the server
12-- g1t wrote a Dockerfile for (`flask`). And a container's image, by digest.
13ALTER TABLE deployments ADD COLUMN framework TEXT;
14ALTER TABLE deployments ADD COLUMN image TEXT;
15
16-- An app that is a container: its Container application, the size it runs
17-- at, and the hash of the token its Worker reports its running time with.
18-- `runtime` is `worker` for every other app.
19ALTER TABLE apps ADD COLUMN runtime TEXT NOT NULL DEFAULT 'worker';
20ALTER TABLE apps ADD COLUMN container_app_id TEXT;
21ALTER TABLE apps ADD COLUMN instance_type TEXT;
22ALTER TABLE apps ADD COLUMN meter_hash TEXT;
23
24-- How long each app's container ran in a month, and what it sent, as its
25-- Worker reports them: one row per counter (`epoch`, the Durable Object's
26-- own, which starts again at zero if it is ever new), each only ever
27-- raised, so a report repeated or out of order changes nothing.
28CREATE TABLE container_meters (
29 script TEXT NOT NULL,
30 epoch TEXT NOT NULL,
31 month TEXT NOT NULL,
32 workspace TEXT NOT NULL,
33 instance_type TEXT NOT NULL,
34 awake_seconds INTEGER NOT NULL DEFAULT 0,
35 egress_bytes INTEGER NOT NULL DEFAULT 0,
36 reported_at TEXT NOT NULL,
37 PRIMARY KEY (script, epoch, month)
38);
39CREATE INDEX container_meters_by_month ON container_meters (month, workspace);