Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions platform/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,19 @@ STRIPE_PRICE_STARTER=price_...
STRIPE_PRICE_PRO=price_...
STRIPE_PRICE_ENTERPRISE=price_...

# ─── Fly.io (instance provisioning) ─────────────────────────────────────────
FLY_API_TOKEN=fo1_...
# Optional global app fallback. Per-instance app name is generated from user/org.
FLY_APP_NAME=
# Recommended: dedicated managed-runtime image that starts `the-companion serve`.
# ─── Instance provisioning ──────────────────────────────────────────────────
# Recommended managed-runtime image that starts `the-companion serve`.
COMPANION_IMAGE=docker.io/stangirard/the-companion-server:latest
# Optional org where apps are created (defaults to "personal")
FLY_ORG_SLUG=

# ─── Hetzner Cloud (instance provisioning) ──────────────────────────────────
# Required
HETZNER_API_TOKEN=hcloud_...
# Optional Hetzner SSH key id/name to inject during server create
HETZNER_SSH_KEY_ID=
# Optional per-plan server type overrides
HETZNER_SERVER_TYPE_STARTER=cpx11
HETZNER_SERVER_TYPE_PRO=cpx21
HETZNER_SERVER_TYPE_ENTERPRISE=cpx31

# ─── Server ──────────────────────────────────────────────────────────────────
PORT=3458
48 changes: 0 additions & 48 deletions platform/docker/Dockerfile.fly-managed

This file was deleted.

6 changes: 4 additions & 2 deletions platform/server/db/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ export const instances = pgTable("instances", {
organizationId: text("organization_id").notNull(),
ownerId: text("owner_id"), // null = shared instance
ownerType: text("owner_type").notNull().default("shared"), // "shared" | "personal"
flyMachineId: text("fly_machine_id").unique(),
flyVolumeId: text("fly_volume_id"),
// Keep legacy SQL column names for backward compatibility with existing DBs.
// Property names are provider-neutral in application code.
providerMachineId: text("fly_machine_id").unique(),
providerVolumeId: text("fly_volume_id"),
region: text("region").notNull().default("iad"),
hostname: text("hostname").unique(),
customDomain: text("custom_domain"),
Expand Down
5 changes: 5 additions & 0 deletions platform/server/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ describe("GET /api/status", () => {
service: "companion-cloud",
version: "0.1.0",
status: "ok",
provisioning: {
provider: expect.any(String),
regions: expect.any(Array),
},
});
expect(body.provisioning.regions.length).toBeGreaterThan(0);
});

it("includes CORS headers on /api/* routes", async () => {
Expand Down
9 changes: 9 additions & 0 deletions platform/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import { dashboard } from "./routes/dashboard.js";

const __dirname = dirname(fileURLToPath(import.meta.url));
const port = Number(process.env.PORT) || 3458;
const instanceProvider = "hetzner";
const provisioningRegions = [
{ value: "iad", label: "US East (ASH)" },
{ value: "cdg", label: "Europe (FSN)" },
];

const app = new Hono();

Expand Down Expand Up @@ -60,6 +65,10 @@ app.get("/api/status", (c) => {
service: "companion-cloud",
version: "0.1.0",
status: "ok",
provisioning: {
provider: instanceProvider,
regions: provisioningRegions,
},
});
});

Expand Down
Loading