Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
# 5. pushes ghcr.io/<owner>/rylween:X.Y.Z and :latest, for linux/amd64 and linux/arm64,
# 6. commits X.Y.(Z+1)-SNAPSHOT as "Start X.Y.(Z+1)-SNAPSHOT", and pushes both commits to
# main together with the tag,
# 7. publishes the GitHub release vX.Y.Z with the zip and a compose.yaml that runs the image.
# 7. publishes the GitHub release vX.Y.Z with the zip, a compose.yaml that runs the image, and
# a compose.https.yaml that runs it behind Caddy and HTTPS.
# A dry run, which works from any branch, does all of that but push and publish, and keeps the
# zip and compose.yaml as workflow artifacts instead.
# zip and compose files as workflow artifacts instead.
#
# main takes only pull requests, so the release pushes over SSH with a deploy key, kept in the
# RELEASE_DEPLOY_KEY secret, that the "Require PRs and CI on main" ruleset lets bypass that.
Expand Down Expand Up @@ -217,8 +218,8 @@ jobs:
run: git push --atomic origin HEAD:refs/heads/main "refs/tags/v$RELEASE"

# The checked-in compose.yaml builds the image from a checkout. The release's copy pulls
# this release's image instead.
- name: Write the release's compose.yaml
# this release's image instead, and its compose.https.yaml pins that image too.
- name: Write the release's compose files
run: |
{
echo "# Adventurers of Rylween $RELEASE. \`docker compose up -d\` next to this file pulls"
Expand All @@ -228,6 +229,12 @@ jobs:
'.services.rylween.image = strenv(IMAGE) + ":" + strenv(RELEASE) | del(.services.rylween.build)' \
deploy/compose.yaml
} > "$DIST/compose.yaml"
{
echo "# Adventurers of Rylween $RELEASE over HTTPS: runs $IMAGE:$RELEASE behind Caddy."
echo "# Set RYLWEEN_DOMAIN in .env next to this file, then: docker compose -f compose.https.yaml up -d"
echo "#"
yq --indent 4 '.services.rylween.image = strenv(IMAGE) + ":" + strenv(RELEASE)' deploy/compose.https.yaml
} > "$DIST/compose.https.yaml"

- name: Publish the GitHub release
if: ${{ !inputs.dry-run }}
Expand All @@ -248,6 +255,13 @@ jobs:

Or download \`compose.yaml\` and run \`docker compose up -d\` next to it. Its header lists the settings.

## Host it on the internet over HTTPS

Download \`compose.https.yaml\`, set \`RYLWEEN_DOMAIN\` (and \`RYLWEEN_ADMIN_PASSWORD\`) in a \`.env\` file
next to it, and run \`docker compose -f compose.https.yaml up -d\`. Caddy gets the certificate from
Let's Encrypt. [deploy/README.md](https://github.com/lagergren/rylween/blob/v$RELEASE/deploy/README.md#on-the-internet-over-https)
covers what the host needs, from DNS and ports on.

## Play the ANSI game in a terminal

Download \`rylween-terminal-$RELEASE.zip\`, unzip it, and run \`rylween-terminal-$RELEASE/bin/rylween\`.
Expand All @@ -260,7 +274,8 @@ jobs:
--notes-file "$RUNNER_TEMP/notes.md" \
--generate-notes \
"$DIST/rylween-terminal-$RELEASE.zip" \
"$DIST/compose.yaml"
"$DIST/compose.yaml" \
"$DIST/compose.https.yaml"

- name: Keep the dry run's downloads
if: ${{ inputs.dry-run }}
Expand Down
61 changes: 23 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ style game for BBSes that I wrote in 1992-1993. The same game plays in two
ways: as the original ANSI version in a terminal, and as a repainted bitmap
version in the browser.

[Play it](#running-the-game) in a browser or a terminal, host it for others
with [`deploy/README.md`](deploy/README.md), change the game with the
[DSL authoring guide](docs/dsl-authoring.md), or start on the code at
[The Code](#the-code).

<p align="center">
<img src="docs/images/bitmap-thord.jpg" alt="The bitmap version in the town of Thord: a painting of the lamplit main street at night next to the town menu, in a carved bronze frame with torches, skulls, and a scorpion">
</p>
Expand Down Expand Up @@ -82,45 +87,21 @@ brew install --cask docker # or Docker Desktop; start i
./deploy.sh
```

This is the one command for hosting the game. `deploy.sh` is a link to
`deploy/deploy-rylween.sh`, so inside `deploy/` the same command is
`./deploy-rylween.sh`; either works from any directory. It builds the bitmap web
game's image and starts it with Docker Compose (Podman Compose when Docker is
missing), published on this machine's private LAN address, port 8081. After the
build output it waits until the server answers, then prints the address and the
commands for the sysop password, the server log, and stopping the server:

