Skip to content

armgit / mso

Public Imported from GitHub
0

Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.

fix(dokploy): sync public Docker build args

Rahmanfc43d2acc134
diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json
index 6945361d..33b89ed8 100644
--- a/.codex-plugin/plugin.json
+++ b/.codex-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "mso",
- "version": "0.2.22",
+ "version": "0.2.23",
"description": "Operate MSO projects, workflows, VPS resources, integrations, deployments, and MCP capabilities through reusable safety-first skills.",
"author": {
"name": "MSO"
diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md
index c92d66f6..5e65a952 100644
--- a/docs/PROGRESS.md
+++ b/docs/PROGRESS.md
@@ -1,3 +1,9 @@
+## 2026-09-23 — Bind public Dokploy build env to Docker build args
+
+The bounded Dokploy public-build environment operation now writes each approved public key to both the application runtime env and Docker build args before queueing one redeploy. This closes the staging gap where a value such as NEXT_PUBLIC_CONVEX_URL existed at runtime but Docker ARG still received an empty value during image build. Secret/server keys remain rejected, existing build secrets and unrelated build args are preserved, and an already-synchronized key is idempotent without another deploy.
+
+A credential-isolated regression verifies runtime env, build args, preservation of neighboring settings, single redeploy, idempotent reread, and no public value reflection in the operation result.
+
## 2026-09-23 — Isolate Termux installations inside Ubuntu PRoot
The Termux adapter now starts installation and the generated CLI launcher with a fresh guest environment, explicit Linux-only PATH and non-root owner. It rejects an Android Node/Bun runtime accidentally visible inside the guest, retains the legacy native launcher target while replacing its symlink, and supports bounded build workers, Node heap, resumable installs and a private persistent install log for low-memory tablets. Shell tests exercise the exact guest argv boundary, hostile inherited environment, argument forwarding and failed guest-runtime probes without installing packages. The launcher test reads its generated file directly instead of first checking filesystem metadata, avoiding a check/read race flagged by CodeQL.
diff --git a/lib/infra/connection-dispatch.ts b/lib/infra/connection-dispatch.ts
index 79fe8e40..7aad1b77 100644
--- a/lib/infra/connection-dispatch.ts
+++ b/lib/infra/connection-dispatch.ts
@@ -26,7 +26,7 @@ export async function executeIntegrationAction(raw:Record<string,unknown>){
if(operation==="dokploy.application.publicEnv.upsert"){
const {arguments:operationArgs,...meta}=a;metadataOnly(meta);
const args=operationArgs;if(!args||typeof args!=="object"||Array.isArray(args))throw new IntegrationError("invalid_tool_arguments");
- if(Object.keys(args).some(k=>!["applicationId","key","value"].includes(k)))throw new IntegrationError("invalid_tool_arguments");
+ if(Object.keys(args).some(k=>!["applicationId","key","value","redeploy"].includes(k)))throw new IntegrationError("invalid_tool_arguments");
}else metadataOnly(a);
if(Object.keys(a).some(k=>!["user","provider","connection","operation","arguments","tool","confirm"].includes(k)))throw new IntegrationError("invalid_execution_fields");
const user=identity(a.user,"user"),provider=identity(a.provider,"provider"),connection=identity(a.connection,"connection"),selection={user,connection};
@@ -48,7 +48,7 @@ export async function executeIntegrationAction(raw:Record<string,unknown>){
"dokploy.git.recover":{provider:"dokploy",fields:["applicationId"],run:()=>recoverDokployPublicGithubToHttpsGit(String((args as Record<string,unknown>).applicationId))},
"dokploy.application.deploy":{provider:"dokploy",fields:["applicationId"],run:()=>deployDokployApplication(String((args as Record<string,unknown>).applicationId))},
"dokploy.dockerfile":{provider:"dokploy",fields:["applicationId","dockerfile","dockerContextPath"],run:()=>configureDokployDockerfileBuild(args as {applicationId:string;dockerfile?:string;dockerContextPath?:string})},
- "dokploy.application.publicEnv.upsert":{provider:"dokploy",fields:["applicationId","key","value"],run:()=>upsertDokployPublicBuildEnv(args as {applicationId:string;key:string;value:string})},
+ "dokploy.application.publicEnv.upsert":{provider:"dokploy",fields:["applicationId","key","value","redeploy"],run:()=>upsertDokployPublicBuildEnv(args as {applicationId:string;key:string;value:string;redeploy?:boolean})},
"dokploy.project.ensure":{provider:"dokploy",fields:["name"],run:()=>ensureDokployProject(String((args as Record<string,unknown>).name))},
"convex.customDomains.list":{provider:"convex-cloud",fields:["deploymentName"],run:()=>listConvexCustomDomains(String((args as Record<string,unknown>).deploymentName))},
"convex.customDomain.ensure":{provider:"convex-cloud",fields:["deploymentName","domain","requestDestination"],run:()=>ensureConvexCustomDomain(args as {deploymentName:string;domain:string;requestDestination:"convexCloud"|"convexSite"})},
diff --git a/lib/infra/connection-model.test.ts b/lib/infra/connection-model.test.ts
index ad050464..db98be49 100644
--- a/lib/infra/connection-model.test.ts
+++ b/lib/infra/connection-model.test.ts
@@ -65,20 +65,26 @@ describe("native credential identity core",()=>{
await Promise.all([f.withIntegrationSelection({user:"alice",connection:"work"},()=>listDokployProjects()),f.withIntegrationSelection({user:"bob",connection:"work"},()=>listDokployProjects())]);
expect(calls).toContainEqual({url:"http://127.0.0.1:4123/api/project.all",key:KEY_A});expect(calls).toContainEqual({url:"http://127.0.0.1:4124/api/project.all",key:KEY_B});
});
- it("updates one Dokploy public build env privately, preserves build settings, and redeploys once",async()=>{
+ it("updates one Dokploy public build env in runtime env and Docker build args, then redeploys once",async()=>{
const f=await fixture();await f.add("alice","dokploy","work","direct",{apiUrl:"http://127.0.0.1:4123",apiKey:KEY_A});
- let env="PRIVATE_TOKEN=synthetic-private\nNEXT_PUBLIC_CONVEX_URL=https://old.example\n";let deploys=0;
+ let env="PRIVATE_TOKEN=synthetic-private\nNEXT_PUBLIC_CONVEX_URL=https://old.example\n",buildArgs="BUILD=1\n",deploys=0;
vi.stubGlobal("fetch",vi.fn(async(input:RequestInfo|URL,init?:RequestInit)=>{
const req=new Request(input,init),url=new URL(req.url);
- if(url.pathname.endsWith("/application.one"))return new Response(JSON.stringify({applicationId:"application_123",env,buildArgs:"BUILD=1",buildSecrets:"SYNTHETIC_BUILD_SECRET",createEnvFile:true}),{status:200});
- if(url.pathname.endsWith("/application.saveEnvironment")){const body=JSON.parse(await req.text());expect(body).toMatchObject({applicationId:"application_123",buildArgs:"BUILD=1",buildSecrets:"SYNTHETIC_BUILD_SECRET",createEnvFile:true});env=body.env;return new Response("{}",{status:200});}
+ if(url.pathname.endsWith("/application.one"))return new Response(JSON.stringify({applicationId:"application_123",env,buildArgs,buildSecrets:"SYNTHETIC_BUILD_SECRET",createEnvFile:true}),{status:200});
+ if(url.pathname.endsWith("/application.saveEnvironment")){const body=JSON.parse(await req.text());expect(body).toMatchObject({applicationId:"application_123",buildSecrets:"SYNTHETIC_BUILD_SECRET",createEnvFile:true});env=body.env;buildArgs=body.buildArgs;return new Response("{}",{status:200});}
if(url.pathname.endsWith("/application.deploy")){deploys+=1;return new Response("{}",{status:200});}
return new Response("not found",{status:404});
}));
const {upsertDokployPublicBuildEnv}=await import("./dokploy");
- const result=await f.withIntegrationSelection({user:"alice",connection:"work"},()=>upsertDokployPublicBuildEnv({applicationId:"application_123",key:"NEXT_PUBLIC_CONVEX_URL",value:"https://api.example.com"}));
+ const call=()=>f.withIntegrationSelection({user:"alice",connection:"work"},()=>upsertDokployPublicBuildEnv({applicationId:"application_123",key:"NEXT_PUBLIC_CONVEX_URL",value:"https://api.example.com"}));
+ const result=await call();
expect(result).toEqual({applicationId:"application_123",key:"NEXT_PUBLIC_CONVEX_URL",changed:true,redeployQueued:true});expect(deploys).toBe(1);
- expect(env).toContain("PRIVATE_TOKEN=synthetic-private");expect(env).toContain("NEXT_PUBLIC_CONVEX_URL=https://api.example.com");expect(JSON.stringify(result)).not.toContain("api.example.com");
+ expect(env).toContain("PRIVATE_TOKEN=synthetic-private");expect(env).toContain("NEXT_PUBLIC_CONVEX_URL=https://api.example.com");
+ expect(buildArgs).toBe("BUILD=1\nNEXT_PUBLIC_CONVEX_URL=https://api.example.com\n");expect(JSON.stringify(result)).not.toContain("api.example.com");
+ await expect(call()).resolves.toEqual({applicationId:"application_123",key:"NEXT_PUBLIC_CONVEX_URL",changed:false,redeployQueued:false});expect(deploys).toBe(1);
+ const deferred=await f.withIntegrationSelection({user:"alice",connection:"work"},()=>upsertDokployPublicBuildEnv({applicationId:"application_123",key:"NEXT_PUBLIC_CONVEX_SITE_URL",value:"https://site.example.com",redeploy:false}));
+ expect(deferred).toEqual({applicationId:"application_123",key:"NEXT_PUBLIC_CONVEX_SITE_URL",changed:true,redeployQueued:false});expect(deploys).toBe(1);
+ expect(env).toContain("NEXT_PUBLIC_CONVEX_SITE_URL=https://site.example.com");expect(buildArgs).toContain("NEXT_PUBLIC_CONVEX_SITE_URL=https://site.example.com");
});
it("pins credentials for the duration of a compound operation and never changes defaults",async()=>{
const f=await fixture();await f.add("alice","github","work","direct",{apiKey:KEY_A});
diff --git a/lib/infra/dokploy.ts b/lib/infra/dokploy.ts
index e41bc403..5e64b6ae 100644
--- a/lib/infra/dokploy.ts
+++ b/lib/infra/dokploy.ts
@@ -147,22 +147,27 @@ export async function upsertDokployPublicBuildEnv(args: {
applicationId: string;
key: string;
value: string;
+ redeploy?: boolean;
}): Promise<{ applicationId: string; key: string; changed: boolean; redeployQueued: boolean }> {
const applicationId = dokployId(args.applicationId, "application id");
const before = await readDokployApplication(applicationId);
const sourceEnv = typeof before.env === "string" ? before.env : "";
- const next = upsertPublicEnvText(sourceEnv, args.key, args.value);
- if (!next.changed) return { applicationId, key: args.key, changed: false, redeployQueued: false };
+ const sourceBuildArgs = typeof before.buildArgs === "string" ? before.buildArgs : "";
+ const nextEnv = upsertPublicEnvText(sourceEnv, args.key, args.value);
+ const nextBuildArgs = upsertPublicEnvText(sourceBuildArgs, args.key, args.value);
+ if (!nextEnv.changed && !nextBuildArgs.changed) return { applicationId, key: args.key, changed: false, redeployQueued: false };
await call("/application.saveEnvironment", "POST", {
applicationId,
- env: next.env,
- buildArgs: typeof before.buildArgs === "string" ? before.buildArgs : null,
+ env: nextEnv.env,
+ buildArgs: nextBuildArgs.env,
buildSecrets: typeof before.buildSecrets === "string" ? before.buildSecrets : null,
createEnvFile: before.createEnvFile === true,
});
const after = await readDokployApplication(applicationId);
- const verified = upsertPublicEnvText(typeof after.env === "string" ? after.env : "", args.key, args.value);
- if (verified.changed) throw new Error("Dokploy environment update could not be verified");
+ const verifiedEnv = upsertPublicEnvText(typeof after.env === "string" ? after.env : "", args.key, args.value);
+ const verifiedBuildArgs = upsertPublicEnvText(typeof after.buildArgs === "string" ? after.buildArgs : "", args.key, args.value);
+ if (verifiedEnv.changed || verifiedBuildArgs.changed) throw new Error("Dokploy public build environment update could not be verified");
+ if (args.redeploy === false) return { applicationId, key: args.key, changed: true, redeployQueued: false };
await call("/application.deploy", "POST", { applicationId });
return { applicationId, key: args.key, changed: true, redeployQueued: true };
}
diff --git a/package.json b/package.json
index 0f4f2514..e8ad5f54 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "mso",
- "version": "0.2.22",
+ "version": "0.2.23",
"private": true,
"engines": {
"node": "^22.12.0 || ^24.0.0 || >=26.0.0",