Deployment
Deployment
This page shows three ways to run the broker. Use the binary to try it. Use the container to ship it. Use the service unit to keep it up. You get the same single process in each way.
flowchart LR Build["binary indramqtt"] -- "pack" --> Image["container image"] Image -- "run" --> Cont["docker compose"] Build -- "install" --> Unit["systemd unit"] Unit -- "serve" --> Same["one process :1883 + :18083"] Cont -- "serve" --> SameBefore you start
- Build the release binary or pull the image.
- Keep ports 1883 and 18083 free.
- Prepare a config directory with
indra.toml.
Binary
Build with the full feature to include all connectors. The container image includes them.
# Slow build. The example test does not run it. Run it once per release.cargo build --release -p broker-node --features full --bin indramqtt --bin indraValidate the config directory first. Then start the kernel.
# Runs until stopped. The example test starts the broker itself, so it does not run this block.indramqtt --config-dir /etc/indramqtt --check-configindramqtt --config-dir /etc/indramqttContainer
Build the image from the repository root. The image holds the kernel and the operator CLI. It runs one process.
# Slow build. The example test does not run it. See Dockerfile for the stages.docker build -t indramqtt/indramqtt:0.1.0 .Start the single-node stack with compose. It mounts the example file at deploy/compose/indra.toml.
# Needs Docker. The example test does not run it. See deploy/compose/README.md.docker compose up -d --buildcurl -sf http://localhost:18083/healthz[!NOTE] The image sets
node.data_dirto/var/lib/indramqtt/data. Mount a volume there to keep state across restarts. See Backup.
Service unit
Install the binary and the config directory on the host. The unit restarts the kernel on failure.
# Needs root. The example test does not run it. Adjust paths to your host.sudo install -m 0755 target/release/indramqtt /usr/local/bin/indramqttsudo mkdir -p /etc/indramqtt# /etc/systemd/system/indramqtt.service — example only, adjust User and paths.[Unit]Description=IndraMQTT brokerAfter=network-online.targetWants=network-online.target
[Service]User=indraExecStartPre=/usr/local/bin/indramqtt --config-dir /etc/indramqtt --check-configExecStart=/usr/local/bin/indramqtt --config-dir /etc/indramqttRestart=on-failureRestartSec=5
[Install]WantedBy=multi-user.targetEnable and start the unit. Then check the health endpoint.
# Needs systemd. The example test does not run it.sudo systemctl enable --now indramqttcurl -sf http://127.0.0.1:18083/healthzCheck that it works
Start the broker with this file. Validate the directory. The command prints ok.
[node]id = "docs-deployment"
[listeners.tcp]bind = "0.0.0.0:1883"
[listeners.api]bind = "0.0.0.0:18083"
[logging]level = "warn""${INDRAMQTT_BIN:-indramqtt}" --config-dir "${DOCS_CFG_DIR:-./docs-deployment}" --check-configokNext steps
- Size the host in Sizing.
- Back up state in Backup.
- Watch it in Monitoring.