Files
co-lite/openspec/changes/add-repo-foundation-local-stack/tasks.md
T

5.4 KiB

Tasks

Run serially: every group touches build files or shared config.

1. Copy modules into the repo

  • 1.1 Copy the ten kept backend modules (core-libs, core-session, api-gateway, mobile-api, services-auth, services-system, services-counter, services-member, services-log, services-email) from Tastefully 8bd93d15, using git -C ~/Projects/tastefully archive 8bd93d15 <dirs> | tar -x. Verify: ls shows exactly those ten solvway-* dirs, and find . -name node_modules -o -name target is empty.
  • 1.2 Copy solvway-admin-portal from babyboo f64d096ea and solvway-customer-portal from Tastefully 8bd93d15 the same way. Verify that npm ci && npm test && npm run build passes in each app, or record the pre-existing failures with their output.
  • 1.3 Scan the copied tree for secrets: grep -rnEi "(password|secret|apikey|api_key|token|BEGIN .*PRIVATE KEY)\s*[:=]" --include=*.yml --include=*.yaml --include=*.properties --include=*.env* --include=*.json .. Replace every literal secret with an env placeholder. Verify: re-running the scan shows only placeholders or dev-only values. Commit with the list of replaced keys, never the values.

2. Single build

  • 2.1 Set the core-libs version to colite-v1 in solvway-core-libs/pom.xml (and core-session if it shares the scheme), and set core-project.version to colite-v1 in every kept module pom. Verify: grep -rn "tastefully-v1\|babyboo-v1" --include=pom.xml . is empty.
  • 2.2 Add a root pom.xml aggregator (groupId com.solvway, artifactId co-lite, packaging pom) listing the ten modules, core-libs and core-session first. Verify: mvn -T 1C verify at the root passes, and ls ~/.m2/repository/com/solvway/core/solvway-core-libs/ still contains tastefully-v1 with an unchanged timestamp. Do not run mvn install against the Tastefully or babyboo repos.
  • 2.3 Remove gateway routes to dropped services in solvway-api-gateway/src/main/resources/application.yml, and any app.services.name.* entries only they use. Verify: the existing gateway tests pass, and grep -nE "bonus|payment|inventory|stockist|wallet" solvway-api-gateway/src/main/resources/application.yml is empty.

3. Local stack (without seed)

  • 3.1 Extract every Pub/Sub topic and subscription name used by the kept modules: read each PubSubConfig, PubSubListener and publisher call, and resolve property values. Write them to local/pubsub/topics.txt as topic subscription lines, plus publish-only topics as topic lines. Verify: the line count of subscriptions equals the number of PubSubInboundChannelAdapter constructions in the kept modules (37).
  • 3.2 Add application-local.yml to each kept Spring module with the emulator host and co-lite-local project id. Verify: mvn -T 1C verify still passes.
  • 3.3 Add local/docker-compose.yml: mysql:8, redis:7, the Pub/Sub emulator, a pubsub-init one-shot that reads topics.txt, and the eight Java services named as in design decision 4, each with JAVA_OPTS=-Xmx384m. Add local/.env.example with dev-only values for every env var listed in design Context, and git-ignore local/.env. Add local/up.sh, which runs mvn -T 1C -DskipTests package then docker compose up -d --build. Verify: with an empty MySQL (schemas created empty by an init script), local/up.sh brings pubsub-init to exit 0, and no service log shows a missing topic or subscription error.

4. Seed (needs the user's Tastefully dump)

  • 4.1 Ask the user for the dump, giving them this exact command: mysqldump --no-data --routines --triggers --skip-add-drop-table --databases service-system service-counter service-member service-log service-email > 01-schema.sql, plus a data dump of an allow-list of reference tables. Build the allow-list from the services-system entities: role, module, system_property, location_hierarchy and the other lookup tables, each checked for personal data before it is listed. Put the files in local/seed/. Verify: grep the files for INSERT INTO \(member|user|event_attendance|orders)` and it is empty.
  • 4.2 Write 03-colite.sql: one company row and one admin user with the Administrator role, a bcrypt hash of the documented dev password, and the column set matching the dumped user table. Verify: after docker compose down -v && local/up.sh, SELECT count(*) FROM \service-system`.userreturns 1. The admin can log in throughPOST /auth/...` via the gateway (endpoint confirmed from services-auth) and gets a token.
  • 4.3 Write local/README.md: prerequisites (JDK 21, Maven, Docker, registry login), build/up, reset (docker compose -f local/docker-compose.yml down -v), the dev login, and how to run one service from an IDE (stop its container, run with profile local and .env exported). Verify: a second developer follows it on a clean clone without help. If no second developer is available, re-run the documented commands verbatim on a fresh clone in a scratch dir.

5. Smoke check

  • 5.1 Add local/smoke.sh (design decision 8). Verify on a healthy stack: exit 0 and prints 200. Then docker compose stop service-counter: exit non-zero, with the failing URL printed.
  • 5.2 Integration: from a fresh clone in a scratch directory, run mvn -T 1C verify, local/up.sh and local/smoke.sh. Verify: all three succeed and docker compose ps shows every service running. Paste the outputs into the PR description.

Workflow follow-up

  • Code review, then push the branch and confirm the PR target with the user.
  • Archive the change after merge.