Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
@@ -25,25 +25,25 @@ ADD prisma prisma
|
||||
COPY apps/api/package.json apps/api/package.json
|
||||
COPY apps/web/package.json apps/web/package.json
|
||||
COPY apps/worker/package.json apps/worker/package.json
|
||||
RUN --mount=type=cache,id=toolctrl-pnpm-store,target=/pnpm/store \\
|
||||
RUN --mount=type=cache,id=hivegrid-pnpm-store,target=/pnpm/store \\
|
||||
pnpm fetch --frozen-lockfile
|
||||
RUN --mount=type=cache,id=toolctrl-pnpm-store,target=/pnpm/store \\
|
||||
RUN --mount=type=cache,id=hivegrid-pnpm-store,target=/pnpm/store \\
|
||||
pnpm install --frozen-lockfile --prod=false --offline
|
||||
FROM base AS production-deps
|
||||
WORKDIR /myapp
|
||||
COPY --from=deps /myapp /myapp
|
||||
RUN pnpm prune --prod
|
||||
FROM base AS build
|
||||
RUN pnpm --filter @toolctrl/db prisma:generate
|
||||
RUN pnpm --filter @toolctrl/db build
|
||||
RUN pnpm --filter @hivegrid/db prisma:generate
|
||||
RUN pnpm --filter @hivegrid/db build
|
||||
FROM build AS web-build
|
||||
ARG VITE_SENTRY_DSN_WEB=""
|
||||
ENV VITE_SENTRY_DSN_WEB="\${VITE_SENTRY_DSN_WEB}"
|
||||
RUN pnpm --filter @toolctrl/web build
|
||||
RUN pnpm --filter @hivegrid/web build
|
||||
FROM build AS api-build
|
||||
RUN pnpm --filter @toolctrl/api build
|
||||
RUN pnpm --filter @hivegrid/api build
|
||||
FROM build AS worker-build
|
||||
RUN pnpm --filter @toolctrl/worker build
|
||||
RUN pnpm --filter @hivegrid/worker build
|
||||
FROM web-build AS web-runtime-artifacts
|
||||
RUN find /myapp/build /myapp/apps/web/build -type f -name '*.map' -delete
|
||||
FROM api-build AS api-runtime-artifacts
|
||||
@@ -92,6 +92,7 @@ EXPOSE 8080
|
||||
COPY --from=web-runtime-artifacts /myapp/build /myapp/build
|
||||
COPY --from=web-runtime-artifacts /myapp/build/server-runtime /myapp/build/server-runtime
|
||||
COPY --from=build /myapp/prisma.config.ts /myapp/prisma.config.ts
|
||||
COPY --from=build /myapp/packages/billing /myapp/packages/billing
|
||||
COPY --from=build /myapp/packages/db /myapp/packages/db
|
||||
COPY --from=build /myapp/packages/storage /myapp/packages/storage
|
||||
COPY --from=deps /myapp/packages/storage/node_modules /myapp/packages/storage/node_modules
|
||||
@@ -188,8 +189,8 @@ const VALID_DOCKER_COMPOSE_STAGING = `# docker compose -f docker-compose.yml -f
|
||||
services:
|
||||
worker-general:
|
||||
environment:
|
||||
- DATABASE_URL=postgres://boilerplate:boilerplate@pgbouncer:6432/boilerplate_validation?pgbouncer=true
|
||||
- DIRECT_URL=postgres://boilerplate:boilerplate@postgres:5432/boilerplate_validation
|
||||
- DATABASE_URL=postgres://hivegrid:hivegrid@pgbouncer:6432/hivegrid_validation?pgbouncer=true
|
||||
- DIRECT_URL=postgres://hivegrid:hivegrid@postgres:5432/hivegrid_validation
|
||||
- OUTBOX_DISPATCHER_ENABLED=true
|
||||
- OUTBOX_DISPATCHER_REQUIRED=true
|
||||
- WORKFLOW_TRIGGER_OUTBOX_ENABLED=true
|
||||
@@ -199,29 +200,29 @@ services:
|
||||
condition: service_healthy
|
||||
worker-mail:
|
||||
environment:
|
||||
- DATABASE_URL=postgres://boilerplate:boilerplate@pgbouncer:6432/boilerplate_validation?pgbouncer=true
|
||||
- DIRECT_URL=postgres://boilerplate:boilerplate@postgres:5432/boilerplate_validation
|
||||
- DATABASE_URL=postgres://hivegrid:hivegrid@pgbouncer:6432/hivegrid_validation?pgbouncer=true
|
||||
- DIRECT_URL=postgres://hivegrid:hivegrid@postgres:5432/hivegrid_validation
|
||||
depends_on:
|
||||
pgbouncer:
|
||||
condition: service_healthy
|
||||
worker-import:
|
||||
environment:
|
||||
- DATABASE_URL=postgres://boilerplate:boilerplate@pgbouncer:6432/boilerplate_validation?pgbouncer=true
|
||||
- DIRECT_URL=postgres://boilerplate:boilerplate@postgres:5432/boilerplate_validation
|
||||
- DATABASE_URL=postgres://hivegrid:hivegrid@pgbouncer:6432/hivegrid_validation?pgbouncer=true
|
||||
- DIRECT_URL=postgres://hivegrid:hivegrid@postgres:5432/hivegrid_validation
|
||||
depends_on:
|
||||
pgbouncer:
|
||||
condition: service_healthy
|
||||
worker-webhook:
|
||||
environment:
|
||||
- DATABASE_URL=postgres://boilerplate:boilerplate@pgbouncer:6432/boilerplate_validation?pgbouncer=true
|
||||
- DIRECT_URL=postgres://boilerplate:boilerplate@postgres:5432/boilerplate_validation
|
||||
- DATABASE_URL=postgres://hivegrid:hivegrid@pgbouncer:6432/hivegrid_validation?pgbouncer=true
|
||||
- DIRECT_URL=postgres://hivegrid:hivegrid@postgres:5432/hivegrid_validation
|
||||
depends_on:
|
||||
pgbouncer:
|
||||
condition: service_healthy
|
||||
worker-plugin:
|
||||
environment:
|
||||
- DATABASE_URL=postgres://boilerplate:boilerplate@pgbouncer:6432/boilerplate_validation?pgbouncer=true
|
||||
- DIRECT_URL=postgres://boilerplate:boilerplate@postgres:5432/boilerplate_validation
|
||||
- DATABASE_URL=postgres://hivegrid:hivegrid@pgbouncer:6432/hivegrid_validation?pgbouncer=true
|
||||
- DIRECT_URL=postgres://hivegrid:hivegrid@postgres:5432/hivegrid_validation
|
||||
depends_on:
|
||||
pgbouncer:
|
||||
condition: service_healthy
|
||||
@@ -279,7 +280,28 @@ function createFixture(overrides = {}) {
|
||||
"",
|
||||
].join("\n"),
|
||||
);
|
||||
writeFile(rootDir, "start.sh", overrides.startScript ?? "#!/bin/sh\nexec node build/server-runtime/server.js\n");
|
||||
writeFile(
|
||||
rootDir,
|
||||
"start.sh",
|
||||
overrides.startScript ??
|
||||
[
|
||||
"#!/bin/sh",
|
||||
"set -e",
|
||||
"",
|
||||
'if [ "$MIGRATE_ON_BOOT" = "true" ]; then',
|
||||
' echo "[boot] prisma migrate deploy"',
|
||||
" pnpm exec prisma migrate deploy --config prisma.config.ts",
|
||||
"fi",
|
||||
"",
|
||||
'if [ "$SEED_ON_BOOT" = "true" ]; then',
|
||||
' echo "[boot] production seed"',
|
||||
" node packages/db/dist/production-seed.server.js",
|
||||
"fi",
|
||||
"",
|
||||
"exec node build/server-runtime/server.js",
|
||||
"",
|
||||
].join("\n"),
|
||||
);
|
||||
writeFile(rootDir, "pnpm-workspace.yaml", overrides.workspace ?? "packages:\n - apps/*\n");
|
||||
writeJson(
|
||||
rootDir,
|
||||
@@ -289,9 +311,9 @@ function createFixture(overrides = {}) {
|
||||
scripts: {
|
||||
build: "vite build && node scripts/build-web-server.mjs",
|
||||
lint: "eslint .",
|
||||
test: "pnpm --filter @toolctrl/web test",
|
||||
test: "pnpm --filter @hivegrid/web test",
|
||||
typecheck: "tsc -b",
|
||||
start: "pnpm --filter @toolctrl/web start",
|
||||
start: "pnpm --filter @hivegrid/web start",
|
||||
},
|
||||
},
|
||||
);
|
||||
@@ -299,7 +321,7 @@ function createFixture(overrides = {}) {
|
||||
rootDir,
|
||||
"apps/web/package.json",
|
||||
overrides.webPackage ?? {
|
||||
name: "@toolctrl/web",
|
||||
name: "@hivegrid/web",
|
||||
scripts: {
|
||||
start: "node ../../build/server-runtime/server.js",
|
||||
},
|
||||
@@ -309,7 +331,7 @@ function createFixture(overrides = {}) {
|
||||
rootDir,
|
||||
"apps/api/package.json",
|
||||
overrides.apiPackage ?? {
|
||||
name: "@toolctrl/api",
|
||||
name: "@hivegrid/api",
|
||||
scripts: {
|
||||
build: "tsc -p tsconfig.json",
|
||||
start: "node dist/server.js",
|
||||
@@ -320,7 +342,7 @@ function createFixture(overrides = {}) {
|
||||
rootDir,
|
||||
"apps/worker/package.json",
|
||||
overrides.workerPackage ?? {
|
||||
name: "@toolctrl/worker",
|
||||
name: "@hivegrid/worker",
|
||||
scripts: {
|
||||
start: "node dist/index.js",
|
||||
health: "node dist/health.js",
|
||||
@@ -360,17 +382,21 @@ describe("verify-docker-baseline", () => {
|
||||
assert.ok(result.passes.some((pass) => pass === "Dockerfile: copies build/server-runtime into web image"));
|
||||
assert.ok(result.passes.some((pass) => pass === "Dockerfile: build target leaves web, api, and worker app builds to split stages"));
|
||||
assert.ok(result.passes.some((pass) => pass === "Dockerfile: build target keeps VITE build args out of api/worker cache paths"));
|
||||
assert.ok(result.passes.some((pass) => pass === "Dockerfile: web-build target runs only @toolctrl/web build"));
|
||||
assert.ok(result.passes.some((pass) => pass === "Dockerfile: api-build target runs only @toolctrl/api build"));
|
||||
assert.ok(result.passes.some((pass) => pass === "Dockerfile: worker-build target runs only @toolctrl/worker build"));
|
||||
assert.ok(result.passes.some((pass) => pass === "Dockerfile: web-build target runs only @hivegrid/web build"));
|
||||
assert.ok(result.passes.some((pass) => pass === "Dockerfile: api-build target runs only @hivegrid/api build"));
|
||||
assert.ok(result.passes.some((pass) => pass === "Dockerfile: worker-build target runs only @hivegrid/worker build"));
|
||||
assert.ok(result.passes.some((pass) => pass === "Dockerfile: target-specific runtime artifacts remove web, api, and worker sourcemaps before runtime COPY"));
|
||||
assert.ok(result.passes.some((pass) => pass === "Dockerfile: web target exposes port 8080"));
|
||||
assert.ok(result.passes.some((pass) => pass === "Dockerfile: web target avoids recursive runtime chown"));
|
||||
assert.ok(result.passes.some((pass) => pass === "Dockerfile: web target copies prisma.config.ts"));
|
||||
assert.ok(result.passes.some((pass) => pass === "Dockerfile: web target copies packages/billing"));
|
||||
assert.ok(result.passes.some((pass) => pass === "Dockerfile: web target copies packages/db production seed artifact"));
|
||||
assert.ok(result.passes.some((pass) => pass === "Dockerfile: web target copies packages/storage"));
|
||||
assert.ok(result.passes.some((pass) => pass === "Dockerfile: web target copies packages/url"));
|
||||
assert.ok(result.passes.some((pass) => pass === "start.sh: execs the production start process for container signal handling"));
|
||||
assert.ok(result.passes.some((pass) => pass === "start.sh: aborts the boot on failed migrate/seed (set -e)"));
|
||||
assert.ok(result.passes.some((pass) => pass === "start.sh: runs prisma migrate deploy gated by MIGRATE_ON_BOOT"));
|
||||
assert.ok(result.passes.some((pass) => pass === "start.sh: runs the guarded production seed gated by SEED_ON_BOOT"));
|
||||
assert.ok(result.passes.some((pass) => pass === "Dockerfile: defines named worker target from base"));
|
||||
assert.ok(result.passes.some((pass) => pass === "Dockerfile: worker target copies apps/worker/dist"));
|
||||
assert.ok(result.passes.some((pass) => pass === "Dockerfile: worker target copies prisma.config.ts"));
|
||||
@@ -382,7 +408,7 @@ describe("verify-docker-baseline", () => {
|
||||
assert.ok(result.passes.some((pass) => pass === "Dockerfile: api target exposes port 8080"));
|
||||
assert.ok(result.passes.some((pass) => pass === "Dockerfile: api target avoids recursive runtime chown"));
|
||||
assert.ok(result.passes.some((pass) => pass === "package.json: script \"typecheck\" is defined"));
|
||||
assert.ok(result.passes.some((pass) => pass === "package.json: production start script delegates to @toolctrl/web"));
|
||||
assert.ok(result.passes.some((pass) => pass === "package.json: production start script delegates to @hivegrid/web"));
|
||||
assert.ok(result.passes.some((pass) => pass === "apps/web/package.json: owns production web server start command"));
|
||||
assert.ok(result.passes.some((pass) => pass === "package.json: production start script does not use tsx"));
|
||||
assert.ok(result.passes.some((pass) => pass === "apps/api/package.json: production start script uses node"));
|
||||
@@ -480,7 +506,7 @@ describe("verify-docker-baseline", () => {
|
||||
it("fails when the deps target installs without a BuildKit pnpm store cache", () => {
|
||||
const rootDir = createFixture({
|
||||
dockerfile: VALID_DOCKERFILE.replace(
|
||||
"RUN --mount=type=cache,id=toolctrl-pnpm-store,target=/pnpm/store \\\n pnpm install --frozen-lockfile --prod=false --offline",
|
||||
"RUN --mount=type=cache,id=hivegrid-pnpm-store,target=/pnpm/store \\\n pnpm install --frozen-lockfile --prod=false --offline",
|
||||
"RUN pnpm install --frozen-lockfile --prod=false"
|
||||
),
|
||||
});
|
||||
@@ -493,7 +519,7 @@ describe("verify-docker-baseline", () => {
|
||||
it("fails when the deps target does not fetch before offline install", () => {
|
||||
const rootDir = createFixture({
|
||||
dockerfile: VALID_DOCKERFILE.replace(
|
||||
"RUN --mount=type=cache,id=toolctrl-pnpm-store,target=/pnpm/store \\\n pnpm fetch --frozen-lockfile\n",
|
||||
"RUN --mount=type=cache,id=hivegrid-pnpm-store,target=/pnpm/store \\\n pnpm fetch --frozen-lockfile\n",
|
||||
""
|
||||
),
|
||||
});
|
||||
@@ -621,6 +647,16 @@ describe("verify-docker-baseline", () => {
|
||||
assert.match(result.failures.join("\n"), /start\.sh: must use "exec node build\/server-runtime\/server\.js" so container signals reach the web process without pnpm indirection/);
|
||||
});
|
||||
|
||||
it("fails when start.sh drops the boot-gated migrate or seed", () => {
|
||||
const rootDir = createFixture({ startScript: "#!/bin/sh\nexec node build/server-runtime/server.js\n" });
|
||||
|
||||
const result = checkStartScript(rootDir);
|
||||
|
||||
assert.match(result.failures.join("\n"), /start\.sh: must set -e/);
|
||||
assert.match(result.failures.join("\n"), /gated by MIGRATE_ON_BOOT=true/);
|
||||
assert.match(result.failures.join("\n"), /gated by SEED_ON_BOOT=true/);
|
||||
});
|
||||
|
||||
it("fails when the root production start script uses tsx", () => {
|
||||
const rootDir = createFixture({
|
||||
rootPackage: {
|
||||
@@ -628,7 +664,7 @@ describe("verify-docker-baseline", () => {
|
||||
scripts: {
|
||||
build: "vite build && node scripts/build-web-server.mjs",
|
||||
lint: "eslint .",
|
||||
test: "pnpm --filter @toolctrl/web test",
|
||||
test: "pnpm --filter @hivegrid/web test",
|
||||
typecheck: "tsc -b",
|
||||
start: "tsx server/server.ts",
|
||||
},
|
||||
@@ -637,7 +673,7 @@ describe("verify-docker-baseline", () => {
|
||||
|
||||
const result = verifyDockerBaseline(rootDir);
|
||||
|
||||
assert.match(result.failures.join("\n"), /package\.json: script "start" must delegate to @toolctrl\/web/);
|
||||
assert.match(result.failures.join("\n"), /package\.json: script "start" must delegate to @hivegrid\/web/);
|
||||
assert.match(result.failures.join("\n"), /package\.json: script "start" must not use tsx for web production runtime/);
|
||||
});
|
||||
|
||||
@@ -766,7 +802,7 @@ describe("verify-docker-baseline", () => {
|
||||
|
||||
it("fails when the shared build stage runs app builds instead of split build targets", () => {
|
||||
const rootDir = createFixture({
|
||||
dockerfile: VALID_DOCKERFILE.replace("RUN pnpm --filter @toolctrl/db build\n", "RUN pnpm --filter @toolctrl/db build\nRUN pnpm build\n"),
|
||||
dockerfile: VALID_DOCKERFILE.replace("RUN pnpm --filter @hivegrid/db build\n", "RUN pnpm --filter @hivegrid/db build\nRUN pnpm build\n"),
|
||||
});
|
||||
|
||||
const result = checkDockerfileWebContract(rootDir);
|
||||
@@ -776,7 +812,7 @@ describe("verify-docker-baseline", () => {
|
||||
|
||||
it("fails when the shared build stage owns Vite build args", () => {
|
||||
const rootDir = createFixture({
|
||||
dockerfile: VALID_DOCKERFILE.replace("RUN pnpm --filter @toolctrl/db prisma:generate\n", 'ARG VITE_SENTRY_DSN_WEB=""\nRUN pnpm --filter @toolctrl/db prisma:generate\n'),
|
||||
dockerfile: VALID_DOCKERFILE.replace("RUN pnpm --filter @hivegrid/db prisma:generate\n", 'ARG VITE_SENTRY_DSN_WEB=""\nRUN pnpm --filter @hivegrid/db prisma:generate\n'),
|
||||
});
|
||||
|
||||
const result = checkDockerfileWebContract(rootDir);
|
||||
@@ -823,7 +859,7 @@ COPY --from=build /myapp/build /myapp/build
|
||||
scripts: {
|
||||
build: "vite build",
|
||||
lint: "eslint .",
|
||||
test: "pnpm --filter @toolctrl/web test",
|
||||
test: "pnpm --filter @hivegrid/web test",
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -852,7 +888,7 @@ COPY --from=build /myapp/build /myapp/build
|
||||
it("fails when worker production scripts use tsx", () => {
|
||||
const rootDir = createFixture({
|
||||
workerPackage: {
|
||||
name: "@toolctrl/worker",
|
||||
name: "@hivegrid/worker",
|
||||
scripts: {
|
||||
start: "tsx src/index.ts",
|
||||
health: "tsx src/health.ts",
|
||||
|
||||
Reference in new issue
Block a user