Skip to main content

Docker Compose

Prerequisites

Confirm the following before deployment:

PrerequisiteDescription
Monitored middleware is readyMongoDB/MySQL/Redis/Kafka/Elasticsearch, etc.
Middleware account permissionsSee Deployment Overview. Basic MongoDB collection requires clusterMonitor; slow-query diagnostics also requires dbAdmin on the target database (the Ops Platform enables profiling for it). See Data Sources for a complete example
Resources4C/8G/100G+ disk

Observation scope: host resources, runtime metrics for the middleware above, microservice logs, MongoDB slow-query diagnostics, and alerts based on this data. Not observed: internal business data, such as worksheet content and user data.

Step 1: Choose the Installation Location

Do not mix with the manager directory

The private deployment manager exclusively owns and rewrites the /data/hap/script/ directory. If the Ops Platform ops.yaml and data volumes are placed in this directory, reinstall or overwrite installation may interfere with each other.

Place the Ops Platform in a separate directory, such as /data/hap/mdis/, and connect it to the target Docker network through the networks section. This allows access to system middleware through service names while isolating it from the installer directory. Cleanup, backup, and independent data disk mounting only need to operate on this directory, reducing the risk of mixing with product business database directories and accidental deletion.

First confirm the network name where product services run (usually script_default):

docker network ls

Step 2: Pull the Image (Offline Package)

docker pull nocoly/ops-allinone:1.5.7

Step 3: Create the Configuration File

mkdir -p /data/hap/mdis && cat > /data/hap/mdis/ops.yaml <<\EOF
x-ops-image: &ops_image nocoly/ops-allinone:1.5.7 # Shared by all services; ROLE distinguishes service roles

x-common-env: &common_env
TZ: "Asia/Shanghai"
ENV_OPS_TOKEN: "your-ops-access-token-change-me" # Access token; must be changed during first deployment
# ENV_OPS_SUB_PATH: /mdis # Set when reverse proxy uses a sub-path; remove for direct port access

# ⚠️ Monitored targets (MySQL/MongoDB/Redis/Kafka/Elasticsearch/Host/
# Flink) are not configured in this file. After deployment, add them
# in the "Data Sources" page, or download the YAML template for batch
# import (each entry is connection-tested during import). See below.

ENV_PROMETHEUS_SERVER: "http://ops-prometheus:9090"

# Alert subsystem (1.4.0)
ENV_OPS_MONGODB_URI: "mongodb://ops-mongo:27017" # Dedicated alert storage
ENV_MONGODB_COLLECTION_PREFIX: "mdis_"
ENV_ALERT_CRYPTO_KEY: "change-me-to-32-byte-secret" # Credential encryption key; must be changed to a random string

services:
gateway:
image: *ops_image
restart: always
ports:
- "48881:48881"
environment:
<<: *common_env
ROLE: gateway
depends_on:
- ops-prometheus
- ops-grafana
- ops-loki
- ops-tempo
- ops-alloy
- ops-mongo

ops-prometheus:
image: *ops_image
restart: always
volumes:
- ./volume/data/mdis/prometheus/:/data/mdis/prometheus/
environment:
<<: *common_env
ROLE: prometheus

ops-grafana:
image: *ops_image
restart: always
volumes:
- ./volume/data/mdis/grafana/:/data/mdis/grafana/
environment:
<<: *common_env
ROLE: grafana
GF_SECURITY_ALLOW_EMBEDDING: "true"
GF_AUTH_ANONYMOUS_ENABLED: "true"
GF_AUTH_ANONYMOUS_ORG_ROLE: Editor
GF_SECURITY_COOKIE_SAMESITE: lax
GF_USERS_DEFAULT_THEME: light

ops-loki:
image: *ops_image
restart: always
ports:
- "3100:3100" # Used by service-side log push; remove when colocated with the Ops Platform
volumes:
- ./volume/data/mdis/loki/:/data/mdis/loki/
environment:
ROLE: loki
ENV_LOKI_RETENTION: "720h" # Log retention, default 30 days
# Store logs in object storage (optional; local container file system is used if unset).
# endpoint must be resolvable from this container network. If self-hosted MinIO is not
# in the same network (for example, another stack or host deployment), use host IP +
# host mapped port. Do not use the other container name, otherwise no such host occurs.
# MinIO / US3 use path style (true); Tencent Cloud COS supports only virtual-hosted and must be false.
# ENV_S3_ENDPOINT: "http://192.168.1.12:9000"
# ENV_S3_BUCKET: "mdis-loki"
# ENV_S3_ACCESS_KEY: "your-access-key"
# ENV_S3_SECRET_KEY: "your-secret-key"
# ENV_S3_FORCE_PATH_STYLE: "true"

