lore-forge/README.md

106 lines
4.2 KiB
Markdown

# lore-forge
Accounts, sign-in, per-repository tokens and a self-hosted forge for Epic's
[Lore](https://github.com/EpicGames/lore) version control system.
lore-forge runs beside an unmodified `loreserver` as the OpenID Connect issuer it trusts. Lore
clients log in through lore-forge, which signs tokens scoped to one repository at a time from the
permissions it manages. Repository data still flows directly between Lore clients and
`loreserver`.
**Status:** early. `lore auth login`, repository create, push, clone and listing work end to end
against Lore 0.14. Provider sign-in, invites and the forge UI are still to come. The design is in
[.ai/designs/](.ai/designs/architecture-overview.md).
## Starting a deployment
This repository is all a deployment needs. You need Rust, `protoc`, `curl` and `tar`.
```sh
scripts/start.sh
```
On the first run it:
1. writes `run/deployment.env` with local defaults;
2. generates `run/secret.key`;
3. builds lore-forge;
4. downloads the Lore release pinned in `lore.lock` into `.lore/` and checks its SHA-256;
5. starts lore-forge and then `loreserver`, which it configures to trust lore-forge.
Then:
- Open <http://localhost:8080> and create the owner account.
- Sign in with the CLI, using the path the script prints:
```sh
.lore/v0.14.0/lore auth login lore://localhost:41337
.lore/v0.14.0/lore repository create lore://localhost:41337/<your-username>/my-game
```
Ctrl-C stops both servers. Later runs reuse everything in `run/`, which is git-ignored. Set
`LORE_FORGE_RUN_DIR` to keep it somewhere else.
| In `run/` | |
| --- | --- |
| `deployment.env` | Public URLs, listen address, TLS certificate for `loreserver`. Edit it before going beyond localhost |
| `secret.key` | Encrypts the token signing keys. Back it up **apart from** the rest; losing it invalidates every outstanding token |
| `forge-data/` | lore-forge's SQLite database |
| `lore-store/` | `loreserver`'s repository storage |
| `lore-config/` | The `loreserver` configuration, regenerated on every start |
| `logs/` | Both servers' logs |
| `downloads/` | Desktop client archives for `/download`, from `scripts/build-desktop-dist.sh` |
To serve other machines, set `PUBLIC_URL` to lore-forge's https URL. Behind a reverse proxy, the
proxy must pass HTTP/2 through so gRPC works. Also set `LORE_URL` and `LORE_REMOTE` to the host
clients use for Lore, and `LORE_TLS_CERT`/`LORE_TLS_KEY` to a real certificate. Without one,
`loreserver` makes a self-signed certificate on every start. `LORE_REMOTE` is also the remote
the pages tell people to use; make it `lores://`, since `lore://` neither checks the
certificate nor encrypts gRPC.
If a proxy in front ends TLS on TCP 41337 and forwards Lore's gRPC over a private link, set
`LORE_GRPC_TLS_AT_PROXY=1`: the certificate then serves only QUIC, whose TLS always ends at
`loreserver`, and gRPC stays plaintext behind the proxy.
`PUBLIC_URL` is the token issuer, so do not change it once people have logged in.
### Lore releases
`lore.lock` pins the Lore release and the SHA-256 of each archive. To fetch it on its own:
```sh
scripts/fetch-lore.sh
```
It prints the directory holding the binaries. Lore publishes binaries for macOS on Apple
silicon and for Linux on x86-64 and arm64. Elsewhere, build Lore from source and set
`LORE_BIN_DIR`.
To move to another release, run the e2e test before committing the new lock:
```sh
scripts/fetch-lore.sh --pin vX.Y.Z
```
On macOS the `lore` CLI keeps the key for its stored logins in the keychain. Each `lore` process
asks for it until you choose **Always Allow**.
## Desktop client
[desktop/](desktop/README.md) holds a tray application and the per-user service it talks to.
It builds with Zig and Cargo, separately from the server.
`scripts/build-desktop-dist.sh` cross-compiles it for Linux and Windows and packs an archive
for each into `run/downloads/`, which lore-forge offers to signed-in users at `/download`. Both
builds are experimental: neither window has yet been run on that platform.
## Testing
```sh
cargo test --workspace
scripts/e2e-lore.sh # against the pinned Lore release
SMOKE=1 scripts/e2e-lore.sh # one login, create and push only
```
Set `LORE_BIN_DIR` to test against another Lore build.