2026-09-20 08:42:58 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
|
|
shutdown() {
|
|
|
|
|
trap - TERM INT
|
|
|
|
|
kill -TERM "$api_pid" "$nginx_pid" 2>/dev/null || true
|
|
|
|
|
wait "$api_pid" "$nginx_pid" 2>/dev/null || true
|
|
|
|
|
exit 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
goose -dir /app/migrations postgres "$DATABASE_URL" up
|
|
|
|
|
seed
|
|
|
|
|
|
2026-09-20 10:49:09 +02:00
|
|
|
mkdir -p /tmp/nginx
|
|
|
|
|
|
feat: palette and light/dark from go-bananas, and fix the image user
The theme selector and the appearance toggle are the custom elements
go-bananas ships, loaded at run time. They are custom elements rather than
components written here because the applications this service feeds are a mix of
React, vanilla JavaScript and server-rendered HTML, and a custom element is the
one shape all three can use with no build step, no import map, and no second copy
of React to break the hooks.
Every token in the stylesheet is now written as var(--bn-*, fallback). That
ordering is the safety property: with no theme service configured the page renders
exactly as it did before, and with one configured the same rules follow the
palette. The navigation rail takes the contract's sunken surface and its paired
foreground rather than a fixed dark navy, because a light appearance wants dark
text there.
THEME_BASE_URL is read from runtime-config.js, which the entrypoint rewrites from
the environment on start, so one image serves every environment rather than
baking a hostname into the bundle at build time.
contract.test.ts fetches the live contract and asserts it defines every --bn-*
variable this application consumes. A token renamed on the service would
otherwise leave every var() resolving to its fallback, and the page would look
correct while never actually following the palette. Verified it fails on a
deliberately wrong token name.
The image also had two USER lines, the second silently replacing the first with a
uid that owns neither /app nor /tmp/nginx. nginx could not create its pid file or
its temp paths, so the container failed to start. Confirmed by building both
variants: the old one cannot write nginx's temp directory, the fixed one serves
the front end, its hashed assets, and the /api proxy.
2026-10-05 22:47:20 +02:00
|
|
|
# The theme service location is environment, not build time, so one image serves
|
|
|
|
|
# every environment. The file is regenerated on every start and is read by the
|
|
|
|
|
# page before the bundle runs.
|
|
|
|
|
cat > /app/frontend/runtime-config.js <<CONFIG
|
|
|
|
|
window.__GO_GUESS_CONFIG__ = { themeBaseUrl: "${THEME_BASE_URL:-}" }
|
|
|
|
|
CONFIG
|
|
|
|
|
|
2026-09-20 08:42:58 +02:00
|
|
|
api &
|
|
|
|
|
api_pid=$!
|
2026-09-20 09:13:48 +02:00
|
|
|
nginx -e /dev/stderr -g 'daemon off;' &
|
2026-09-20 08:42:58 +02:00
|
|
|
nginx_pid=$!
|
|
|
|
|
|
|
|
|
|
trap shutdown TERM INT
|
|
|
|
|
|
|
|
|
|
while kill -0 "$api_pid" 2>/dev/null && kill -0 "$nginx_pid" 2>/dev/null; do
|
|
|
|
|
sleep 1
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
kill -TERM "$api_pid" "$nginx_pid" 2>/dev/null || true
|
|
|
|
|
wait "$api_pid" "$nginx_pid" 2>/dev/null || true
|
|
|
|
|
exit 1
|