Skip to content

Commit

Permalink
Add next steps blurb
Browse files Browse the repository at this point in the history
  • Loading branch information
slartibaartfast committed Aug 16, 2018
1 parent c37ec58 commit 8291a50
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 39 deletions.
8 changes: 4 additions & 4 deletions docs/create_gameserver.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ For the purpose of this guide we're going to use the [simple-udp](../examples/si
Let's create a GameServer using the following command :

```
kubectl apply -f https://raw.githubusercontent.com/GoogleCloudPlatform/agones/master/examples/simple-udp/server/gameserver.yaml
kubectl apply -f https://raw.githubusercontent.com/GoogleCloudPlatform/agones/master/examples/simple-udp/gameserver.yaml
```

You should see a successful ouput similar to this :
Expand Down Expand Up @@ -147,12 +147,12 @@ simple-udp Ready 192.168.99.100 [map[name:default port:7614]]
Cloud Shell for your terminal, UDP is blocked. For this step, we recommend
SSH'ing into a running VM in your project, such as a Kubernetes node.
You can click the 'SSH' button on the [Google Compute Engine Instances](https://console.cloud.google.com/compute/instances)
page to do this.
page to do this.

You can now communicate with the Game Server :

> NOTE: if you do not have netcat installed
(i.e. you get a response of `nc: command not found`),
> NOTE: if you do not have netcat installed
(i.e. you get a response of `nc: command not found`),
you can install netcat by running `sudo apt install netcat`.

```
Expand Down
57 changes: 22 additions & 35 deletions docs/edit_first_game_server.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ The following guide is for developers without Docker or Kubernetes experience, t
2. Install Docker from https://www.docker.com/get-docker.
3. Install Agones on GKE or Minikube.

To install on GKE, follow the install instructions (if you haven't already) at [Install and configure Agones on Kubernetes](../install/README.md#setting-up-a-google-kubernetes-engine-gke-cluster). At least, you should have "Setting up a Google Kubernetes Engine (GKE) cluster", "Enabling creation of RBAC resources" and "Installing Agones" done.
To install on GKE, follow the install instructions (if you haven't already) at
[Setting up a Google Kubernetes Engine (GKE) cluster](../install/README.md#setting-up-a-google-kubernetes-engine-gke-cluster). Also complete the "Enabling creation of RBAC resources" and "Installing Agones" sets of instructions on the same page.

To install locally on Minikube, read [Developing, Testing, and Building Agones](../build/README.md) making sure to follow the instructions in the [Running A Test Minikube cluster](../build/README.md#running-a-test-minikube-cluster) section.
To install locally on Minikube, read [Setting up a Minikube cluster](../install/README.md#setting-up-a-minikube-cluster). Also complete the "Enabling creation of RBAC resources" and "Installing Agones" sets of instructions on the same page.

## Modify the code and push another new image

### Modify the source code
### Modify the simple-udp example source source code
Modify the main.go file. For example:

Change main.go line 92:
Expand All @@ -25,64 +26,48 @@ ack := "ACK: " + txt + "\n"

To:
```go
ack := "ACK: Hi," + txt + "\n"
ack := "ACK: Echo says " + txt + "\n"
```


### Build Server
Since Docker image is using Alpine Linux, the "go build" command has to include few more environment variables.

```bash
go get agones.dev/agones/pkg/sdk
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o bin/server -a -v main.go
>> go get agones.dev/agones/pkg/sdk
>> GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o bin/server -a -v main.go
```

## Using Docker File

### Create a new docker image
```bash
docker build -t gcr.io/[PROJECT_ID]/agones-udp-server:0.2 .
>> docker build -t gcr.io/[PROJECT_ID]/agones-udp-server:modified .
```

Note: you can change the image name "agones-udp-server" to something else.

### If using GKE, push the image to GCP Registry
```bash
docker push gcr.io/[PROJECT_ID]/agones-udp-server:0.2
>> docker push gcr.io/[PROJECT_ID]/agones-udp-server:modified
```

Note: Review [Authentication Methods](https://cloud.google.com/container-registry/docs/advanced-authentication)
for additional information regarding use of gcloud as a Docker credential helper
and advanced authentication methods to the Google Container Registry.

### If using Minikube, change directory to agones/build and push the image into Minikube
### If using Minikube, load the image into Minikube
```bash
cd ../../../build &&
make minikube-transfer-image TAG=[PROJECT_ID]/agones-udp-server:0.2
>> docker save gcr.io/[PROJECT_ID]/agones-udp-server:modified | (eval $(minikube docker-env) && docker load)
```
and then change directory back to simple-udp/server

```bash
cd ../examples/simple-udp/server
```

### For GKE, modify gameserver.yaml
### Modify gameserver.yaml
Modify the following line from gameserver.yaml to use the new configuration.

```
spec:
containers:
- name: agones-simple-udp
image: gcr.io/[PROJECT_ID]/agones-udp-server:0.2
```

### For Minikube local development, modify gameserver.yaml
Modify the following line from gameserver.yaml to use the new configuration.

```
spec:
containers:
- name: agones-simple-udp
image: gcr.io/[PROJECT_ID]/agones-udp-server:0.2
imagePullPolicy: Never
image: gcr.io/[PROJECT_ID]/agones-udp-server:modified
```

### If using GKE, deploy Server to GKE
Expand All @@ -106,9 +91,7 @@ Apply the latest settings to kubernetes container.
```

### Verify
Follow the instruction from this link: https://github.com/GoogleCloudPlatform/agones/blob/master/docs/create_gameserver.md.

Let's retrieve the IP address and the allocated port of your Game Server :
Let's retrieve the IP address and the allocated port of your Game Server:

```
kubectl get gs simple-udp -o jsonpath='{.status.address}:{.status.ports[0].port}'
Expand All @@ -122,11 +105,15 @@ You can now communicate with the Game Server :

```
nc -u {IP} {PORT}
Hello World !
ACK: Hello World !
Hello World!
ACK: Echo says Hello World!
EXIT
```

You can finally type `EXIT` which tells the SDK to run the [Shutdown command](../sdks#shutdown), and therefore shuts down the `GameServer`.

If you run `kubectl describe gameserver` again - either the GameServer will be gone completely, or it will be in `Shutdown` state, on the way to being deleted.

## Next Steps

If you want to perform rolling updates of modified game servers, see [Quickstart Create a Game Server Fleet](./create_fleet.md).

0 comments on commit 8291a50

Please sign in to comment.