From 17ff3d9082a711c59c96d2c7f732747a5b81e8ca Mon Sep 17 00:00:00 2001 From: abcxff <79597906+abcxff@users.noreply.github.com> Date: Mon, 16 Jun 2025 15:16:51 -0400 Subject: [PATCH] feat(examples): multitenant using remote builds --- examples/multitenant-deploys/Dockerfile | 2 +- examples/multitenant-deploys/README.md | 3 ++- examples/multitenant-deploys/package.json | 1 - examples/multitenant-deploys/src/app.ts | 11 ++++++----- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/examples/multitenant-deploys/Dockerfile b/examples/multitenant-deploys/Dockerfile index 14bf0bf02f..56718aca46 100644 --- a/examples/multitenant-deploys/Dockerfile +++ b/examples/multitenant-deploys/Dockerfile @@ -4,7 +4,7 @@ WORKDIR /app # Install rivet CLI RUN apk add --no-cache curl unzip -RUN curl -fsSL https://get.rivet.gg/install.sh | sh +RUN curl -fsSL https://releases.rivet.gg/rivet/latest/install.sh | sh # Copy package files and install dependencies COPY package.json yarn.lock ./ diff --git a/examples/multitenant-deploys/README.md b/examples/multitenant-deploys/README.md index e8fb6a20c3..e98eba2dac 100644 --- a/examples/multitenant-deploys/README.md +++ b/examples/multitenant-deploys/README.md @@ -65,7 +65,8 @@ yarn test { "success": true, "appId": "your-app-id", - "endpoint": "https://your-app-id.example.com" + "endpoint": "https://your-app-id.example.com", + "buildOutput": "..." // Output logs from build command } ``` diff --git a/examples/multitenant-deploys/package.json b/examples/multitenant-deploys/package.json index e321b1b2d6..001a9c24ea 100644 --- a/examples/multitenant-deploys/package.json +++ b/examples/multitenant-deploys/package.json @@ -8,7 +8,6 @@ }, "dependencies": { "@hono/node-server": "^1.7.0", - "@rivet-gg/api-full": "workspace:*", "axios": "^1.6.7", "hono": "^4.0.5", "temp": "^0.9.4" diff --git a/examples/multitenant-deploys/src/app.ts b/examples/multitenant-deploys/src/app.ts index 5f359b9d7b..dc8dc10798 100644 --- a/examples/multitenant-deploys/src/app.ts +++ b/examples/multitenant-deploys/src/app.ts @@ -4,7 +4,6 @@ import { promisify } from "node:util"; import * as fs from "node:fs/promises"; import * as path from "node:path"; import temp from "temp"; -import { RivetClient } from "@rivet-gg/api-full"; const execAsync = promisify(exec); @@ -22,8 +21,6 @@ if (!RIVET_CLOUD_TOKEN || !RIVET_PROJECT || !RIVET_ENVIRONMENT) { ); } -export const rivet = new RivetClient({ token: RIVET_CLOUD_TOKEN }); - export const app = new Hono(); app.onError((err, c) => { @@ -102,7 +99,10 @@ app.post("/deploy/:appId", async (c) => { functions: { [functionName]: { build_path: "./project/", - dockerfile: "./project/Dockerfile", + dockerfile: "./Dockerfile", + unstable: { + build_method: "remote" + }, build_args: { // See MY_ENV_VAR build args in Dockerfile MY_ENV_VAR: "custom env var", @@ -137,7 +137,7 @@ app.post("/deploy/:appId", async (c) => { // Get the function endpoint const endpointResult = await execAsync( - `rivet function endpoint --environment prod ${functionName}`, + `rivet function endpoint --environment ${RIVET_ENVIRONMENT} ${functionName}`, { cwd: tempDir, }, @@ -151,5 +151,6 @@ app.post("/deploy/:appId", async (c) => { success: true, appId, endpoint: endpointUrl, + buildOutput: deployResult.stdout, }); });