62 lines
2.3 KiB
YAML
62 lines
2.3 KiB
YAML
# Service deployment for the WAGO Modbus TCP simulator.
|
|
#
|
|
# docker compose up -d # start
|
|
# docker compose logs -f wago-sim
|
|
# docker compose down # graceful stop (SIGTERM -> clean shutdown)
|
|
#
|
|
# Node configuration: mount ./config and ./scenarios read-only and point
|
|
# WAGO_SIM_NODE at the desired node file. Host port 5020 by default —
|
|
# change to 502 if the bench master expects it and your host allows it.
|
|
|
|
services:
|
|
wago-sim:
|
|
build: .
|
|
image: wago-sim:latest
|
|
container_name: wago-sim
|
|
restart: unless-stopped
|
|
ports:
|
|
- "5020:502" # host:container — WAGO_SIM_PORT sets the inner port
|
|
environment:
|
|
WAGO_SIM_NODE: config/pump_node.yaml
|
|
WAGO_SIM_HOST: 0.0.0.0
|
|
WAGO_SIM_PORT: "502"
|
|
# Uncomment to trace every Modbus transaction in plain text:
|
|
# WAGO_SIM_VERBOSE: "1"
|
|
#
|
|
# Host network settings page (spec §15) — BOTH gates are needed:
|
|
# the flag plus this in-docker marker (the /.dockerenv file the
|
|
# runtime also creates is a supplementary signal only). The
|
|
# host-side agent (deploy/wago-sim-hostnet-agent.service) must be
|
|
# running on the host and its socket mounted below — otherwise
|
|
# the page shows "host control unavailable" and mutations 503.
|
|
# WAGO_SIM_HOSTNET: "1"
|
|
WAGO_SIM_IN_DOCKER: "1"
|
|
volumes:
|
|
- ./config:/app/config:ro
|
|
- ./scenarios:/app/scenarios:ro
|
|
- ./plugins:/app/plugins:ro
|
|
# Report output for headless `run` invocations (spec §8 soak reports):
|
|
- ./out:/app/out
|
|
# Host network settings (spec §15): the agent's Unix socket from
|
|
# the host, so the container never needs host privileges. Uncomment
|
|
# together with WAGO_SIM_HOSTNET above; group_add below must match
|
|
# the socket's group on the host.
|
|
# - /run/wago-sim:/run/wago-sim
|
|
# Deterministic sim is CPU-light; keep 1 CPU for a stable FAT bench
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: "1.0"
|
|
memory: 256M
|
|
healthcheck:
|
|
test: ["CMD", "python", "-c",
|
|
"import socket,os;socket.create_connection(('127.0.0.1',int(os.environ['WAGO_SIM_PORT'])),timeout=3).close()"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 5s
|
|
logging:
|
|
driver: json-file
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3" |