Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs for running docker-compose locally with SDK and server #3390

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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