mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-09-09 19:57:16 +02:00
feat(web-app-chess): add castling.club role with ports, networks, and build setup
- Added network subnet (192.168.103.192/28) and port 8050 for web-app-chess - Replaced stub README with usability-focused description of castling.club - Implemented config, vars, meta, and tasks for web-app-chess - Added Dockerfile, docker-compose.yml, env, and docker-entrypoint.sh templates - Integrated entrypoint asset placement - Updated meta to reflect usability and software features Ref: https://chatgpt.com/share/68b6c65a-3de8-800f-86b2-a110920cd50e
This commit is contained in:
27
roles/web-app-chess/templates/docker-entrypoint.sh
Normal file
27
roles/web-app-chess/templates/docker-entrypoint.sh
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
APP_KEY_FILE="${APP_KEY_FILE:-/app/data/{{ CHESS_KEY_FILENAME }}}"
|
||||
APP_KEY_PUB="${APP_KEY_FILE}.pub"
|
||||
|
||||
# 1) Generate signing key pair if missing
|
||||
if [[ ! -f "${APP_KEY_FILE}" || ! -f "${APP_KEY_PUB}" ]]; then
|
||||
echo "[chess] generating RSA signing key pair at ${APP_KEY_FILE}"
|
||||
/app/tools/gen-signing-key.sh "${APP_KEY_FILE}"
|
||||
fi
|
||||
|
||||
# 2) Wait for PostgreSQL if env is provided
|
||||
if [[ -n "${PGHOST:-}" ]]; then
|
||||
echo "[chess] waiting for PostgreSQL at ${PGHOST}:${PGPORT:-5432}..."
|
||||
until pg_isready -h "${PGHOST}" -p "${PGPORT:-5432}" -U "${PGUSER:-postgres}" >/dev/null 2>&1; do
|
||||
sleep 1
|
||||
done
|
||||
fi
|
||||
|
||||
# 3) Run migrations (idempotent)
|
||||
echo "[chess] running migrations"
|
||||
yarn migrate up
|
||||
|
||||
# 4) Start app
|
||||
echo "[chess] starting server on port ${PORT:-5080}"
|
||||
exec yarn start
|
Reference in New Issue
Block a user