```text
Rylween is up on http://192.168.1.20:8081/
Sysop password: docker compose -f /path/to/rylween/deploy/compose.yaml exec rylween cat /data/auth/admin-password.txt
Server log: docker compose -f /path/to/rylween/deploy/compose.yaml logs -f rylween
Stop: docker compose -f /path/to/rylween/deploy/compose.yaml down
```

Open the address in a browser on any machine on the network and register an
account. The build runs inside the image, so the host needs only Docker or
Podman, not a JDK.
From a checkout, this builds the bitmap game's image, starts it with Docker
Compose (Podman Compose when Docker is missing) on this machine's LAN address,
port 8081, and waits until it answers. Then it prints the address to open on any
machine on the network, with the commands for the sysop password, the server
log, and stopping it. Saves and accounts survive rebuilds.

Run `./deploy.sh` again after pulling changes to rebuild and restart; a plain
`docker compose up` would publish on 127.0.0.1 only. Saves, accounts, and logs
live on the `rylween_data` volume and survive rebuilds; `down` stops the server
and keeps them.
### On The Internet, Over HTTPS

On first start the server creates the sysop account, `admin`, which gets the
game's secret wilderness keys. Unless `RYLWEEN_ADMIN_PASSWORD` is set, its
password is generated, and the `Sysop password` command prints it. From the
repository root (inside `deploy/`, leave out `-f deploy/compose.yaml`):

```sh
docker compose -f deploy/compose.yaml exec rylween cat /data/auth/admin-password.txt
```
On a machine with a public address and a domain name, `./deploy.sh --https`,
or `deploy/compose.https.yaml` on its own, runs the released game behind Caddy,
which gets a Let's Encrypt certificate for the name.

To change the port, the data location, or the accounts, copy
`deploy/.env.example` to `deploy/.env` and edit it.
[`deploy/docker/README.md`](deploy/docker/README.md) covers the settings,
backups, and the production images, and
[`runtimes/runtime-web/README.md`](runtimes/runtime-web/README.md#exposing-a-production-docker-deployment)
covers putting the game on the internet behind an HTTPS reverse proxy.
[`deploy/README.md`](deploy/README.md) covers all three ways: the settings,
data and backups, and the images, and, step by step, everything an HTTPS server
needs, from DNS and ports on.

### In A Terminal: `./bin/run.sh`

Expand All @@ -130,7 +111,11 @@ covers putting the game on the internet behind an HTTPS reverse proxy.

This builds the game and plays the ANSI version in the current terminal. It
needs JDK 23 or newer; Gradle downloads the JDK 25 toolchain the modules build
with if none is installed. Size the terminal to at least 80 columns by 25 rows.
with if none is installed. Without a checkout, download
`rylween-terminal-X.Y.Z.zip` from the
[latest release](https://github.com/lagergren/rylween/releases/latest), unzip
it, and run its `bin/rylween`, which takes the same options and needs Java 25
or newer. Size the terminal to at least 80 columns by 25 rows.
At the splash screen press RETURN, then `N` to create a party. Move with the
arrow keys or the keypad digits 8, 2, 4, and 6; press `?` in the wilderness for
the full list of commands, and `X` to quit. The save and logs go to
Expand Down Expand Up @@ -189,7 +174,7 @@ Module guides:
- [`support/audio`](support/audio) - Python scripts that synthesize the sound effects, music, and ambient loops.
- [`build-logic`](build-logic/README.md) - Gradle conventions and custom tasks.
- [`bin`](bin/README.md) - local developer/operator launcher scripts.
- [`deploy/docker`](deploy/docker/README.md) - Docker images, compose, the LAN deploy script, and reverse-proxy notes.
- [`deploy`](deploy/README.md) - running the game as a server: compose files, Docker images, the deploy script, and HTTPS.

The old interpreted Kotlin ANSI project and the historical C/JSON5 port are no
longer part of this repository. The original Amiga release is kept as described
Expand Down
11 changes: 8 additions & 3 deletions deploy/.env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# Example settings for `docker compose` / `podman compose`, described at the top
# of compose.yaml. Copy this file to .env (git-ignored) next to compose.yaml and
# uncomment what you change; commented lines show the defaults. Variables
# exported in the shell take precedence over .env.
# of compose.yaml and compose.https.yaml. Copy this file to .env (git-ignored)
# next to them and uncomment what you change; commented lines show the
# defaults. Variables exported in the shell take precedence over .env.

# For ./deploy.sh --https and compose.https.yaml only: the name players open,
# whose DNS points at this machine. compose.yaml ignores it. README.md here
# explains what HTTPS needs.
# RYLWEEN_DOMAIN=rylween.example.net

# Host address and port to publish on. The root ./deploy.sh detects this
# machine's LAN address unless .env sets the address; plain `docker compose up`
Expand Down
Loading
Loading