updates source code (src) (3 files)
This commit is contained in:
@@ -66,7 +66,7 @@ export const config = {
|
|||||||
|
|
||||||
// ── Shared OpenCode runtime image (built once, changes.md §3) ──
|
// ── Shared OpenCode runtime image (built once, changes.md §3) ──
|
||||||
opencodeImage:
|
opencodeImage:
|
||||||
process.env.OPENCODE_IMAGE ?? "ghcr.io/anomalyco/opencode:latest",
|
process.env.OPENCODE_IMAGE ?? "growqr/opencode:dev",
|
||||||
// Version tracking for rollout (changes.md §9)
|
// Version tracking for rollout (changes.md §9)
|
||||||
opencodeImageVersion: process.env.OPENCODE_IMAGE_VERSION ?? "1.0.0",
|
opencodeImageVersion: process.env.OPENCODE_IMAGE_VERSION ?? "1.0.0",
|
||||||
migrationVersion: process.env.MIGRATION_VERSION ?? "1",
|
migrationVersion: process.env.MIGRATION_VERSION ?? "1",
|
||||||
|
|||||||
@@ -261,12 +261,15 @@ async function startOpencodeContainer(opts: {
|
|||||||
const container = await docker.createContainer({
|
const container = await docker.createContainer({
|
||||||
name,
|
name,
|
||||||
Image: config.opencodeImage,
|
Image: config.opencodeImage,
|
||||||
Cmd: ["serve", "--port", "4096", "--hostname", "0.0.0.0"],
|
Cmd: ["opencode", "serve", "--port", "4096", "--hostname", "0.0.0.0"],
|
||||||
Env: [
|
Env: [
|
||||||
`OPENCODE_SERVER_PASSWORD=${opts.password}`,
|
`OPENCODE_SERVER_PASSWORD=${opts.password}`,
|
||||||
`OPENCODE_WORKSPACE=/workspace`,
|
`OPENCODE_WORKSPACE=/workspace`,
|
||||||
`GROWQR_IMAGE_VERSION=${config.opencodeImageVersion}`,
|
`GROWQR_IMAGE_VERSION=${config.opencodeImageVersion}`,
|
||||||
`GROWQR_PROMPT_VERSION=${config.promptVersion}`,
|
`GROWQR_PROMPT_VERSION=${config.promptVersion}`,
|
||||||
|
`GROWQR_MIGRATION_VERSION=${config.migrationVersion}`,
|
||||||
|
`GROWQR_USER_ID=${opts.userId}`,
|
||||||
|
`GROWQR_GITEA_URL=${config.giteaUrl}`,
|
||||||
],
|
],
|
||||||
WorkingDir: "/workspace",
|
WorkingDir: "/workspace",
|
||||||
HostConfig: {
|
HostConfig: {
|
||||||
|
|||||||
11
src/index.ts
11
src/index.ts
@@ -78,15 +78,16 @@ async function main() {
|
|||||||
app.route("/git", gitRoutes());
|
app.route("/git", gitRoutes());
|
||||||
app.route("/api/chat", chatRoutes());
|
app.route("/api/chat", chatRoutes());
|
||||||
|
|
||||||
if (process.env.RIVET_RUN_ENGINE === "1") {
|
if (process.env.RIVET_ENDPOINT) {
|
||||||
// Self-hosted: embedded engine runs at localhost:6420.
|
// Self-hosted: embedded engine runs at localhost:6420.
|
||||||
// Proxy frontend Rivet traffic to the engine instead of using registry.handler()
|
// Proxy frontend Rivet traffic to the engine instead of using registry.handler()
|
||||||
// (handler conflicts with startRunner — they're mutually exclusive).
|
// (handler conflicts with startRunner — they're mutually exclusive).
|
||||||
delete process.env.RIVET_ENDPOINT;
|
|
||||||
app.all("/api/rivet/*", async (c) => {
|
app.all("/api/rivet/*", async (c) => {
|
||||||
const url = new URL(c.req.url);
|
const url = new URL(c.req.url);
|
||||||
url.hostname = "127.0.0.1";
|
const target = new URL(config.rivetEndpoint);
|
||||||
url.port = "6420";
|
url.protocol = target.protocol;
|
||||||
|
url.hostname = target.hostname;
|
||||||
|
url.port = target.port;
|
||||||
url.pathname = url.pathname.replace("/api/rivet", "");
|
url.pathname = url.pathname.replace("/api/rivet", "");
|
||||||
|
|
||||||
// Forward headers, stripping hop-by-hop ones
|
// Forward headers, stripping hop-by-hop ones
|
||||||
@@ -96,7 +97,7 @@ async function main() {
|
|||||||
if (k.toLowerCase() === "transfer-encoding") continue;
|
if (k.toLowerCase() === "transfer-encoding") continue;
|
||||||
fwdHeaders.set(k, v);
|
fwdHeaders.set(k, v);
|
||||||
}
|
}
|
||||||
fwdHeaders.set("Host", "127.0.0.1:6420");
|
fwdHeaders.set("Host", target.host);
|
||||||
|
|
||||||
// For POST/PUT/PATCH, clone the body stream (Hono may have consumed it)
|
// For POST/PUT/PATCH, clone the body stream (Hono may have consumed it)
|
||||||
const method = c.req.method.toUpperCase();
|
const method = c.req.method.toUpperCase();
|
||||||
|
|||||||
Reference in New Issue
Block a user