No description
Find a file
Claude a34ea9a9bc
Document known gap: storeall doesn't wait for the app's own background threads
InitServlet.destroy() now holds incoming requests and waits (briefly) for
HttpController's request count to hit zero before calling
Registry.storeAll() - but that counter only tracks threads servicing HTTP
requests. A thread the webapp spun up itself (e.g. the order schedulers
InitServlet.init() starts) isn't tracked by it at all, and can still be
running - and still writing - while storeall takes its snapshot.

storeAll()'s synchronization still keeps this from corrupting the DB, and
stopwaitsecs=300 (sportrum-ansible) still keeps supervisord from killing
Tomcat mid-write - neither of those is undone by this. But a write from an
untracked background thread can still land after storeall's pass and
never get persisted. Properly closing it needs a real thread manager in
the webapp that can halt everything it started, not just hold new
requests. Noting it here, next to the code that currently doesn't do that,
so it isn't forgotten before that manager exists.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tj4SF2BGFxgoRYrCAzNpDb
2026-10-01 09:37:31 +00:00
lib.build Add Ant deploy target, mirroring xzpect-timer's build.xml pattern 2026-09-30 18:41:12 +00:00
.gitattributes Import existing manual deploy scripts as a starting point 2026-09-29 17:04:18 +00:00
.gitignore Add Ant deploy target, mirroring xzpect-timer's build.xml pattern 2026-09-30 18:41:12 +00:00
build.xml Replace flag-based upgrade.sh with named migrate/hotfix-code modes 2026-09-30 20:00:35 +00:00
check-schema-diff.sh Fix check-schema-diff.sh: manager.zip nests under manager/, not flat 2026-09-30 20:17:35 +00:00
emergency-storeall.sh Add self-throttling schedule and request throughput to emergency-storeall.sh 2026-09-30 16:17:08 +00:00
nightly-storeall.sh Rework nightly-storeall.sh for cron-driven scheduling, add maintenance_log 2026-09-30 14:11:11 +00:00
README.md Replace flag-based upgrade.sh with named migrate/hotfix-code modes 2026-09-30 20:00:35 +00:00
restart.sh Parameterize runcmd to support commands beyond storeall 2026-09-29 20:51:47 +00:00
tomcat_ctl.sh Import existing manual deploy scripts as a starting point 2026-09-29 17:04:18 +00:00
upgrade-cmds.sh Replace flag-based upgrade.sh with named migrate/hotfix-code modes 2026-09-30 20:00:35 +00:00
upgrade-funs.sh Rework nightly-storeall.sh for cron-driven scheduling, add maintenance_log 2026-09-30 14:11:11 +00:00
upgrade.sh Document known gap: storeall doesn't wait for the app's own background threads 2026-10-01 09:37:31 +00:00

sportrum-deploy

Deploy tooling for the sportrum webapp — the actual server-side upgrade (stop Tomcat, back up, install the new build, migrate the DB, restart), run either by hand or via this repo's build.xml.

This project deliberately does NOT build or upload sportrum.war/ manager.zip itself. That's the sportrum webapp project's own build.xml (its release-all target) — see the next section for the one change that project needs to make so ant "migrate(@host)" here can tag a deploy by the exact commit it shipped.

Required: embedding WEB-INF/VERSION in the webapp build

ant "migrate(@host)" (see build.xml) tags every migration with the git version of whatever sportrum.war is already sitting on the server — read back off the WAR itself, not derived from this repo's git history (there isn't a relationship between the two repos to derive it from). That means the sportrum webapp project's own build.xml needs to embed a WEB-INF/VERSION file into the WAR, containing a single line:

<build-timestamp>-<git-short-hash>

e.g. 20260930-184512-a3f9c21. Timestamp first so tagged migration folders on the server sort chronologically; build time (not commit time), so the value stays unique even if the same commit is ever rebuilt and redeployed again; WEB-INF/, not the WAR root, since anything outside WEB-INF/ is directly servable over HTTP by Tomcat and a commit hash shouldn't be publicly fetchable.

Add this near the top of the webapp project's war target, before the <war> task itself runs:

<tstamp>
    <format property="build.timestamp" pattern="yyyyMMdd-HHmmss"/>
</tstamp>
<exec executable="git" outputproperty="build.gitrev" failonerror="true">
    <arg value="rev-parse"/>
    <arg value="--short"/>
    <arg value="HEAD"/>
</exec>
<property name="build.version" value="${build.timestamp}-${build.gitrev}"/>
<echo message="Building version ${build.version}"/>

<mkdir dir="${build}/version-stage"/>
<echo file="${build}/version-stage/VERSION" message="${build.version}"/>

Then add a <webinf> fileset to the existing <war destfile="${build}/sportrum.war" ...> task call, alongside whatever filesets are already there:

<webinf dir="${build}/version-stage">
    <include name="VERSION"/>
</webinf>

Until that's in place, ant "migrate(@host)" here will fail its own pre-flight check with a message pointing back here, rather than silently tagging every migration unknown or similar — see resolve-migration-tag in build.xml.

Deploy targets

See ant help (or just ant, since help is the default target) for the full, current usage text — it's kept there rather than duplicated here so it can't drift out of sync with the actual build.xml. Short version: install-scripts(@host) syncs this repo's scripts to the server without running anything; hotfix-code(@host) is for a change with no DB migration (hard-gated on check-schema-diff.sh confirming that's actually true); migrate(@host) is for a change that does migrate the DB (tagged, indefinitely-kept before/after backup and migration transcript under backup/migrations/<tag>/ on the server).