···1+# spindle architecture
2+3+Spindle is a small CI runner service. Here's a high level overview of how it operates:
4+5+* listens for [`sh.tangled.spindle.member`](/lexicons/spindle/member.json) and
6+[`sh.tangled.repo`](/lexicons/repo.json) records on the Jetstream.
7+* when a new repo record comes through (typically when you add a spindle to a
8+repo from the settings), spindle then resolves the underlying knot and
9+subscribes to repo events (see:
10+[`sh.tangled.pipeline`](/lexicons/pipeline.json)).
11+* the spindle engine then handles execution of the pipeline, with results and
12+logs beamed on the spindle event stream over wss
13+14+### the engine
15+16+At present, the only supported backend is Docker. Spindle executes each step in
17+the pipeline in a fresh container, with state persisted across steps within the
18+`/tangled/workspace` directory.
19+20+The base image for the container is constructed on the fly using
21+[Nixery](https://nixery.dev), which is handy for caching layers for frequently
22+used packages.
23+24+The pipeline manifest is [specified here](/docs/spindle/pipeline.md).
+43
docs/spindle/hosting.md
···0000000000000000000000000000000000000000000
···1+# spindle self-hosting guide
2+3+## prerequisites
4+5+* Go
6+* Docker (the only supported backend currently)
7+8+## configuration
9+10+Spindle is configured using environment variables. The following environment variables are available:
11+12+* `SPINDLE_SERVER_LISTEN_ADDR`: The address the server listens on (default: `"0.0.0.0:6555"`).
13+* `SPINDLE_SERVER_DB_PATH`: The path to the SQLite database file (default: `"spindle.db"`).
14+* `SPINDLE_SERVER_HOSTNAME`: The hostname of the server (required).
15+* `SPINDLE_SERVER_JETSTREAM_ENDPOINT`: The endpoint of the Jetstream server (default: `"wss://jetstream1.us-west.bsky.network/subscribe"`).
16+* `SPINDLE_SERVER_DEV`: A boolean indicating whether the server is running in development mode (default: `false`).
17+* `SPINDLE_SERVER_OWNER`: The DID of the owner (required).
18+* `SPINDLE_PIPELINES_NIXERY`: The Nixery URL (default: `"nixery.tangled.sh"`).
19+* `SPINDLE_PIPELINES_WORKFLOW_TIMEOUT`: The default workflow timeout (default: `"5m"`).
20+* `SPINDLE_PIPELINES_LOG_DIR`: The directory to store workflow logs (default: `"/var/log/spindle"`).
21+22+## running spindle
23+24+1. **Set the environment variables.** For example:
25+26+ ```shell
27+ export SPINDLE_SERVER_HOSTNAME="your-hostname"
28+ export SPINDLE_SERVER_OWNER="your-did"
29+ ```
30+31+2. **Build the Spindle binary.**
32+33+ ```shell
34+ go build -o spindle core/spindle/server.go
35+ ```
36+37+3. **Run the Spindle binary.**
38+39+ ```shell
40+ ./spindle
41+ ```
42+43+Spindle will now start, connect to the Jetstream server, and begin processing pipelines.