googleforgames / agones

Dedicated Game Server Hosting and Scaling for Multiplayer Games on Kubernetes
https://agones.dev
Apache License 2.0
6.09k stars 812 forks source link

The local mode of the agon sidecar listen to localhost only #62

Closed cyriltovena closed 6 years ago

cyriltovena commented 6 years ago

When a game developer want to test his build locally, he has to build the sidecar via go and run it locally on the machine so it listen to localhost.

But we could just allow to change the listen address when we are in --local mode or listen on any address.

If so developer could just use :

docker run -p 59357:59357/tcp gcr.io/agon-images/gameservers-sidecar --local

And start testing their SDK integration.

/cc @markmandel

markmandel commented 6 years ago

I'm not sure I 100% follow this ticket.

Long term, a developer won't need to build the sidecar - there will be a binary download (Linux, OSX, Windows) - so that won't be a blocker for a developer.

This is already a build artifact of make build (or at least it should be). They should be found in agon/gameservers/sidecar/bin.

I figured this would be best, as then developers don't need much other than to run the binary itself - rather than worrying about Docker tooling.

I'm not sure if that answers the question or the issue?

markmandel commented 6 years ago

Or is this a feature request, being able to specify the address the sidecar is attached to? i.e. it would be nice to not be bound to connections from localhost?

markmandel commented 6 years ago

(Whoops, wrong button)

cyriltovena commented 6 years ago

This is already a build artifact of make build (or at least it should be). They should be found in agon/gameservers/sidecar/bin.

Well to get the artifact, as of today, they need the whole tooling installed properly (WSL, Docker, bindmount, etc)

Also it's easier to versioned and share docker component but yes, I didn't know you where planing in the long term to allow pre-built package.

My Idea was since there no pre-built package we could use the docker image, but then the current image listen to only localhost so we would need to change that.

If you want to stick with binary download, let's close.

cyriltovena commented 6 years ago

Also the title was wrong 😞

markmandel commented 6 years ago

I don't think I do that right now, but yes - for each release (and build as part of the CI system), you should be able to download the sidecar binary for that build - once this is a public system, it will be hosted on Google Cloud Storage as a downloadable artifact for each release, and test build.

That being said, there is nothing to stop you running the docker image you are building as the local version - and tell your developers to use this.

Doing a the docker run you showed above works (although I haven't tested actually connecting to it)

Am I correct then that the issue is actually that we should add a --address option to the sidecar, so you can bind to 0.0.0.0 for example, and allow connections from anywhere, so if you WANT to run the sidecar in local mode in a container, then you can.

Is that what you are driving at?

cyriltovena commented 6 years ago

Yes correct ! And i've shared my images as you said ;).

markmandel commented 6 years ago

Got it! Okay cool - that should be relatively simple to do.

markmandel commented 6 years ago

Issue looks to be here: https://github.com/googleprivate/agon/blob/master/gameservers/sidecar/main.go#L64

Would need to add and bind a new "address" flag and env var, and default it to "localhost", and then replace the "localhost" value in that line with the address value.