Installation Methods
Choose the installation method that fits your environment:Docker (Recommended)
Quick setup with all dependencies included
Build from Source
Direct binary execution with cargo
Docker Installation
Docker Compose provides the fastest path to a working QIMEM deployment with Postgres persistence.Configure environment variables
.env with your configuration:.env
For stateless mode (in-memory storage), set
QIMEM_MODE=stateless and omit DATABASE_URL.Launch with Docker Compose
- Builds the Rust binaries with release optimizations
- Starts PostgreSQL 16 with health checks
- Runs
qimem-apiin stateful mode on port 8080 - Applies database migrations automatically
Docker Compose Services
Thedocker-compose.yml defines three services:
postgres
postgres
- Image:
postgres:16 - Port: 5432
- Database:
qimem - Health check:
pg_isreadyevery 5 seconds - Environment:
POSTGRES_USER=postgresPOSTGRES_PASSWORD=postgresPOSTGRES_DB=qimem
qimem-api
qimem-api
- Build: Multi-stage Dockerfile with Rust 1.82
- Port: 8080
- Mode: Stateful with Postgres backend
- Features:
--features stateful - Health check:
curl http://localhost:8080/healthevery 10 seconds - Dependencies: Waits for postgres to be healthy
devcontainer
devcontainer
- Purpose: Development environment with Rust toolchain
- Usage: Supports VS Code Remote Containers
- Command:
sleep infinity(keeps container running)
Build from Source
For development or environments without Docker:Cargo Build Options
Feature Flags
Feature Flags
stateful: Enables Postgres key store via SQLxchacha: Adds ChaCha20-Poly1305 algorithm support (optional)
Production Builds
Production Builds
Build optimized binaries:Binary location:Strip symbols for smaller size:
Environment Configuration
All QIMEM binaries read configuration from environment variables. Reference.env.example:
.env.example
Configuration Reference
Storage mode:
stateless (in-memory) or stateful (Postgres)Postgres connection string (required when
QIMEM_MODE=stateful)Format: postgres://user:password@host:port/databaseHTTP server bind addressExamples:
0.0.0.0:8080- Listen on all interfaces127.0.0.1:8080- Localhost only[::]:8080- IPv6 all interfaces
Logging level using
tracing crateLevels: error, warn, info, debug, traceModule-specific filtering:Production Deployment
Stateful Mode with Managed Postgres
Provision a managed Postgres instance
Use a managed service like AWS RDS, Google Cloud SQL, or Azure Database for PostgreSQL:
- PostgreSQL 14 or later
- Encrypted storage at rest
- Automated backups enabled
- SSL/TLS connections enforced
Security Hardening
Network Security
Network Security
- Deploy behind a reverse proxy (nginx, Envoy, Cloudflare)
- Enable TLS 1.3 with strong cipher suites
- Use firewall rules to restrict database access
- Implement rate limiting to prevent brute force
Key Material Protection
Key Material Protection
- QIMEM uses
zeroize::Zeroizingfor automatic memory cleanup - No key bytes are logged (enforced by
#![deny(unsafe_code)]) - Consider hardware security modules (HSMs) for master keys
- Rotate signing keys regularly via
/v1/auth/keys/rotate
Monitoring and Observability
Monitoring and Observability
Health endpoints:Integrate with metrics exporters (Prometheus, Datadog, etc.)
GET /health- Service livenessGET /ready- Readiness (DB connectivity)GET /v1/security/health- Security subsystem health
Container Orchestration
Health Checks
QIMEM provides multiple health check endpoints for different purposes:Basic liveness probeUse case: Kubernetes liveness probe, load balancer health check
Readiness probe with dependency checksUse case: Kubernetes readiness probe, confirms database connectivity in stateful mode
Security subsystem healthUse case: Monitoring security-specific components
Troubleshooting
Connection refused on port 8080
Connection refused on port 8080
Cause: Service not running or wrong bind addressSolution:
Database connection failed
Database connection failed
Cause: Invalid
DATABASE_URL or Postgres not readySolution:Build fails with stateful feature
Build fails with stateful feature
Cause: Missing SQLx dependencies or database not accessible during buildSolution:
Permission denied errors in Docker
Permission denied errors in Docker
Cause: Container runs as non-root user
qimem (UID 10001)Solution:
Ensure mounted volumes have correct permissions:Next Steps
Quickstart Guide
Try encryption and authentication examples
API Reference
Explore all available endpoints