Lemonade Stand web UI and JSON API (Spring Boot, Gradle) over the rpg-lemonade Db2 procedures on pub400
  • Java 85.1%
  • HTML 7.8%
  • Shell 3.6%
  • CSS 3.5%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Sean OMeara 88022a3520
All checks were successful
binjovi/ci Binjovi completed the frozen plan
Publish every public route with a one hour DNS TTL
ExternalDNS writes a 300 second TTL unless the HTTPRoute carries
external-dns.alpha.kubernetes.io/ttl, and it reads the annotation from
the route, never from the Gateway. Owner decision 2026-11-02: every
published record is 3600 seconds. Annotate each public-fip route, and add
a guard that fails when one lacks it.
2026-11-02 19:48:16 +01:00
apps feat: Spring Boot skeleton over the pub400 lemonade database 2026-10-12 14:34:10 +02:00
docs docs: define source and delivery policy ownership 2026-10-17 14:23:03 +02:00
gradle fix: record dependency checksums from a cold Gradle home 2026-10-12 14:59:45 +02:00
manifests/lemonade Publish every public route with a one hour DNS TTL 2026-11-02 19:48:16 +01:00
scripts Publish every public route with a one hour DNS TTL 2026-11-02 19:48:16 +01:00
src Publish every public route with a one hour DNS TTL 2026-11-02 19:48:16 +01:00
.gitignore feat: Spring Boot skeleton over the pub400 lemonade database 2026-10-12 14:34:10 +02:00
build.gradle.kts feat: Spring Boot skeleton over the pub400 lemonade database 2026-10-12 14:34:10 +02:00
CHANGELOG.md Serve the lemonade Service on IPv4 and IPv6 2026-10-26 12:50:58 +01:00
README.md feat: play the Lemonade Stand on the web and through /api/stand 2026-10-12 14:59:48 +02:00
settings.gradle.kts feat: Spring Boot skeleton over the pub400 lemonade database 2026-10-12 14:34:10 +02:00
VERSION feat: Spring Boot skeleton over the pub400 lemonade database 2026-10-12 14:34:10 +02:00

lemonade

The Lemonade Stand on the web: a Spring Boot web UI and JSON API at https://lemonade.sean.farm. The game itself is in Db2 for i on pub400. sean/rpg-lemonade delivers it. The procedures LM_NEWGAME, LM_OPENDAY and LM_PLAYDAY hold every rule and every price. This application holds no game rules. It is a JDBC client of those procedures.

Build

Gradle builds this project in the cluster. Binjovi runs the recipe binjovi-plans/recipes/lemonade in the java-builder image (JDK 25 and Gradle from builder-images).

  • There is no gradlew. Gradle comes from the Build image.
  • settings.gradle.kts names one repository, the package cache (https://pkg.sean.farm/cache/maven, Maven Central). The image refuses any other repository, and the Gradle Plugin Portal.
  • Versions are in gradle/libs.versions.toml. Spring Boot uses its BOM through platform(...). The dependency-management plugin is not used.

Run the checks locally in the same image:

cd ~/src/swamp-ops && swamp model method run checks run --input worktree=<path>

gradle check runs the unit tests, the web tests and ManifestsTest, which checks the Kubernetes manifests.

IBM i for Java developers

IBM i word What it is here
library a schema. SOMEARA1 is development, SOMEARA2 staging, SOMEARAB production
host servers the TCP services that JTOpen (net.sf.jt400:jt400) speaks. TLS database 9471, sign-on 9476
SQLSTATE 75xxx an error that a lemonade procedure signals on purpose, for example 75008 "cannot afford"
COMMIT = *CHG the procedures run under commitment control on journaled tables

The connection URL is built in Pub400Properties:

jdbc:as400://pub400.com;secure=true;naming=sql;libraries=SOMEARAB;access=read call;prompt=false;errors=full

access=read call limits the connection to SELECT and CALL. The procedures change the data. The connection cannot send INSERT, UPDATE, DELETE or DDL. It CAN call any procedure, and that includes QSYS2.QCMDEXC, which runs a CL command: the live smoke test proved this on 2026-10-12. So access=read call does not stop CL. What stops it is that the application sends only fixed, parameterized statements. The credential is the pub400 profile of the Binjovi Build (Secret pub400-creds), and that profile can clear the three lemonade libraries. A second pub400 profile with authority only on the LM_ objects in SOMEARAB is the stronger fix. The library must be one of the three lemonade libraries.

Play

The title screen / needs no database. "Press Enter to open up" opens a ledger day for the visitor and goes to /stand. The visitor is the HTTP session: the application gives each session a random player id (W and nine characters, LM_STAND.PLAYER is VARCHAR(10)). A visitor never names a player, so nobody can play another stand.

Method and path What it does
GET /api/stand the stand (or null) and the prices (LM_GCOST('GLASS'), rule SIGNCOST)
POST /api/stand/day CALL LM_OPENDAY: opens a day, or returns the open one
POST /api/stand/play CALL LM_PLAYDAY with {"glasses":0-9999,"signs":0-99,"priceCents":0-999}, returns the new LM_PLAYS row
POST /api/stand/reset CALL LM_NEWGAME: a new stand
GET /api/stand/history the last ten days of the stand

Errors are RFC 9457 problem details with a kind:

SQLSTATE kind HTTP
75008 cannot-afford 409
75001 (no open day, stand closed) no-open-day 409
75001 (business days exhausted) busy 429
75002, or an order outside the limits invalid-order 422
any other unavailable 503, with no SQL text

LM_OPENDAY takes the next ledger day from a counter that every player and the 5250 screen share, and the counter stops at 99999. So the application opens at most lemonade.days-per-hour (default 120) new days each hour, and answers busy after that.

Live smoke test

scripts/live-smoke.sh proves the bridge against SOMEARA1 or SOMEARA2. It refuses production. It runs LivePub400SmokeTest in the java-builder image with PUB400_USER, PUB400_PASSWORD and LEMONADE_LIVE_LIBRARY in the environment. It checks TLS, one game day that commits, SQLSTATE 75008, and that access=read call refuses DML and DDL. It reports whether a QSYS2.QCMDEXC call is allowed (it is). Each run adds one or two ZS stands to the library it tests.

Deploy

Binjovi releases the image to registry.sean.farm/seanfarm/lemonade and deploys it through Argo CD (apps/lemonade.yaml, manifests/lemonade). The route goes through the edge WAF. The repository holds only a Deployment, a Service and two HTTPRoutes, the kinds the AppProject admits. seanfarm owns the namespace, the Binjovi deploy Role and the pub400 credential (docs/LEMONADE.md there). The probes use the management port 8081. They do not depend on pub400, so a pub400 outage does not stop the site. The health component pub400 reports the database.