Improved documentation
Some checks are pending
build / build (push) Waiting to run
build / clippy (push) Waiting to run
documentation / documentation (push) Waiting to run
documentation / notification (push) Blocked by required conditions
lint / linting (push) Waiting to run

Added a few words about compiling Iocaine, added a docker example with a
TOML configuration file (vs the existing environment variable-based
example), and collected a mistake describing the shape of
`IOCAINE__SOURCES__MARKOV`.

These together should largely address #2.

Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
This commit is contained in:
Gergely Nagy 2025-01-29 01:14:58 +01:00
parent ae8b06a4d5
commit f486b99984
No known key found for this signature in database
4 changed files with 32 additions and 1 deletions

14
data/compose-toml.yaml Normal file
View file

@ -0,0 +1,14 @@
# SPDX-FileCopyrightText: 2025 Gergely Nagy
# SPDX-FileContributor: Gergely Nagy
#
# SPDX-License-Identifier: MIT
services:
iocaine:
image: git.madhouse-project.org/algernon/iocaine:latest
restart: unless-stopped
ports:
- '127.0.0.1:42069:42069'
volumes:
- ./container-volume:/data
- ./etc:/etc/iocaine
command: --config-file /etc/iocaine/config.toml

11
data/etc/config.toml Normal file
View file

@ -0,0 +1,11 @@
# SPDX-FileCopyrightText: 2025 Gergely Nagy
# SPDX-FileContributor: Gergely Nagy
#
# SPDX-License-Identifier: MIT
[server]
bind = "0.0.0.0:42069"
[sources]
words = "/data/wordlist.txt"
markov = ["/data/training-text.txt"]

View file

@ -33,7 +33,7 @@ The first option, `words`, refers to a word list file, with one word per line. W
The second option, `markov`, is a list of files used to train the markov chain generator. These will be used to generate the main content.
These parameters are available as `IOCAINE__SOURCES__WORDS` and `IOCAINE__SOURCES__MARKOV`, respectively, when configuring via environment variables. Do note that if configuring `iocaine` this way, the `IOCAINE__SOURCES__MARKOV` environment variable *must* be a TOML list: `IOCAINE__SOURCES__MARKOV='["/var/lib/iocaine/markov/bee-movie.txt"]'`.
These parameters are available as `IOCAINE__SOURCES__WORDS` and `IOCAINE__SOURCES__MARKOV`, respectively, when configuring via environment variables. Do note that if configuring `iocaine` this way, the `IOCAINE__SOURCES__MARKOV` environment variable *must* be a TOML list: `IOCAINE__SOURCES__MARKOV=["/var/lib/iocaine/markov/bee-movie.txt"]`.
# `[generator]`

View file

@ -5,6 +5,10 @@ description: Deploying iocaine
How to deploy `iocaine` highly depends on what kind of system you're using. Below, you will find examples for deploying with `systemd`, without it, with `docker`, and on NixOS, using the module this repository's flake provides. This section deals with deployment, configuration is documented [elsewhere](@/configuration/index.md), and so is configuring the reverse proxy ([nginx](@/deploying/nginx.md) or [Caddy](@/deploying/caddy.md)).
# Compiling `iocaine`
Unless deploying via Docker, or using NixOS, you will need to compile it first, no binaries are provided at this time. `iocaine` is written in [Rust](https://www.rust-lang.org/), compiling it is just a `cargo build -r` away, assuming you have Rust installed. See their [getting started](https://www.rust-lang.org/learn/get-started) guide to get there. Once compiled, the binary will be located in `target/release/iocaine`, you can copy it wherever it is convenient for you.
# Deploying with `systemd`
See <code>[data/iocaine.service](https://git.madhouse-project.org/algernon/iocaine/src/branch/main/data/iocaine.service)</code> for a systemd service template. To use it, install `iocaine` somewhere, and copy the service file to `/etc/systemd/system/`, and edit it so it references the binary you installed, and the configuration file you prepared.
@ -47,6 +51,8 @@ docker compose up -d
Voila!
If you wish to change the configuration, you can either do so via environment variables, or you can remove those from the compose file, and supply your own, TOML-based configuration file, as shown in <code>[data/compose-toml.yaml](https://git.madhouse-project.org/algernon/iocaine/src/branch/main/data/compose-toml.yaml)</code>.
# Deploying on NixOS
Deploying under NixOS is made simple by using the nixosModule provided by this repository's flake. It takes care of setting up the `systemd` service, sufficiently hardened, so all that is required of you is to enable the service, and configure the sources.