Skip to main content

Prerequisites

You need the Rust toolchain installed before building.
  • Rust 1.88 or later (install via rustup)
  • cargo (bundled with the Rust toolchain)
Verify your installation:
rustc --version
cargo --version

Directory structure

The Hagaki binary resolves asset paths relative to its working directory. Before running, ensure the following directory structure exists alongside the binary:
/home/ubuntu/
├── hagaki/
│   └── target/release/hagaki   # compiled binary
└── asset/
    ├── private/
    │   ├── frame/               # card frame assets
    │   └── idol/                # character images
    └── public/
        └── render/              # rendered output (must be writable)
The paths the service expects:
PathPurpose
../asset/private/frameCard frame source files
../asset/private/idolCharacter image source files
../asset/public/renderRendered card output
If the asset directories are missing or the binary is run from an unexpected working directory, the service will fail to read assets and write renders.

Building

Clone the repository to /home/ubuntu/hagaki, then run:
make build
This runs cargo build --release and produces the optimized binary at:
target/release/hagaki

Running directly

To run the binary without installing it as a service:
RUST_LOG=trace ./target/release/hagaki
The service binds to 0.0.0.0:8899 and begins accepting requests immediately.

RUST_LOG environment variable

The RUST_LOG environment variable controls log verbosity. Set it before running the binary:
export RUST_LOG=info
./target/release/hagaki
Valid values, from most to least verbose:
ValueUse case
traceDeep debugging, high log volume
debugDevelopment and troubleshooting
infoStandard production output
warnWarnings and errors only
errorErrors only
Use RUST_LOG=trace when diagnosing rendering issues. Use RUST_LOG=info or RUST_LOG=warn in production to reduce I/O overhead.
The binary listens on 0.0.0.0:8899. This binds to all network interfaces, so Hagaki should be placed behind a reverse proxy rather than exposed directly to the internet. See the Nginx reverse proxy guide.

Build docs developers (and LLMs) love