forked from bai/curriculum-project-hub
feat: add deployable alpha silo
This commit is contained in:
@@ -8,15 +8,21 @@ import {
|
||||
const VALID_ENV = {
|
||||
NODE_ENV: "production",
|
||||
DATABASE_URL: "postgresql://hub:secret@127.0.0.1:5432/hub",
|
||||
FEISHU_APP_ID: "cli_app_id",
|
||||
FEISHU_APP_SECRET: "feishu-app-secret",
|
||||
FEISHU_BOT_OPEN_ID: "ou_bot",
|
||||
HUB_SILO_ORGANIZATION_ID: "org_test",
|
||||
HUB_SYSTEMD_UNIT: "cph-hub-test.service",
|
||||
CPH_BIN: "/srv/curriculum-project-hub/current/bin/cph",
|
||||
HOST: "127.0.0.1",
|
||||
PORT: "8788",
|
||||
HUB_PROJECT_WORKSPACE_ROOT: "/var/lib/cph-hub/workspaces",
|
||||
HUB_PUBLIC_BASE_URL: "https://hub.example.com",
|
||||
HUB_SESSION_SECRET: "a-production-session-secret-with-32-bytes",
|
||||
HUB_AGENT_MAX_CONCURRENT_RUNS: "1",
|
||||
HUB_AGENT_MAX_RUN_SECONDS: "900",
|
||||
HUB_HTTP_BODY_LIMIT_BYTES: "1048576",
|
||||
HUB_MAX_FILES_PER_MESSAGE: "8",
|
||||
HUB_MAX_FILE_BYTES: "26214400",
|
||||
HUB_HTTP_REQUESTS_PER_MINUTE: "120",
|
||||
HUB_FEISHU_EVENTS_PER_MINUTE: "120",
|
||||
} as const;
|
||||
|
||||
function input(overrides: Partial<DeploymentPreflightInput> = {}): DeploymentPreflightInput {
|
||||
@@ -27,6 +33,7 @@ function input(overrides: Partial<DeploymentPreflightInput> = {}): DeploymentPre
|
||||
stateDir: "/var/lib/cph-hub/state",
|
||||
cacheDir: "/var/cache/cph-hub",
|
||||
workspaceRoot: "/var/lib/cph-hub/workspaces",
|
||||
expectedServiceUnit: "cph-hub-test.service",
|
||||
env: VALID_ENV,
|
||||
...overrides,
|
||||
};
|
||||
@@ -79,7 +86,7 @@ describe("validateDeploymentPreflight", () => {
|
||||
input({
|
||||
env: {
|
||||
...VALID_ENV,
|
||||
FEISHU_APP_SECRET: "",
|
||||
HUB_SILO_ORGANIZATION_ID: "",
|
||||
HUB_PUBLIC_BASE_URL: "http://hub.example.com",
|
||||
HUB_SESSION_SECRET: "short",
|
||||
},
|
||||
@@ -89,7 +96,7 @@ describe("validateDeploymentPreflight", () => {
|
||||
expect(error).toBeInstanceOf(DeploymentPreflightError);
|
||||
expect((error as Error).message).toMatchInlineSnapshot(`
|
||||
"deployment preflight failed:
|
||||
- FEISHU_APP_SECRET is required
|
||||
- HUB_SILO_ORGANIZATION_ID is required
|
||||
- HUB_PUBLIC_BASE_URL must use https
|
||||
- HUB_SESSION_SECRET must contain at least 32 characters"
|
||||
`);
|
||||
|
||||
Reference in New Issue
Block a user