3
0
Agent-Template/docker-compose.yml

77 lines
3.4 KiB
YAML

services:
management:
# select the correct one base on platform this is running on
image: git.chai.uni-hamburg.de/ums-agenten/management:arm64
#image: git.chai.uni-hamburg.de/ums-agenten/management:amd64
ports:
# external (to host) http port
# open: http://localhost:8080/ !
- 8080:80
environment:
# limit number of trials for solving a riddle
- SOLUTION_MAX_TRIALS=5
# how to access management (the host name is the name of the service in this file)
- MANAGEMENT_URL=http://management
# *register* the agents to the management
- AGENTS_PROCESS=http://agent_extract_1:8000,http://agent_extract_2:8000
- AGENTS_SOLVE=http://agent_solve:8000
- AGENTS_GATEKEEPER=http://agent_gatekeeper:8000
volumes:
# all data is bind-mounted from ./data on the host into the containers
# the folder *share* is shared with all agents, it can be used to pass the data via files
- ./data/share/:/ums-agenten/share/
# the folder *persist* is different for each container and is used to store data permanently
- ./data/persist-management/:/ums-agenten/persist/
agent_solve:
# this allow to do installs etc. in the docker image (a new image will be built on top of the provided one)
build:
context: ./agent-solve
dockerfile: Dockerfile
args:
# select the correct one base on platform this is running on
- IMAGE_FROM=git.chai.uni-hamburg.de/ums-agenten/base-agent:cpu-arm64
#- IMAGE_FROM=git.chai.uni-hamburg.de/ums-agenten/base-agent:cpu-amd64
#- IMAGE_FROM=git.chai.uni-hamburg.de/ums-agenten/base-agent:gpu-amd64
ports:
# this port is only for access from the host, the management can always use 8000
- 8081:8000
environment:
# python package:variable_name of the list of agents implemeted here
- AGENTS_LIST=src.agent:AGENT_CLASSES
# tell the agent where the management is accessible
- MANAGEMENT_URL=http://management
volumes:
- ./data/share/:/ums-agenten/share/
- ./data/persist-solve/:/ums-agenten/persist/
# this is for development (s.t. the changes in ./src/ are directly applied)
- ./agent-solve/src/:/ums-agenten/project/src/:ro
# for development: will detect file changes and reload server with new source
entrypoint: bash -c "SERVE=true uvicorn ums.agent.main:app --host 0.0.0.0 --port 8000 --reload --reload-dir /ums-agenten/project/src/"
networks:
# this is a trick: we add multiple host names to the same container
# later, each agent will get its own container, but for testing, by this
# one container can become *all* agents
default:
aliases:
- agent_extract_2
- agent_gatekeeper
agent_extract_1:
build:
context: ./agent-extract
dockerfile: Dockerfile
args:
- IMAGE_FROM=git.chai.uni-hamburg.de/ums-agenten/base-agent:cpu-arm64
#- IMAGE_FROM=git.chai.uni-hamburg.de/ums-agenten/base-agent:cpu-amd64
#- IMAGE_FROM=git.chai.uni-hamburg.de/ums-agenten/base-agent:gpu-amd64
ports:
- 8082:8000
environment:
- AGENTS_LIST=src.agent:AGENT_CLASSES
- MANAGEMENT_URL=http://management
volumes:
- ./data/share/:/ums-agenten/share/
- ./data/persist-extract/:/ums-agenten/persist/
- ./agent-extract/src/:/ums-agenten/project/src/:ro