openvibers/openvibe.ai Commits

Own endpoints' migration is 0042 (the deploy was rolled back: 0039 after applied 0040) (#341)

OP OpenVibers committed 6 days ago · f17b5fe74a · 3 files, +49 −49

Changes

ddiff --git a/docs/ai-gpus.md b/docs/ai-gpus.md
iindex e197c28..41a941d 100644
---- a/docs/ai-gpus.md
++++ b/docs/ai-gpus.md
@@@ -91,7 +91,7 @@ the reconciler (one implementation, the same one the service runs) does the work
## Your own endpoint (the private rent)
The Exchange's product line 6, "your own endpoint", is the same provisioner with a private rent on top
--(`server/gpu/endpoints.js`, migration `0039_own_endpoints.sql`):
++(`server/gpu/endpoints.js`, migration `0042_own_endpoints.sql`):
- a person picks one of the models above, or brings their own Hugging Face `.gguf` (and an optional
LoRA), from OpenVibe.Exchange's `/own` page or the person API (`/api/v1/own-endpoints`);
ddiff --git a/migrations/0039_own_endpoints.sql b/migrations/0039_own_endpoints.sql
ddeleted file mode 100644
iindex a411b77..0000000
---- a/migrations/0039_own_endpoints.sql
++++ /dev/null
@@@ -1,48 +0,0 @@
---- phase: expand
---- Your own endpoint (the Exchange remake, product line 6 / build order 7): a private GPU endpoint a person
---- rents for a chosen catalog model or their own Hugging Face weights. The instance is the existing
---- gpu_instances row (the GPU provisioner rents, health-checks, scales it to zero and enforces the owner's
---- monthly cap); this table is the person's endpoint on top of it: who owns it, what it serves, the Billing
---- hold that pays for the seconds, and the public proxy its owner calls. Additive only: nothing existing is
---- changed, gpu_instances gains two nullable columns.
--CREATE TABLE IF NOT EXISTS own_endpoints (
-- id text COLLATE "C" PRIMARY KEY, -- oep_<ULID>
-- subject text COLLATE "C" NOT NULL, -- usr_<ULID>: the owner and the payer
-- status text COLLATE "C" NOT NULL CHECK (status IN ('requested','starting','running','stopping','stopped','refused','error')),
-- source text COLLATE "C" NOT NULL CHECK (source IN ('catalog','weights')),
-- catalog_key text COLLATE "C", -- a model the provisioner knows, when source=catalog
-- display_name text COLLATE "C" NOT NULL,
-- weights_repo text COLLATE "C",
-- weights_file text COLLATE "C",
-- lora_repo text COLLATE "C",
-- lora_file text COLLATE "C",
-- context_window integer,
-- idle_minutes integer NOT NULL,
-- max_runtime_minutes integer NOT NULL,
-- marketplace text COLLATE "C",
-- price_per_hour text COLLATE "C", -- the marketplace's own decimal price
-- hourly_nano bigint, -- that price as exact nano-USD per hour
-- reserved_nano bigint NOT NULL DEFAULT 0, -- the budget held from Billing for this start
-- instance_id text COLLATE "C", -- gpu_instances.id
-- endpoint text COLLATE "C", -- the rented instance's own URL (never public)
-- url text COLLATE "C", -- this endpoint's public URL (the AI proxy)
-- billing_hold_id text COLLATE "C",
-- billing_settled_at timestamptz,
-- charged_nano bigint NOT NULL DEFAULT 0, -- what the person's Balance paid for this start
-- month text COLLATE "C" NOT NULL,
-- error text COLLATE "C", -- a plain reason when refused or stopped
-- created_at timestamptz NOT NULL,
-- updated_at timestamptz NOT NULL,
-- started_at timestamptz,
-- ready_at timestamptz,
-- stopped_at timestamptz
--);
--CREATE INDEX IF NOT EXISTS own_endpoints_subject ON own_endpoints (subject, created_at DESC);
--CREATE INDEX IF NOT EXISTS own_endpoints_status ON own_endpoints (status);
--CREATE INDEX IF NOT EXISTS own_endpoints_month ON own_endpoints (month);
--
---- The instance knows the endpoint it serves, so the reconciler can tell a private rent from a shared model
---- offer (a private rent is never registered for the router) and give it the endpoint's own idle timer.
--ALTER TABLE gpu_instances ADD COLUMN IF NOT EXISTS own_endpoint_id text COLLATE "C";
--ALTER TABLE gpu_instances ADD COLUMN IF NOT EXISTS idle_minutes integer;
--CREATE INDEX IF NOT EXISTS gpu_instances_own ON gpu_instances (own_endpoint_id) WHERE own_endpoint_id IS NOT NULL;
ddiff --git a/migrations/0042_own_endpoints.sql b/migrations/0042_own_endpoints.sql
nnew file mode 100644
iindex 0000000..a411b77
---- /dev/null
++++ b/migrations/0042_own_endpoints.sql
@@@ -0,0 +1,48 @@
++-- phase: expand
++-- Your own endpoint (the Exchange remake, product line 6 / build order 7): a private GPU endpoint a person
++-- rents for a chosen catalog model or their own Hugging Face weights. The instance is the existing
++-- gpu_instances row (the GPU provisioner rents, health-checks, scales it to zero and enforces the owner's
++-- monthly cap); this table is the person's endpoint on top of it: who owns it, what it serves, the Billing
++-- hold that pays for the seconds, and the public proxy its owner calls. Additive only: nothing existing is
++-- changed, gpu_instances gains two nullable columns.
++CREATE TABLE IF NOT EXISTS own_endpoints (
++ id text COLLATE "C" PRIMARY KEY, -- oep_<ULID>
++ subject text COLLATE "C" NOT NULL, -- usr_<ULID>: the owner and the payer
++ status text COLLATE "C" NOT NULL CHECK (status IN ('requested','starting','running','stopping','stopped','refused','error')),
++ source text COLLATE "C" NOT NULL CHECK (source IN ('catalog','weights')),
++ catalog_key text COLLATE "C", -- a model the provisioner knows, when source=catalog
++ display_name text COLLATE "C" NOT NULL,
++ weights_repo text COLLATE "C",
++ weights_file text COLLATE "C",
++ lora_repo text COLLATE "C",
++ lora_file text COLLATE "C",
++ context_window integer,
++ idle_minutes integer NOT NULL,
++ max_runtime_minutes integer NOT NULL,
++ marketplace text COLLATE "C",
++ price_per_hour text COLLATE "C", -- the marketplace's own decimal price
++ hourly_nano bigint, -- that price as exact nano-USD per hour
++ reserved_nano bigint NOT NULL DEFAULT 0, -- the budget held from Billing for this start
++ instance_id text COLLATE "C", -- gpu_instances.id
++ endpoint text COLLATE "C", -- the rented instance's own URL (never public)
++ url text COLLATE "C", -- this endpoint's public URL (the AI proxy)
++ billing_hold_id text COLLATE "C",
++ billing_settled_at timestamptz,
++ charged_nano bigint NOT NULL DEFAULT 0, -- what the person's Balance paid for this start
++ month text COLLATE "C" NOT NULL,
++ error text COLLATE "C", -- a plain reason when refused or stopped
++ created_at timestamptz NOT NULL,
++ updated_at timestamptz NOT NULL,
++ started_at timestamptz,
++ ready_at timestamptz,
++ stopped_at timestamptz
++);
++CREATE INDEX IF NOT EXISTS own_endpoints_subject ON own_endpoints (subject, created_at DESC);
++CREATE INDEX IF NOT EXISTS own_endpoints_status ON own_endpoints (status);
++CREATE INDEX IF NOT EXISTS own_endpoints_month ON own_endpoints (month);
++
++-- The instance knows the endpoint it serves, so the reconciler can tell a private rent from a shared model
++-- offer (a private rent is never registered for the router) and give it the endpoint's own idle timer.
++ALTER TABLE gpu_instances ADD COLUMN IF NOT EXISTS own_endpoint_id text COLLATE "C";
++ALTER TABLE gpu_instances ADD COLUMN IF NOT EXISTS idle_minutes integer;
++CREATE INDEX IF NOT EXISTS gpu_instances_own ON gpu_instances (own_endpoint_id) WHERE own_endpoint_id IS NOT NULL;