The MTConnect C++ Agent can be easily built and run on most platforms using docker. The ubuntu and alpine docker files perform the same function and provide
-
ARG
CONAN_CPU_COUNT: number of cpus to use in the builddefault:
2 -
ARG
WITH_RUBY: include embedded ruby in the agentdefault:
True -
ARG
WITH_TESTS:trueto build and run testsdefault:
false -
Exposes port
5000for the agent.
/mtconnect/config: Configuration filesagent.cfgandDevices.xml/mtconnect/data: Data files forschemas,styles, andsimulator/mtconnect/log: Agent log files
cd docker/ubuntu
docker buildx build --platform="linux/arm64,linux/amd64" -t 'multi-arch/agent:latest' -f Dockerfile ../..
docker build -t 'mtcagent:latest' ../..
cd docker/ubuntu
docker buildx build --platform="linux/arm64,linux/amd64" -t 'multi-arch/mtcagent:latest' -f Dockerfile ../..
docker build -t 'mtcagent:latest' ../..
docker run --rm --name agent -it -p 5001:5000/tcp \
-v ./mtconnect/conf:/mtconnect/config \
-v ./mtconnect/log:/mtconnect/log \
mtcagent
Runs the agent using the configuration files in the ./mtconnect/conf directory and logs to the ./mtconnect/log. The configuration is mapped so it will persist between runs and allows for custom configuration of the container.
A special version of the agent is supplied as an example. The replicator duplicates another agent using the latest version of the MTConnect agent capabilities. Once can use this to take a legacy agent and provide a 2.2 compliant agent with additional protocols.
cd docker/replicator
docker build -t replicator:latest' -f Dockerfile ../..
docker run -it --rm -e SOURCE_URL=https://demo.mtconnect.org \
-p 5001:5000 -v ./mtconnect/log:/mtconnect/log replicator:latest
Runs the replicator exposing port 5001 mapped to port 5000 in the container. The environment variable SOURCE_URL resolves to the agent being replicated.