From 510efa4697f4aaa1356615fa4b0dafe20a4d20dc Mon Sep 17 00:00:00 2001 From: ngqile Date: Mon, 30 Nov 2026 10:22:21 +0800 Subject: [PATCH] docs: address the release-packaging branch review Spec states what the images guarantee (no secrets, overridable defaults); handover notes non-TLS DB connections, root on port 80, the empty-server package, the SMS key rotation, and the missing email/system Secrets. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM --- docs/deployment.md | 11 ++++++++--- .../specs/release-packaging/spec.md | 2 +- solvway-admin-portal/Dockerfile | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/deployment.md b/docs/deployment.md index ff52f8e..3db5086 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -28,6 +28,8 @@ The Service names matter: - **Java services:** liveness `GET /actuator/health/liveness`, readiness `GET /actuator/health/readiness`. Spring Boot turns these on by itself on Kubernetes. `GET /actuator/health` also works everywhere. - **Admin portal:** it has no health endpoint. Use a TCP probe on port 3000, or `GET /login`, which returns 200 without a session. +**The Java images run as root and listen on port 80** (the base image sets no user). A cluster that enforces `runAsNonRoot` or the restricted Pod Security level must allow them. + **Images carry no configuration or secrets.** Everything below is supplied at runtime. CI fails a build whose image holds a key file or a secret with a built-in default (`local/image-check.sh`). Leave `BUILD_PROFILE` unset. `JAVA_OPTS` is optional, for example `-Xmx512m`. ## 2. Order of setup @@ -49,7 +51,9 @@ The Service names matter: - `log_bin_trust_function_creators = 1`. The schema creates functions and triggers, and with binary logging on that otherwise needs the SUPER privilege, which managed MySQL does not grant. - `innodb_strict_mode = OFF`. Some inherited tables are wide `utf8mb3` tables that strict mode rejects. -**Package:** `openspec/changes/add-release-ci-packaging/sql/`. After the change is archived, it is under `openspec/changes/archive/-add-release-ci-packaging/sql/`. Run the files in this order, on an empty server: +**Connections:** the services connect without TLS (`useSSL=false` in their datasource URL), so the server must accept non-TLS connections from the cluster. To require TLS instead, override `SPRING_DATASOURCE_URL` on each database service. + +**Package:** this package sets up an empty server once. Later changes ship their own SQL, which is applied on top of it. The files are in `openspec/changes/add-release-ci-packaging/sql/`. After the change is archived, it is under `openspec/changes/archive/-add-release-ci-packaging/sql/`. Run the files in this order, on an empty server: | File | What it does | |---|---| @@ -88,7 +92,7 @@ The services publish and subscribe through Google Pub/Sub. It is not replaced in **Secret** values go in a Kubernetes Secret. **Plain** values can go in a ConfigMap or straight into the Deployment. -**Shared by the seven services and mobile-api** (every Java image except `api-gateway`, which needs only `JWT_TOKEN`): +**Shared by the six services (auth, system, counter, member, log, email) and mobile-api** (every Java image except `api-gateway`, which needs only `JWT_TOKEN`): | Variable | Kind | Value | |---|---|---| @@ -193,7 +197,7 @@ Route `co-lite.containerverse.dev` to the `admin-portal` Service on port 3000, w ## 9. Secret templates -Kubernetes Secrets hold base64 values. Encode each one with `printf '%s' 'value' | base64 -w0`. These are templates: replace every `<…>` and never commit the filled-in files. +There is no template yet for `service-email` (its keys wait for the email provider) or `service-system` (its Jumio keys stay unset). Kubernetes Secrets hold base64 values. Encode each one with `printf '%s' 'value' | base64 -w0`. These are templates: replace every `<…>` and never commit the filled-in files. ```yaml apiVersion: v1 @@ -256,4 +260,5 @@ data: - **No email provider yet, and staff onboarding needs one.** Creating a staff user emails them a temporary password, and forgot-password sends an email too. There is no way for an admin to set someone else's password. Until a provider is configured in `service-email`, only the first administrator from `04-first-admin.sql` can sign in. - **Reference data from Tastefully.** It still holds some Tastefully business text (message templates with a phone number, bank account and form links; a public image bucket URL; Tastefully usernames in audit columns). Review it before go-live. - **Other Tastefully defaults.** The sender addresses in `service-email` and the `CUSTOMER_PORTAL_BASE_URL` fallback point at Tastefully. Override them as described in section 6. +- **Leaked SMS key.** An SMS360 API key from Tastefully was in `service-email`'s config and is in git history. It has been removed from the config, but it must be rotated with SMS360 before go-live, by whoever owns that Tastefully account. - **Deploy by SHA, not `latest`.** CI pushes the images one by one, so if a push fails halfway, `latest` can differ between images. diff --git a/openspec/changes/add-release-ci-packaging/specs/release-packaging/spec.md b/openspec/changes/add-release-ci-packaging/specs/release-packaging/spec.md index c37ca55..4f3a96c 100644 --- a/openspec/changes/add-release-ci-packaging/specs/release-packaging/spec.md +++ b/openspec/changes/add-release-ci-packaging/specs/release-packaging/spec.md @@ -29,7 +29,7 @@ Every push to `main` SHALL build the eight backend services and the admin portal ### Requirement: Images carry no secrets or environment config -Images SHALL contain no secrets, keys, passwords or environment-specific hosts. Every service MUST read its database, Redis, gateway, Pub/Sub, JWT and API-key settings from environment variables or mounted files at runtime. +Images SHALL contain no secrets, keys or passwords, and no setting whose name marks it as a secret SHALL have a built-in default value. Every service MUST read its database, Redis, gateway, Pub/Sub, JWT and API-key settings from environment variables or mounted files at runtime, and any other environment-specific value baked into an image MUST be overridable by an environment variable. #### Scenario: Image layers hold no key material diff --git a/solvway-admin-portal/Dockerfile b/solvway-admin-portal/Dockerfile index b17ac1f..2e4ffb8 100644 --- a/solvway-admin-portal/Dockerfile +++ b/solvway-admin-portal/Dockerfile @@ -18,8 +18,8 @@ COPY . . # ── Stage 3a: test ──────────────────────────────────────────────────────────── # Tests run here deliberately: a red suite fails the image build, matching -# solvway-customer-portal. The Maven modules are built with -Dmaven.test.skip=true and -# not covered in CI, so this is the only automated gate this module gets. +# solvway-customer-portal. CI (.gitea/workflows/ci.yml) runs no separate portal test step, +# so this stage is the portal's test gate there. # .dockerignore must therefore NOT exclude test/ or *.test.ts(x) — vitest.config.ts # aliases `server-only` to test/stub-empty.ts. # BuildKit runs this stage in parallel with builder, and builds only stages the target needs: the