Docker compose project to help you get started (batteries included)

Heyo! I’d thought I’d share a basic docker-compose project that you can use to easily get started with the EC :grin: This makes starting/running the engine and a bot much easier (no need to install anything besides docker), and then you don’t need to constantly rebuild your image etc. To get started, make sure you have docker installed, and start the stack (inside the directory of the repo I linked at the bottom of the post):

docker compose up -d

This will build and start a bot and a runner (engine) container. You can then enter the bot and runner containers (in two separate terminals):

docker compose exec bot bash # (term 1)
docker compose exec runner bash # (term 2)

From there, you can start the engine (from inside the runner container):

root@cfe1817f8e32:/runner# make
dotnet /app/Sproutopia.dll
SignalR Config: http://127.0.0.1:5000/runnerhub
2024-04-11T07:56:46.9564947+00:00 Error Runner.Services.CloudIntegrationService - Failed to make cloud callback with error: "An invalid request URI was provided. Either the request URI must be an absolute URI or BaseAddress must be set."
2024-04-11T07:56:46.9656535+00:00 Information  - Running Sproutopia
...

And then inside your bot container

root@a0ee818bb19e:/app# python3 main.py
2024-04-11 08:58:30,522 - SignalRCoreClient - DEBUG - Handler registered started Disconnect
2024-04-11 08:58:30,522 - SignalRCoreClient - DEBUG - Handler registered started Registered
2024-04-11 08:58:30,522 - SignalRCoreClient - DEBUG - Handler registered started ReceiveBotState
Starting connection...
2024-04-11 08:58:30,522 - SignalRCoreClient - DEBUG - Connection started
2024-04-11 08:58:30,522 - SignalRCoreClient - DEBUG - Negotiate url:http://runner:5000/runnerhub/negotiate
2024-04-11 08:58:30,572 - SignalRCoreClient - DEBUG - Response status code200
...

That’s it! You should be able to swap out the bot directory with any of the other starter bots if you want (currently it’s the python bot with a small fix to the registration code, and an updated python base image). Also, the bot directory is bind-mounted in so you can just make your changes in your editor, and they’ll be available inside your bot container (no rebuild required). Additionally, you can modify your runner/appsettings.json file to change the engine’s settings (original file) - the runner container might need a restart after changing that file (docker file bind mounts are a bit weird). I’ve already modified it to only play with 1 player so that you don’t need to spawn 4 bots every time. Also also, if the EC team releases a new engine version, just update the ARG TAG=v2024.0.1 line inside the runner’s Dockerfile and rebuild it (docker compose build runner) to pull in the latest release. Good luck!

PS this doesn’t run the visualiser for you, however the runner container is portmapped to 127.0.0.1:5000 , so you can run the visualiser with the steps the EC team provides and it should be able to connect to localhost:5000 (haven’t tried this as I’m not using the visualiser for now)

EDIT: forgot to actually upload the project :sweat_smile: Link here: GitHub - kobus-v-schoor/2024-ec-starter

5 Likes