ops-tempo:
image: *ops_image
restart: always
volumes:
- ./volume/data/mdis/tempo/:/data/mdis/tempo/
environment:
ROLE: tempo
ENV_TEMPO_RETENTION: "720h" # Trace retention, default 30 days
# Note: standalone deployment does not provide tracing, so object storage is not configured here.
# Trace + object storage belongs to the cluster scenario. See the Kubernetes document.

ops-alloy:
image: *ops_image
restart: always
ports:
# Alloy OTLP receiving ports. Standalone deployment does not generate trace data
# (see prerequisites on this page). These ports are kept but usually unused;
# remove them if there is a port conflict.
- "4317:4317" # OTLP gRPC
- "4318:4318" # OTLP HTTP
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./volume/data/mdis/alloy/:/data/mdis/alloy/
environment:
ROLE: alloy
ENV_TEMPO_GRPC_URL: "http://ops-tempo:4317"
ENV_PROMETHEUS_REMOTE_WRITE_URL: "http://ops-prometheus:9090/prometheus/server/api/v1/write"
ENV_LOKI_PUSH_URL: "http://ops-loki:3100/loki/api/v1/push"

# Alert subsystem dedicated MongoDB (added in 1.4.0; stores rules/status/history/channels/data sources and is decoupled from monitored targets)
ops-mongo:
image: *ops_image
restart: always
environment:
ROLE: mongo
volumes:
- ./volume/data/mdis/mongo/:/data/mdis/mongo

agent:
image: *ops_image
restart: always
environment:
<<: *common_env
ROLE: agent

nodeagent:
image: *ops_image
restart: always
volumes:
- /:/host:ro,rslave
network_mode: host
pid: host
environment:
<<: *common_env
ROLE: nodeagent

# Reuse the network where microservices run, so service names such as sc can access monitored middleware.
# Set name to the actual microservice network name from docker network ls.
networks:
default:
external: true
name: script_default
EOF

Step 4: Start and Access

docker compose -f /data/hap/mdis/ops.yaml up -d # Start
docker compose -f /data/hap/mdis/ops.yaml down # Stop

Open http://<deployment-host-IP>:48881 in a browser. The login token is ENV_OPS_TOKEN in ops.yaml.

Step 5: Verification

After deployment, run the bundled end-to-end regression script to confirm the full path:

pip install playwright && playwright install chromium
python3 mdis_regression.py --base http://<host-IP>:48881 --token <ENV_OPS_TOKEN>

Exit code 0 means all checks passed. If there is a problem, first check the Collection Status column in the UI "Data Sources" page, and then see FAQs.


Next Steps

Register Monitored Targets

Unified entry point: UI "Data Sources" page. ops.yaml describes only the Ops Platform's own dependencies, not what to monitor.

Create data sources, change passwords, enable, and disable on the Data Sources page. Changes take effect immediately (within 30 seconds) without restarting any container.

Batch Import

When connecting multiple instances in batch, use "Batch Import" in the upper-right corner of the Data Sources page:

  1. Click "Download YAML Template". The template includes commented examples for each data source type
  2. Modify connection addresses for the current environment and upload it
  3. Click "Validate Only" first. It performs format validation and per-entry connection probing without writing data
  4. After confirmation, click "Import"

Import is idempotent by "type + name": entries with the same name are updated instead of created, and the same file can be imported repeatedly. When updating an existing entry, leaving the password empty means keeping the original password. Failed connection probes do not block import (configuration can be saved first and the service can start later), but the import result lists each abnormal entry.

Automation can call the API directly without using the page:

curl -X POST "http://<deployment-host-IP>:48881/api/alert/sources/import" \
-H "Content-Type: application/yaml" \
--data-binary @datasources.yaml

Connect Service Logs and Traces

  • Service logs: Structured service logs are pushed to the Ops Platform only after ENV_LOKI_URL is configured on the microservice side. For standalone deployment, set it to http://<Ops-Platform-host-IP>:3100. See Service Log Ingestion.
  • Container logs: Collected automatically after deployment; no configuration required.
  • Tracing: Intended for cluster deployment. Standalone deployment is not supported.

Additional Tasks

  • Node Exporter: Monitor servers outside this host
  • Object Storage: Retain logs for a longer time without being limited by local disk capacity
  • Features: Usage guide for resource monitoring, alerts, log search, and slow-query diagnostics