Skip to content

Commit

Permalink
Docs for running docker-compose locally with SDK and server (#3390)
Browse files Browse the repository at this point in the history
* Docs for running docker-compose locally with SDK and server

* Changes to doc based on PR #3390 review

* Add docker compose link to readme
  • Loading branch information
mbychkowski committed Sep 29, 2023
1 parent 6869882 commit 56c87de
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions site/content/en/docs/Guides/Client SDKs/local.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ Once you have your game server process in a container, you may also want to test
Since the production agones-sdk binary has the `--local` mode built in, you can also use the production container image
locally as well!

Since the SDK and your game server container need to share a port on `localhost`, one of the easiest ways to do that
Since the SDK and your game server container need to share a port on `localhost`, one of the easiest ways to do that
is to have them both run using the host network, like so:

In one shell run:
Expand All @@ -148,8 +148,8 @@ Then in another shell, start your game server container:
docker run --network=host --rm <your image here>
```

If you want to [mount a custom `gameserver.yaml`](#providing-your-own-gameserver-configuration-for-local-development),
this is also possible:
If you want to [mount a custom `gameserver.yaml`](#providing-your-own-gameserver-configuration-for-local-development),
this is also possible:

```bash
wget https://raw.githubusercontent.com/googleforgames/agones/{{< release-branch >}}/examples/simple-game-server/gameserver.yaml
Expand All @@ -158,6 +158,34 @@ chmod o+r gameserver.yaml
docker run --network=host --rm -v $(pwd)/gameserver.yaml:/tmp/gameserver.yaml us-docker.pkg.dev/agones-images/release/agones-sdk:{{<release-version>}} --local -f /tmp/gameserver.yaml
```

If you run Docker on a OS that doesn't run Docker natively or in a VM, such as on Windows or macOS, you may want to to run the ClientSDK and your game server container together with [Docker Compose](https://docs.docker.com/compose/). To do so, create a `docker-compose.yaml` file setup with a network overlay shared between them:

```yaml
version: '3'
services:
gameserver:
build: . # <path to build context>
ports:
- "127.0.0.1:7777:7777/udp"

sdk-server:
image: "us-docker.pkg.dev/agones-images/release/agones-sdk:{{<release-version>}}"
command: --local -f /gs_config
network_mode: service:gameserver # <shared network between sdk and game server>
configs:
- gs_config

configs:
gs_config:
file: ./gameserver.yaml
```
Run `docker-compose`

```shell
docker-compose up --build
```

## Running from source code instead of prebuilt binary

If you wish to run from source rather than pre-built binaries, that is an available alternative.
Expand Down

0 comments on commit 56c87de

Please sign in to comment.