Skip to content

Performance & correctness oriented beursfuif implementation in rust

License

Notifications You must be signed in to change notification settings

BartWillems/rustfuif

Repository files navigation

Rustfuif

Rust

alt text

Fronted

Rustfuif is an open source stock market party implementation.

Concept

A stock market party is an event where the prices of the beverages rise and fall based upon demand.

All prices are updated on certain intervals. Sometimes there's a stock market crash, which causes all beverages to drop to their lowest possible price.

You can invite other players(bars/youth clubs) to join your stock market party. They will then have an influence on your prices, and you on theirs.

Features

  • automatic price updates(using websockets) based on demand
  • some nice graphs
  • history of purchases and prices
  • admin panel to see connected users, active games, total games, server status, ...
  • completely optional cache (can be toggled at runtime)

Development

docker-compose up

# cargo install cargo-watch
cargo watch -x run

Notable Crates

Configuration

Required Variable Description Example Default
API_HOST The hostname/ip address the rustfuif listens on 0.0.0.0 localhost
API_PORT The port the rustfuif listens on 80 8080
RUST_LOG loglevel for different crates rustfuif=info rustfuif=debug,actix_web=debug
DATABASE_URL URL to the database postgres://rustfuif:[email protected]/rustfuif ``
SESSION_PRIVATE_KEY secret used for cookies(minimum 32 characters) ...random_characters... ``
REDIS_URL Redis cache URL, this is unused if empty redis://redis ``
SENTRY_DSN Sentry error reporting middleware DSN https://[email protected]/0 ``
PRICE_UPDATE_INTERVAL Interval in seconds between price updates 120 120
OPENTELEMETRY_ENDPOINT OpenTelemetry agent endpoint jaeger:6831 127.0.0.1:6831

Observability

  • /metrics constains prometheus metrics
  • /health returns http 200
  • /stats shows the following live stats:
    • total handled requests
    • total server errors (http response code >= 500)
    • active websocket connections
    • active games
    • active db connections
    • idle db connections
  • more logging can be acquired by setting the RUST_LOG to a lower loglevel, eg:
    • RUST_LOG="actix_server=info,actix_web=trace,rustfuif=trace"
    • RUST_LOG="debug"
    • ...
  • jaeger tracing using:

Frontend Screenshots

Admin Panel

Admin Panel

Game Overview

Game Overview

Stats

Stats

Purchase Timeline

Timeline

Releases

No releases published

Packages

No packages published

Languages