mirror of
https://github.com/aphrody-labs/bun-distribution.git
synced 2026-10-14 07:59:17 +00:00
Resolve application domains from the capability owner
This commit is contained in:
1 parent
8cc849a494
commit
8b2a148bd6
3 files changed
+21
-16
No files matched your search
@@ -9,6 +9,8 @@
|
||||
- [x] Route distribution commands and Ubuntu factory jobs through the shared
|
||||
Bun Libraries process owner, including deadlines, process trees and logs.
|
||||
- [x] Route distribution and Ubuntu artifact hashing through the shared hash owner.
|
||||
- [x] Make Bun Libraries the hostname owner for the 14 library applications;
|
||||
retain each bare library domain as an alias and keep DNS records in place.
|
||||
- [ ] Identify any remaining provider relaunchers and remove the empty locked
|
||||
former directory once its holder releases it.
|
||||
- [ ] Physically relocate Bun after its concurrent exclusive Git batch ends;
|
||||
|
||||
+19
-2
@@ -3,6 +3,8 @@ import { lstat, mkdir, open, realpath, unlink } from "node:fs/promises";
|
||||
import { basename, dirname, join, resolve } from "node:path";
|
||||
import { hostname } from "node:os";
|
||||
import { isBuiltin } from "node:module";
|
||||
import { appHostnamesForLibrary } from "@aphrody/bun-workspace/capabilities";
|
||||
import { loadConfig as loadLibraryConfig } from "@aphrody/bun-workspace";
|
||||
import { command, identity, packageRoot, type RuntimeReceipt } from "../src/distribution.ts";
|
||||
import { inspectLinuxABI } from "../src/elf.ts";
|
||||
import { abi } from "../packages/package-converter/src/abi.ts";
|
||||
@@ -44,7 +46,8 @@ export interface NativeArtifact extends NativeDependency {
|
||||
export interface AppEntry {
|
||||
id: string;
|
||||
kind: "native-cli" | "bun-cli" | "bun-server";
|
||||
hostname: string;
|
||||
hostname?: string;
|
||||
hostnames?: string[];
|
||||
workspace: string;
|
||||
entrypoint: string;
|
||||
entrypointWorkspace?: string;
|
||||
@@ -79,6 +82,7 @@ export interface AppPlan {
|
||||
configPath: string;
|
||||
configSHA256: string;
|
||||
app: AppEntry;
|
||||
hostnames: string[];
|
||||
target: AppTarget;
|
||||
cwd: string;
|
||||
entrypoint: string;
|
||||
@@ -279,6 +283,18 @@ export async function planApp(configPath: string, appId: string, target: AppTarg
|
||||
const app = config.apps.find(app => app.id === appId);
|
||||
if (!app || !config.targets.includes(target)) throw new Error("Unknown app or target");
|
||||
const root = await workspace(configPath, config, app.entrypointWorkspace ?? app.workspace);
|
||||
let resolvedHostnames: string[];
|
||||
if (app.workspace === "libraries" && app.kind === "native-cli") {
|
||||
const libraryRoot = await workspace(configPath, config, "libraries");
|
||||
const libraryConfig = await loadLibraryConfig(libraryRoot);
|
||||
resolvedHostnames = appHostnamesForLibrary(app.id, libraryConfig);
|
||||
if (app.hostname && !resolvedHostnames.includes(app.hostname))
|
||||
throw new Error("Configured application hostname differs from the library owner");
|
||||
} else {
|
||||
if (!app.hostname) throw new Error("A hostname is required for non-library applications");
|
||||
resolvedHostnames = [app.hostname];
|
||||
}
|
||||
const resolvedApp = { ...app, hostname: resolvedHostnames[0]!, hostnames: resolvedHostnames };
|
||||
let entrypoint = inside(root, resolve(root, app.entrypoint));
|
||||
const reasons: string[] = [];
|
||||
if (!(await Bun.file(entrypoint).exists())) reasons.push("Configured entrypoint is absent");
|
||||
@@ -308,7 +324,8 @@ export async function planApp(configPath: string, appId: string, target: AppTarg
|
||||
kind: "app-build-plan",
|
||||
configPath,
|
||||
configSHA256: (await identity(configPath)).sha256,
|
||||
app,
|
||||
app: resolvedApp,
|
||||
hostnames: resolvedHostnames,
|
||||
target,
|
||||
cwd: root,
|
||||
entrypoint,
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
"apps": [
|
||||
{
|
||||
"id": "filmcraft",
|
||||
"hostname": "filmcraft.aphrody.app",
|
||||
"kind": "native-cli",
|
||||
"workspace": "libraries",
|
||||
"entrypoint": "infra/native-app.ts",
|
||||
@@ -53,7 +52,6 @@
|
||||
},
|
||||
{
|
||||
"id": "artcraft",
|
||||
"hostname": "artcraft.aphrody.app",
|
||||
"kind": "native-cli",
|
||||
"workspace": "libraries",
|
||||
"entrypoint": "infra/native-app.ts",
|
||||
@@ -79,7 +77,6 @@
|
||||
},
|
||||
{
|
||||
"id": "photocraft",
|
||||
"hostname": "photocraft.aphrody.app",
|
||||
"kind": "native-cli",
|
||||
"workspace": "libraries",
|
||||
"entrypoint": "infra/native-app.ts",
|
||||
@@ -105,7 +102,6 @@
|
||||
},
|
||||
{
|
||||
"id": "vectorcraft",
|
||||
"hostname": "vectorcraft.aphrody.app",
|
||||
"kind": "native-cli",
|
||||
"workspace": "libraries",
|
||||
"entrypoint": "infra/native-app.ts",
|
||||
@@ -131,7 +127,6 @@
|
||||
},
|
||||
{
|
||||
"id": "effectcraft",
|
||||
"hostname": "effectcraft.aphrody.app",
|
||||
"kind": "native-cli",
|
||||
"workspace": "libraries",
|
||||
"entrypoint": "infra/native-app.ts",
|
||||
@@ -157,7 +152,6 @@
|
||||
},
|
||||
{
|
||||
"id": "lightcraft",
|
||||
"hostname": "lightcraft.aphrody.app",
|
||||
"kind": "native-cli",
|
||||
"workspace": "libraries",
|
||||
"entrypoint": "infra/native-app.ts",
|
||||
@@ -183,7 +177,6 @@
|
||||
},
|
||||
{
|
||||
"id": "pdfcraft",
|
||||
"hostname": "pdfcraft.aphrody.app",
|
||||
"kind": "native-cli",
|
||||
"workspace": "libraries",
|
||||
"entrypoint": "infra/native-app.ts",
|
||||
@@ -209,7 +202,6 @@
|
||||
},
|
||||
{
|
||||
"id": "wordcraft",
|
||||
"hostname": "wordcraft.aphrody.app",
|
||||
"kind": "native-cli",
|
||||
"workspace": "libraries",
|
||||
"entrypoint": "infra/native-app.ts",
|
||||
@@ -235,7 +227,6 @@
|
||||
},
|
||||
{
|
||||
"id": "soundcraft",
|
||||
"hostname": "soundcraft.aphrody.app",
|
||||
"kind": "native-cli",
|
||||
"workspace": "libraries",
|
||||
"entrypoint": "infra/native-app.ts",
|
||||
@@ -261,7 +252,6 @@
|
||||
},
|
||||
{
|
||||
"id": "designcraft",
|
||||
"hostname": "designcraft.aphrody.app",
|
||||
"kind": "native-cli",
|
||||
"workspace": "libraries",
|
||||
"entrypoint": "infra/native-app.ts",
|
||||
@@ -287,7 +277,6 @@
|
||||
},
|
||||
{
|
||||
"id": "cadcraft",
|
||||
"hostname": "cadcraft.aphrody.app",
|
||||
"kind": "native-cli",
|
||||
"workspace": "libraries",
|
||||
"entrypoint": "infra/native-app.ts",
|
||||
@@ -313,7 +302,6 @@
|
||||
},
|
||||
{
|
||||
"id": "deckcraft",
|
||||
"hostname": "deckcraft.aphrody.app",
|
||||
"kind": "native-cli",
|
||||
"workspace": "libraries",
|
||||
"entrypoint": "infra/native-app.ts",
|
||||
@@ -339,7 +327,6 @@
|
||||
},
|
||||
{
|
||||
"id": "gridcraft",
|
||||
"hostname": "gridcraft.aphrody.app",
|
||||
"kind": "native-cli",
|
||||
"workspace": "libraries",
|
||||
"entrypoint": "infra/native-app.ts",
|
||||
@@ -365,7 +352,6 @@
|
||||
},
|
||||
{
|
||||
"id": "figcraft",
|
||||
"hostname": "figcraft.aphrody.app",
|
||||
"kind": "native-cli",
|
||||
"workspace": "libraries",
|
||||
"entrypoint": "infra/native-app.ts",
|
||||
|
||||
Reference in new issue
Block a user