Skip to content

Commit 9b6888a

Browse files
committed
feat(examples): multitenant using remote builds (#2619)
<!-- Please make sure there is an issue that this PR is correlated to. --> ## Changes <!-- If there are frontend changes, please include screenshots. --> Fixes RVT-4791
1 parent da726ec commit 9b6888a

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

examples/multitenant-deploys/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ WORKDIR /app
44

55
# Install rivet CLI
66
RUN apk add --no-cache curl unzip
7-
RUN curl -fsSL https://get.rivet.gg/install.sh | sh
7+
RUN curl -fsSL https://releases.rivet.gg/rivet/latest/install.sh | sh
88

99
# Copy package files and install dependencies
1010
COPY package.json yarn.lock ./

examples/multitenant-deploys/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ yarn test
6565
{
6666
"success": true,
6767
"appId": "your-app-id",
68-
"endpoint": "https://your-app-id.example.com"
68+
"endpoint": "https://your-app-id.example.com",
69+
"buildOutput": "..." // Output logs from build command
6970
}
7071
```
7172

examples/multitenant-deploys/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
},
99
"dependencies": {
1010
"@hono/node-server": "^1.7.0",
11-
"@rivet-gg/api-full": "workspace:*",
1211
"axios": "^1.6.7",
1312
"hono": "^4.0.5",
1413
"temp": "^0.9.4"

examples/multitenant-deploys/src/app.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { promisify } from "node:util";
44
import * as fs from "node:fs/promises";
55
import * as path from "node:path";
66
import temp from "temp";
7-
import { RivetClient } from "@rivet-gg/api-full";
87

98
const execAsync = promisify(exec);
109

@@ -22,8 +21,6 @@ if (!RIVET_CLOUD_TOKEN || !RIVET_PROJECT || !RIVET_ENVIRONMENT) {
2221
);
2322
}
2423

25-
export const rivet = new RivetClient({ token: RIVET_CLOUD_TOKEN });
26-
2724
export const app = new Hono();
2825

2926
app.onError((err, c) => {
@@ -102,7 +99,10 @@ app.post("/deploy/:appId", async (c) => {
10299
functions: {
103100
[functionName]: {
104101
build_path: "./project/",
105-
dockerfile: "./project/Dockerfile",
102+
dockerfile: "./Dockerfile",
103+
unstable: {
104+
build_method: "remote"
105+
},
106106
build_args: {
107107
// See MY_ENV_VAR build args in Dockerfile
108108
MY_ENV_VAR: "custom env var",
@@ -137,7 +137,7 @@ app.post("/deploy/:appId", async (c) => {
137137

138138
// Get the function endpoint
139139
const endpointResult = await execAsync(
140-
`rivet function endpoint --environment prod ${functionName}`,
140+
`rivet function endpoint --environment ${RIVET_ENVIRONMENT} ${functionName}`,
141141
{
142142
cwd: tempDir,
143143
},
@@ -151,5 +151,6 @@ app.post("/deploy/:appId", async (c) => {
151151
success: true,
152152
appId,
153153
endpoint: endpointUrl,
154+
buildOutput: deployResult.stdout,
154155
});
155156
});

0 commit comments

Comments
 (0)