Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
5.6 KiB
Design
Context
- Java services: each Dockerfile copies
target/*.jarontogitea.containerverse.dev/solvway/docker-java-21. The Spring profile comes from theBUILD_PROFILEbuild argument (localin docker-compose,defaultotherwise). All runtime config is already read from environment variables:- MySQL:
MYSQLHOST,MYSQLPORT,MYSQLUSER,MYSQLPWD; - Redis:
REDISHOST; - Pub/Sub:
GCP_PROJECT,GCP_CREDENTIAL_FILE; - mobile-api:
APIGATEWAYURL,APIKEY,AUTH_API_KEYS,JWT_SECRET,CUSTOMER_PORTAL_BASE_URL; - service-auth:
AES_SECRET_KEY,USER_AUTH_API_SECRET; - service-system:
JUMIO_*; - service-email: mail and SMS provider keys.
- MySQL:
- Gateway: it reads its client keys from a mounted
/deployments/appkeys/appkeys.json, and routes to the services by their names (service-auth,service-systemand so on, on port 80). Every Java service has Actuator with probes enabled. - Admin portal: a multi-stage Next.js Dockerfile. Its test and lint stage gates the image. It reads
MOBILE_API_BASE_URL,MOBILE_API_KEYandSESSION_*at runtime, and uses noNEXT_PUBLIC_*variables, so one image fits every environment. - Tastefully's CI (
~/Projects/tastefully/.gitea/workflows/ci.yml) shows the house pattern: a Maven container from the registry, Docker overtcp://docker:2375, and a registry login from thePACKAGE_USERandPACKAGE_RW_KEYsecrets.
Goals / Non-Goals
Goals: a repeatable image build and push from main; a database package and a handover document someone else can deploy from.
Non-Goals:
- Kubernetes manifests, the rollout, and SonarQube.
- Change detection that builds only changed modules. Nine images is small, and a full build keeps the tags consistent.
Decisions
-
One workflow, one job, build all on every push to
main. The job runs:mvn -T 1C -B verifyover the eight service modules and their dependencies;- then
docker buildanddocker pushfor each Java service, followed by the portal.
The portal's own Dockerfile runs its tests, lint and build.
- Alternative: Tastefully's selective scripts (
shouldIBuild.shand others). Rejected because they bring scripts and SonarQube steps this repo does not have, and they make tags uneven across images. - Alternative: also build on pull requests. Rejected for now; it can be added later without changing the images.
-
Tests gate the push. Tastefully builds with
-Dmaven.test.skip=true; Co-Lite runsverify, so a red test stops the run before any push. Every image is pushed only after all builds succeed: build all first, push all after. -
Image names:
gitea.containerverse.dev/ngqile/co-lite-<module>, where<module>isapi-gateway,mobile-api,service-auth,service-system,service-counter,service-member,service-log,service-emailoradmin-portal. Tags are<git sha>andlatest. The owner segment follows the repository owner. If the repo moves to thesolvwayorg, it is the one line to change. -
Profile at runtime. Images are built with the default profile. The entrypoint already honours a
BUILD_PROFILEenvironment variable, so the deployer can override it without a rebuild. The handover says to leave it unset. -
Image hygiene. Each module gets a
.dockerignorewhere it lacks one, so.env,appkeys.json, key files andlocal/never enter the build context. A CI step lists every image's files and fails ifappkeys.json,.env,*.pem,*.p12or a service-account JSON is present. -
Database package (
sql/):- Files:
00-schemas.sql,01-schema.sqland02-reference.sql, the same content aslocal/seed/;03-colite.sql, which is the local03without the dev admin and its role row; and04-first-admin.sql. - The local seed files stay the source. The package is written by hand in the order listed, with a header comment in each file naming its source.
04-first-admin.sqlinserts useradminas super admin of company 1, withlogin = 'N'(forced password change) and a placeholder<BCRYPT_HASH>. The handover shows how to make the hash (htpasswd -bnBC 10 "" '<password>' | tr -d ':\n'), so the password never passes through this repository.
- Files:
-
Handover document
docs/deployment.md, containing:- an image table: port 80 for the services, 3000 for the portal, plus the probe paths (
/actuator/health/livenessand/readinessfor the services); - every environment variable per image, marked as secret or plain;
- a Secret template per image with base64 placeholders;
- the mounted files;
- the Pub/Sub topics and subscriptions from
local/pubsub/topics.txt; - the Traefik host
co-lite.containerverse.dev, routed to the admin portal, with mobile-api and the gateway kept internal; - the order to set things up.
- an image table: port 80 for the services, 3000 for the portal, plus the probe paths (
Risks / Trade-offs
- [No runner serves
ngqile/co-lite] → The first run shows it. The fix is enabling a runner for the repo, or moving the repo undersolvway, which also changes decision 3's owner segment. - [The base image
solvway/docker-java-21needs a registry login to pull] → CI logs in before building. - [The production SQL drifts from
local/seed/] → Header comments name the source file, and task 1.2 diffs the package against the seed. - [Forgot-password does not work without SMTP] → Stated in the handover. Admins sign in with the first-admin flow, and other users get passwords from an admin through the existing user screens.
Migration Plan
Merge, then add the two Actions secrets. The first push to main publishes the images. The DBA applies the package, and the deployer follows docs/deployment.md. Rollback means deploying the previous SHA tag.