Skip to content

Commit 54850cf

Browse files
committed
Add working Deploy to Render flow
1 parent 8c09be0 commit 54850cf

5 files changed

Lines changed: 115 additions & 4 deletions

File tree

‎apps/mobile/App.tsx‎

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,23 @@ import { StatusBar } from "expo-status-bar";
33
import {
44
Bell,
55
Check,
6+
CloudUpload,
7+
Github,
68
Lightbulb,
79
type LucideIcon,
810
Menu,
911
MessageCircle,
1012
PanelsTopLeft,
1113
Shapes,
1214
SquareCheck,
15+
UserPlus,
1316
X,
1417
} from "lucide-react-native";
1518
import { useCallback, useEffect, useMemo, useState } from "react";
1619
import {
1720
ActivityIndicator,
1821
AppState,
22+
Linking,
1923
Pressable,
2024
ScrollView,
2125
Text,
@@ -37,6 +41,11 @@ import { ChatScreen, WorkspaceTools } from "./src/chat";
3741
import { ComputerEntry } from "./src/computer";
3842
import { ComputerDraftProvider } from "./src/computer-drafts";
3943
import { Details } from "./src/details";
44+
import {
45+
DEPLOY_TO_RENDER_URL,
46+
GITHUB_REPOSITORY_URL,
47+
renderSignupUrlWithUtms,
48+
} from "./src/render-links";
4049
import { BrowserScreen, CalendarScreen, FilesScreen, MailScreen } from "./src/screens";
4150
import { ThreadsProvider, ThreadsSheet, useMuseThread } from "./src/threads";
4251
import { Button, Card, colors, ErrorNotice, Field, IconButton, Mascot, s } from "./src/ui";
@@ -301,14 +310,19 @@ function WorkspaceShell({
301310
marginHorizontal: 20,
302311
}}
303312
>
304-
<View style={{ position: "absolute", left: 0, top: 16 }}>
313+
<View style={[s.row, { position: "absolute", left: 0, top: 16 }]}>
305314
<IconButton
306315
icon={Menu}
307316
label="Open conversations and menu"
308317
onPress={() => setThreadsOpen(true)}
309318
/>
319+
<IconButton
320+
icon={CloudUpload}
321+
label="Deploy to Render"
322+
onPress={() => void Linking.openURL(DEPLOY_TO_RENDER_URL)}
323+
/>
310324
</View>
311-
<View style={{ alignItems: "center", gap: 1 }}>
325+
<View style={{ alignItems: "center", gap: 1, maxWidth: desktop ? "70%" : 120 }}>
312326
<Pressable
313327
accessibilityRole="button"
314328
accessibilityLabel={`Open ${agentName} activity and approvals`}
@@ -339,7 +353,12 @@ function WorkspaceShell({
339353
</Pressable>
340354
{section === "chat" && <ComputerEntry />}
341355
</View>
342-
<View style={{ position: "absolute", right: 0, top: 16 }}>
356+
<View style={[s.row, { position: "absolute", right: 0, top: 16 }]}>
357+
<IconButton
358+
icon={UserPlus}
359+
label="Sign up on Render"
360+
onPress={() => void Linking.openURL(renderSignupUrlWithUtms())}
361+
/>
343362
<IconButton
344363
icon={Bell}
345364
label={`Notifications, ${pending} unread or pending`}
@@ -470,6 +489,17 @@ function WorkspaceShell({
470489
);
471490
})}
472491
</View>
492+
<Pressable
493+
accessibilityRole="link"
494+
accessibilityLabel="Open the GitHub repository"
495+
onPress={() => void Linking.openURL(GITHUB_REPOSITORY_URL)}
496+
style={({ pressed }) => ({ opacity: pressed ? 0.6 : 1, paddingVertical: 5 })}
497+
>
498+
<View style={[s.row, { gap: 5, justifyContent: "center" }]}>
499+
<Github size={13} color={colors.muted} />
500+
<Text style={s.small}>GitHub repository</Text>
501+
</View>
502+
</Pressable>
473503
</View>
474504
</View>
475505
{!!toast && (

‎apps/mobile/src/render-links.ts‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
export const DEPLOY_TO_RENDER_URL =
2+
"https://render.com/deploy?repo=https%3A%2F%2Fgithub.com%2Fojusave%2Fopenmuse";
3+
4+
export const GITHUB_REPOSITORY_URL = "https://github.com/ojusave/openmuse";
5+
6+
/** Returns the single Render signup URL with attribution for its header placement. */
7+
export function renderSignupUrlWithUtms(content = "navbar_button"): string {
8+
const params = new URLSearchParams({
9+
utm_source: "github",
10+
utm_medium: "referral",
11+
utm_campaign: "ojus_demos",
12+
utm_content: content,
13+
});
14+
15+
return `https://dashboard.render.com/register?${params.toString()}`;
16+
}

‎apps/server/src/app.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { randomUUID } from "node:crypto";
2+
import { existsSync, readFileSync } from "node:fs";
23
import { MessageSchema } from "@ag-ui/core";
34
import { CopilotKitIntelligence } from "@copilotkit/runtime/v2";
5+
import { serveStatic } from "@hono/node-server/serve-static";
46
import { Hono } from "hono";
57
import { bodyLimit } from "hono/body-limit";
68
import { cors } from "hono/cors";
@@ -335,6 +337,12 @@ export async function createApp(
335337
);
336338
return new Response(body, { status: response.status, headers: response.headers });
337339
});
340+
const webRoot = "./apps/mobile/dist/web";
341+
if (existsSync(webRoot)) {
342+
app.use("/*", serveStatic({ root: webRoot }));
343+
const webIndex = readFileSync(`${webRoot}/index.html`, "utf8");
344+
app.get("*", (c) => (c.req.path.startsWith("/api/") ? c.notFound() : c.html(webIndex)));
345+
}
338346
app.get("/", (c) =>
339347
c.json({ name: "OpenMuse", app: "http://localhost:8081", health: "/api/health" }),
340348
);

‎apps/server/src/config.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ export function readConfig(): Config {
6262
if (mode === "live" && backend === "sample")
6363
throw new Error("Live workspaces cannot use the sample agent");
6464
const port = Number(process.env.PORT ?? 8787);
65-
const publicUrl = process.env.PUBLIC_API_URL ?? `http://localhost:${port}`;
65+
const publicUrl =
66+
process.env.PUBLIC_API_URL ?? process.env.RENDER_EXTERNAL_URL ?? `http://localhost:${port}`;
6667
const config: Config = {
6768
mode,
6869
port,

‎render.yaml‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
previews:
2+
generation: manual
3+
4+
services:
5+
- type: web
6+
name: openmuse
7+
runtime: node
8+
plan: starter
9+
buildCommand: >-
10+
corepack enable &&
11+
pnpm install --frozen-lockfile &&
12+
pnpm build:server &&
13+
pnpm build:web
14+
startCommand: pnpm start
15+
healthCheckPath: /api/health
16+
autoDeployTrigger: commit
17+
disk:
18+
name: openmuse-data
19+
mountPath: /var/data
20+
sizeGB: 1
21+
envVars:
22+
- key: WORKSPACE_MODE
23+
value: live
24+
- key: AGENT_BACKEND
25+
value: model
26+
- key: MODEL
27+
value: openai/gpt-4o-mini
28+
- key: HOST
29+
value: 0.0.0.0
30+
- key: DATA_DIR
31+
value: /var/data/openmuse
32+
- key: TASK_WORKER_ENABLED
33+
value: true
34+
- key: PUBLIC_API_URL
35+
fromService:
36+
name: openmuse
37+
type: web
38+
envVarKey: RENDER_EXTERNAL_URL
39+
- key: ALLOWED_ORIGINS
40+
fromService:
41+
name: openmuse
42+
type: web
43+
envVarKey: RENDER_EXTERNAL_URL
44+
- key: EXPO_PUBLIC_API_URL
45+
fromService:
46+
name: openmuse
47+
type: web
48+
envVarKey: RENDER_EXTERNAL_URL
49+
- key: OPENMUSE_ACCESS_KEY
50+
generateValue: true
51+
- key: TOKEN_ENCRYPTION_KEY
52+
generateValue: true
53+
- key: OPENAI_API_KEY
54+
sync: false
55+
- key: CPK_INTELLIGENCE_API_KEY
56+
sync: false

0 commit comments

Comments
 (0)