lavina/docs/running.md

2.1 KiB

Building & Running Lavina

Configuration

A server instance must be supplied with a configuration file to start up. The path to configuration is specified with a required CLI argument --config <path>.

Example configuration:

[telemetry]
# address for management and telemetry API
# should be kept private
listen_on = "127.0.0.1:8080"

[irc]
listen_on = "127.0.0.1:6667"
server_name = "irc.localhost"

[xmpp]
listen_on = "127.0.0.1:5222"
cert = "./certs/xmpp.pem"
key = "./certs/xmpp.key"
hostname = "localhost"

[storage]
db_path = "db.sqlite"

[tracing]
# otlp grpc endpoint
endpoint = "http://jaeger:4317"
service_name = "lavina"

With Docker Compose

Example docker-compose.yml file:

version: '3.0'

services:
  lavina:
    image: git.vilunov.me/lavina/lavina:0.0.1
    volumes:
      - './config/:/etc/lavina/'
      - './data/:/var/lib/lavina/'
    ports:
      - '5222:5222'  # xmpp
      - '6667:6667'  # irc non-tls
      - '127.0.0.1:1380:8080' # management http (private)
  # if you want to observe traces
  jaeger:
    image: "jaegertracing/all-in-one:1.56"
    ports:
      - "16686:16686" # web ui
      - "4317:4317"   # grpc ingest endpoint
    environment:
      - COLLECTOR_OTLP_ENABLED=true
      - SPAN_STORAGE_TYPE=memory

With Cargo

You can run it via cargo:

cargo run -- --config config.toml

Or you can build it and run manually:

cargo build --release
./target/release/lavina --config config.toml

Migrations

Prerequisites

Install sqlx-cli into ~/.local/bin:

cargo install --locked sqlx-cli

Steps

Migrations run on every application start. For manual run, use sqlx:

sqlx mig run \
    --source ./crates/lavina-core/migrations/ \
    --database-url sqlite://db.sqlite

To see current status:

sqlx mig info \
    --source ./crates/lavina-core/migrations/ \
    --database-url sqlite://db.sqlite

sqlx mig info outputs

0/installed first
1/installed msg author
2/installed created at for messages
3/installed dialogs
4/installed new challenges
5/pending message datetime