Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

fix: route Docker auth over private alias (#692)

Joshua France813c387a9846
diff --git a/cli/package-lock.json b/cli/package-lock.json
index 9db291b19..038885f8b 100644
--- a/cli/package-lock.json
+++ b/cli/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@yc-software/qm",
- "version": "0.1.8",
+ "version": "0.1.9",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@yc-software/qm",
- "version": "0.1.8",
+ "version": "0.1.9",
"license": "MIT",
"bin": {
"qm": "dist/bin/qm.js"
diff --git a/cli/package.json b/cli/package.json
index 2bb3a343b..cf24c1d6e 100644
--- a/cli/package.json
+++ b/cli/package.json
@@ -1,6 +1,6 @@
{
"name": "@yc-software/qm",
- "version": "0.1.8",
+ "version": "0.1.9",
"license": "MIT",
"description": "Control-plane CLI for portable QM deployments on Docker, Fly, and AWS.",
"type": "module",
diff --git a/cli/src/backends/docker.ts b/cli/src/backends/docker.ts
index f8bec67b1..511b03c76 100644
--- a/cli/src/backends/docker.ts
+++ b/cli/src/backends/docker.ts
@@ -366,7 +366,7 @@ export function dockerServiceEnv(config: QmConfig, service: ServiceName): Record
out,
brokerWiring(service, {
publicUrl: config.publicUrl,
- authBaseUrl: "http://auth:8080",
+ authBaseUrl: `http://${dockerPrefix(config)}-auth.internal:8080`,
...(config.env.auth?.AUTH_ALLOWED_EMAIL_DOMAIN
? { allowedEmailDomain: config.env.auth.AUTH_ALLOWED_EMAIL_DOMAIN }
: {}),
@@ -477,6 +477,8 @@ function runArgs(ctx: DockerCtx, service: ServiceName, image: string): { args: s
ctx.network,
"--network-alias",
service,
+ "--network-alias",
+ `${cname(ctx, service)}.internal`,
"--restart",
"no",
];
diff --git a/cli/test/auth-broker.test.ts b/cli/test/auth-broker.test.ts
index 843c08629..45028eb06 100644
--- a/cli/test/auth-broker.test.ts
+++ b/cli/test/auth-broker.test.ts
@@ -97,8 +97,8 @@ test("a configured botName brands the docker service env for core and auth", ()
test("docker and AWS wire the broker with parity", () => {
const docker = configWith(configText());
const dockerPortal = dockerServiceEnv(docker, "portal");
- assert.equal(dockerPortal.AUTH_BROKER_UPSTREAM, "http://auth:8080");
- assert.equal(dockerPortal.OIDC_TOKEN_ENDPOINT, "http://auth:8080/token");
+ assert.equal(dockerPortal.AUTH_BROKER_UPSTREAM, "http://qm-acme-auth.internal:8080");
+ assert.equal(dockerPortal.OIDC_TOKEN_ENDPOINT, "http://qm-acme-auth.internal:8080/token");
assert.equal(dockerPortal.OIDC_ISSUER, "https://agent.example.com/idp");
assert.equal(dockerServiceEnv(docker, "auth").AUTH_REDIRECT_URI, "https://agent.example.com/auth/callback");
assert.equal(dockerServiceEnv(docker, "web-ui").AUTH_BROKER_UPSTREAM, undefined);
diff --git a/cli/test/e2e/docker-lifecycle.e2e.test.ts b/cli/test/e2e/docker-lifecycle.e2e.test.ts
index c01b8036b..01b94aa11 100644
--- a/cli/test/e2e/docker-lifecycle.e2e.test.ts
+++ b/cli/test/e2e/docker-lifecycle.e2e.test.ts
@@ -99,6 +99,20 @@ test(
assert.ok(!inspect(portal).Mounts.some((mount) => mount.Destination === "/var/run/docker.sock"));
});
+ await t.test("services receive their private-network aliases", () => {
+ const portal = suffix(deploymentContainers(org), "portal")!;
+ const aliases = JSON.parse(
+ execFileSync(
+ "docker",
+ ["inspect", "-f", `{{json (index .NetworkSettings.Networks "qm-${org}").Aliases}}`, portal],
+ {
+ encoding: "utf8",
+ },
+ ),
+ ) as string[];
+ assert.ok(aliases.includes(`qm-${org}-portal.internal`), aliases.join(", "));
+ });
+
await t.test("computed secrets from the deployment ./.env reach the core container", () => {
const core = suffix(deploymentContainers(org), "core")!;
const got = execFileSync("docker", ["exec", core, "printenv", "CORE_SIGNING_SECRET"], {