Add container setup and docs
Dockerfile (pinned node:26.13.0-alpine3.24, non-root, no npm install) and compose.yaml (loopback by default, read-only root fs, dropped capabilities, healthcheck, named volume). Every setting is an env var, documented in .env.example and README.md. AGENTS.md records project conventions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HA82gXkMmmRRKLSnY6vQN3
This commit is contained in:
parent
3a56938172
commit
d26b262a90
6 changed files with 305 additions and 0 deletions
144
README.md
Normal file
144
README.md
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
# Elorasmus
|
||||
|
||||
Choose your exchange school by picking one of two, over and over. Each pick updates an
|
||||
**Elo rating**, so a personal ranking of all 170 partner schools in CTU FEL's 2027/28 Master
|
||||
catalogue builds up gradually. Every school card has researched data on
|
||||
AI/robotics quality, money from CTU, living costs, travel, language rules, social life vs
|
||||
solitude, nature (climbing, hiking, ocean, skiing), safety and stability, with sources.
|
||||
|
||||
Built for phones: one screen per decision, pick buttons where your thumb is, dark mode, and it
|
||||
can be added to the home screen.
|
||||
|
||||
## Run it
|
||||
|
||||
You need Docker with the compose plugin, or Podman with `podman compose`.
|
||||
|
||||
```sh
|
||||
cp .env.example .env && chmod 600 .env
|
||||
docker compose up -d --build # or: podman compose up -d --build
|
||||
```
|
||||
|
||||
Open <http://localhost:8317>. Picks, notes and settings are stored in the `elorasmus-data`
|
||||
volume.
|
||||
|
||||
**Set a password before the app is reachable from anywhere but this machine.** This reads it
|
||||
from a hidden prompt, writes it to `.env` without showing it, and prints only its length:
|
||||
|
||||
```sh
|
||||
read -rsp 'Password (8+ chars, no single quote): ' PW; echo
|
||||
sed -i '/^AUTH_PASSWORD=/d' .env && printf "AUTH_PASSWORD='%s'\n" "$PW" >> .env
|
||||
echo "stored, ${#PW} chars"; unset PW
|
||||
docker compose up -d # restart with the new setting
|
||||
```
|
||||
|
||||
### Getting to it from your phone
|
||||
|
||||
By default the container is published on `127.0.0.1` only. Pick one of these:
|
||||
|
||||
- **Reverse proxy with HTTPS (recommended).** Put Caddy, nginx or Traefik in front, set
|
||||
`TRUST_PROXY=true`, and keep `AUTH_PASSWORD` set. Minimal Caddyfile:
|
||||
```
|
||||
elo.example.com {
|
||||
reverse_proxy 127.0.0.1:8317
|
||||
}
|
||||
```
|
||||
To serve it under a path (`example.com/elorasmus/`), set `BASE_PATH=/elorasmus/` and proxy
|
||||
that path without stripping it.
|
||||
- **VPN (Tailscale, WireGuard).** Set `ELORASMUS_BIND` to the VPN interface's IP (or `0.0.0.0`
|
||||
behind a firewall) and open `http://<vpn-ip>:8317` on the phone.
|
||||
- **SSH tunnel** (desktop): `ssh -L 8317:localhost:8317 <server>`, then open
|
||||
<http://localhost:8317>.
|
||||
|
||||
Then use your phone browser's "Add to Home Screen" to get an app icon.
|
||||
|
||||
## Configuration
|
||||
|
||||
All settings are environment variables. With compose, put them in `.env`; `.env.example`
|
||||
documents each one.
|
||||
|
||||
| Variable | Default | What it does |
|
||||
|---|---|---|
|
||||
| `ELORASMUS_BIND` | `127.0.0.1` | Host interface the port is published on (compose only) |
|
||||
| `ELORASMUS_PORT` | `8317` | Host port (compose only) |
|
||||
| `AUTH_PASSWORD` | *(empty)* | Require a login with this password (min 8 chars). Empty = no login |
|
||||
| `SESSION_SECRET` | *(generated)* | Signs login cookies (min 32 chars). If empty, generated once and kept in the data volume |
|
||||
| `SESSION_DAYS` | `180` | How long a login lasts |
|
||||
| `COOKIE_SECURE` | `auto` | Secure cookie flag: `auto` (if the request was HTTPS), `true`, `false` |
|
||||
| `TRUST_PROXY` | `false` | Honour `X-Forwarded-For/-Proto/-Host` from a reverse proxy |
|
||||
| `BASE_PATH` | `/` | Serve under a sub-path, e.g. `/elorasmus/` |
|
||||
| `APP_TITLE` | `Elorasmus` | Name shown in the header and the browser tab |
|
||||
| `STAY_MONTHS` | `5` | Default stay length for cost totals (changeable in the app) |
|
||||
| `ELO_INITIAL` | `1500` | Starting rating |
|
||||
| `ELO_K_MAX` / `ELO_K_MIN` | `48` / `16` | K-factor for a school's first games, decaying to the minimum over 15 games |
|
||||
| `EUR_CZK` | *(from data)* | Override the EUR→CZK rate for the CZK display |
|
||||
| `LOG_REQUESTS` | `false` | One log line per request (no cookies or bodies) |
|
||||
| `HOST`, `PORT`, `DATA_DIR` | `127.0.0.1`, `8317`, `./var` | Only when running without a container (the image sets `0.0.0.0`, `8317`, `/data`) |
|
||||
|
||||
## Using it
|
||||
|
||||
- **Compare**: the main screen. Two schools, a row-by-row comparison (the better value is
|
||||
tinted in that school's colour), highlights and red flags, then **A**, **=** (too close to
|
||||
call) or **B**. *Skip* shows another pair; *Undo* reverts the last action. Tap a school for
|
||||
everything known about it. On a keyboard: ←/→ pick, ↓ tie, space skip, z undo.
|
||||
- **Triage**: an optional quick pass through all schools (Keep / Drop). Schools with obvious
|
||||
problems come first: a language you don't speak, an unrelated subject area, or an unsafe
|
||||
country.
|
||||
- **Ranking**: your Elo leaderboard with search, region and agreement filters, and other sort
|
||||
orders (research quality, cheapest, nature). Dropped schools can be restored.
|
||||
- **Settings**: stay length, EUR/CZK, the Erasmus+ fewer-opportunities top-up, host
|
||||
scholarships, your languages, theme, and backup export/import.
|
||||
|
||||
How the pairs are chosen: rarely compared schools come first, then close contests between
|
||||
similarly rated schools, plus 10% random pairs so nothing gets stuck. That gets a usable top 10
|
||||
with far fewer picks than random pairs would need. A school's first picks move its rating a lot
|
||||
(K=48), later ones fine-tune it (K→16).
|
||||
|
||||
## About the data
|
||||
|
||||
- **Catalogue**: `data/catalog.json`, parsed from a saved copy of the CTU Mobility catalogue
|
||||
(FEL, Master, 2027/28): 186 agreements at 170 schools.
|
||||
- **Research**: one file per school in `research/raw/schools/`, written to the contract in
|
||||
`research/BRIEF.md` (scoring anchors, sources, confidence) and checked by
|
||||
`scripts/validate_research.py`. Country-level stability, visas and Czech MFA advisories are
|
||||
in `research/raw/countries.json`; grants, exchange rate and selection rules are in
|
||||
`research/raw/funding.json`.
|
||||
- **Money from CTU**: Erasmus+ uses the latest published Czech rates (2026/27: €660, €600 or
|
||||
€540 per month by country group; 2027/28 is not published yet). Non-European agreements use
|
||||
CTU's stipend (15,000 CZK/month for the USA, Canada, Australia and Argentina, 13,000 CZK
|
||||
elsewhere). Switzerland depends on a Swiss parliament vote in December 2026.
|
||||
- Everything was gathered from public web sources in November 2026 and **can be wrong or out of
|
||||
date**. Every section shows its sources and a confidence level. Check money, language rules
|
||||
and deadlines with the FEL international office before you apply.
|
||||
|
||||
Rebuild the app's data after changing research:
|
||||
|
||||
```sh
|
||||
python3 -I scripts/validate_research.py # structural checks
|
||||
python3 -I scripts/build_data.py # -> public/data/schools.json
|
||||
```
|
||||
|
||||
## Backups
|
||||
|
||||
*Settings → Export backup* downloads everything (picks, notes, settings) as JSON, and *Import*
|
||||
restores it (the server first keeps a copy in `DATA_DIR/backups/`). Server-side state is plain
|
||||
files in the volume: `events.jsonl` (the pick log), `notes.json` and `settings.json`.
|
||||
|
||||
## Development
|
||||
|
||||
No npm dependencies: the server uses only Node's standard library, and the front end is plain
|
||||
ES modules.
|
||||
|
||||
```sh
|
||||
npm test # Node >= 22, or without Node installed:
|
||||
podman run --rm -v "$PWD":/app:Z,ro -w /app docker.io/library/node:26.13.0-alpine3.24 node --test test/
|
||||
node server/index.js # http://127.0.0.1:8317, data in ./var
|
||||
```
|
||||
|
||||
```
|
||||
server/ HTTP server, config (env), auth, event store, static files
|
||||
public/ the app: index.html, css/, js/ (elo.js, pairing.js, metrics.js are pure + tested), views/
|
||||
data/ parsed CTU catalogue
|
||||
research/ brief, per-region assignments, raw research files
|
||||
scripts/ parse_catalog.py, validate_research.py, build_data.py, make_icons.py
|
||||
test/ node:test suites (logic + HTTP API)
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue