Docker & Docker Compose Deployment

Deploy Mir using Docker for containerized environments with flexible configuration options.

Prerequisites

Docker Compose Deployment

The Compose comes with a full production setup:

  • Mir: IoT Hub core service
  • NATS: Message broker for inter-service communication
  • InfluxDB: Time-series database for telemetry data
  • SurrealDB: General database for device metadata
  • Prometheus Stack: Monitoring and observability
    • Prometheus
    • Grafana
    • Loki
    • Promtail
    • Alertmanager

Quick Start

The easiest way to get started is to download the pre-configured Docker Compose files from the latest Mir release:

# Extract
tar -vxf mir-compose.tar.gz

# Start the complete Mir stack
cd mir-compose/local-mir-support/
docker compose up -d

# Access the server using the CLI on localhost
mir tools config edit
# contexts:
#  - name: local
#    target: nats://localhost:4222
#    grafana: localhost:3000
mir ctx local

# Use
mir dev ls

## Stopping
docker compose down

## To stop and remove all data
docker compose down -v

# View logs
docker compose logs mir -f

Configuration

The .env file in local_mir_support/ contains the Mir version. You can modify other settings in the individual compose files as needed.

  • ls -la to see hidden files

Environment Variables

Configure Mir using environment variables with the MIR__ prefix:

VariableDescriptionDefault
MIR__NATS__URLNATS server URLnats://localhost:4222
MIR__NATS__TIMEOUTConnection timeout5s
MIR__SURREAL__URLSurrealDB WebSocket URLws://localhost:8000
MIR__SURREAL__USERSurrealDB usernameroot
MIR__SURREAL__PASSWORDSurrealDB passwordroot
MIR__SURREAL__NAMESPACESurrealDB namespaceglobal
MIR__SURREAL__DATABASESurrealDB databasemir
MIR__INFLUX__URLInfluxDB HTTP URLhttp://localhost:8086
MIR__INFLUX__TOKENInfluxDB auth token-
MIR__INFLUX__ORGInfluxDB organizationMir
MIR__INFLUX__BUCKETInfluxDB bucketmir
MIR__LOG_LEVELLogging levelinfo
MIR__PORTHTTP server port3015

Configuration File

Mount a configuration file for advanced settings

Modify mir-compose/mir/local-config.yaml

mir:
  url: "nats://local_mir_support-nats-1:4222"
  logLevel: "info"
  httpPort: 3015
surreal:
  url: "ws://local_mir_support-surrealdb-1:8000/rpc"
  namespace: "global"
  database: "mir"
  user: "root"
  password: "root"
influx:
  url: "http://local_mir_support-influxdb-1:8086/"
  token: "mir-operator-token"
  org: "Mir"
  bucket: "mir"
  batchSize: 1000
  flushInterval: 1000
  retryBufferLimit: 1073741824
  gzip: false

Operating

Port Exposures

# Grafana       <user>///<password>
localhost:3000 # admin///mir-operator
# InfluxDB
localhost:8086 # admin///mir-operator
# SurrealDB
localhost:8000 # root///root
# Prometheus
localhost:9090
# NatsIO
localhost:8222

View Logs

# in mir-compose/local-mir-support/
# View Mir logs
docker compose logs mir

# Follow logs in real-time
docker compose logs -f mir

Multi-Architecture Support

Mir Docker images support multiple architectures:

  • linux/amd64: Intel/AMD 64-bit
  • linux/arm64: ARM 64-bit
  • linux/arm32: ARM 32-bit

Docker automatically selects the appropriate architecture.

Security

Securing the environment is done via the NSC tool. Refer to Security Tutorial for details.

Next Steps

  • Configure devices to connect to your Mir instance
  • Set up monitoring dashboards in Grafana
  • Review Kubernetes deployment for production scale
  • Explore the Mir CLI for management