Agents connect via network using gRPC to DIAMBRA Engine running in a Docker container.
The diambra
CLI's run
command starts the DIAMBRA Engine in a Docker container and sets up the
environment to make it easy to connect to the Engine. For troubleshooting it might be useful to
run the Engine manually, using hostnetworking.
Creating the ~/.diambra and ~/.diambra/credentials is only needed when you never ran the diambra cli before. Otherwise this step can be skipped.
Linux/MacOS:
mkdir ~/.diambra
touch ~/.diambra/credentials
docker run -d --rm --name engine \
-v $HOME/.diambra/credentials:/tmp/.diambra/credentials \
-v /path/to/roms:/opt/diambraArena/roms \
--net=host docker.io/diambra/engine:latest
Windows (cmd):
mkdir %userprofile%/.diambra
echo > %userprofile%/.diambra/credentials
docker run --rm -ti --name engine ^
-v %userprofile%/.diambra/credentials:/tmp/.diambra/credentials ^
-v %userprofile%/.diambra/roms:/opt/diambraArena/roms ^
--net=host docker.io/diambra/engine:latest
Windows (PowerShell):
mkdir $Env:userprofile/.diambra
echo "" > $Env:userprofile/.diambra/credentials
docker run --rm -ti --name engine `
-v $Env:userprofile/.diambra/credentials:/tmp/.diambra/credentials `
-v $Env:userprofile/.diambra/roms:/opt/diambraArena/roms `
--net=host docker.io/diambra/engine:latest
Now in a new terminal, connect to the engine by specifying DIAMBRA_ENVS
:
DIAMBRA_ENVS=localhost:50051 python ./agent.py
You can download a sample agent
Since Docker for Windows/Mac involves running a separate VM requiring indirections in the networking layer that might cause issues, it can be helpful to connect to engine from a docker container.
Run Engine and spawn a shell:
$ diambra run <SHELLL>
Use e.g bash
for on Linux/Mac or cmd.exe
on Windows
Get engine container name:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
85cb47546d01 diambra/engine:latest "/bin/diambraEngineS…" 4 seconds ago Up 4 seconds 127.0.0.1:49157->50051/tcp clever_proskuriakova
Test grpc connection from linked container:
$ docker run --rm --link 85cb47546d01:engine fullstorydev/grpcurl -plaintext engine:50051 list
grpc.health.v1.Health
grpc.reflection.v1alpha.ServerReflection
interface.EnvServer