Coder Social home page Coder Social logo

kazu0716 / space-agon Goto Github PK

View Code? Open in Web Editor NEW

This project forked from googleforgames/space-agon

0.0 0.0 0.0 4.74 MB

An integration demo for Agones and Open Match. The original is https://github.com/laremere/space-agon

License: Apache License 2.0

Shell 4.56% Go 82.36% CSS 1.78% Makefile 5.12% HTML 2.70% Dockerfile 3.48%

space-agon's Introduction

The original work is Laremere/space-agon.

Space Agon

Space Agon is a integrated demo of Agones and Open Match.

Before Trying.

Be aware of billing charges for running the cluster.

Space Agon is intended to run on Google Kubernetes Engine (GKE) and has been tested with the configured cluster size.
Leaving the cluster running may incur your cost. You need to be responsible for the cost. (See pricings of GKE, Cloud Build and Artifact Registry.)

Prerequisites

Create your Google Cloud Project.

Install tools in your dev environment:

Google Cloud Shell has all tools you need.

Create the Resources and Install Gaming OSS

Deploy them to Google Cloud

# Set Your Project ID before you run
$ export PROJECT_ID=<your project ID>

$ export LOCATION=us-central1
$ export ZONE=$LOCATION-a

$ export REPOSITORY=space-agon

$ gcloud services enable artifactregistry.googleapis.com \
                        container.googleapis.com

$ gcloud config set project $PROJECT_ID

$ gcloud config set compute/zone $ZONE

# Create cluster (using default network)
# Set NETWORK=<your network>, if you want to select the network
$ make gcloud-test-cluster

# Create Artifact Registry Repository
$ gcloud artifacts repositories create $REPOSITORY \
    --repository-format=docker \
    --location=$LOCATION 

# Assign roles to default service account
$ gcloud projects add-iam-policy-binding $PROJECT_ID \
    --member serviceAccount:$(gcloud iam service-accounts list \
    --filter="displayName:Compute Engine default service account" \
    --format="value(email)") \
    --role roles/artifactregistry.reader

# Login Artifact Registry
$ gcloud auth configure-docker $LOCATION-docker.pkg.dev

# Install Agones
$ make agones-install

# Install Open Match
$ make openmatch-install

Deploy them to local k8s cluster by minikube

# Start minikube
# ref: https://minikube.sigs.k8s.io/docs/commands/start/
$ minikube start --cpus="2" --memory="4096" --kubernetes-version=v1.23.14 --driv
er=hyperkit

# Install minimized Agones
$ make agones-install-local

# Install minimized Open Match
$ make openmatch-install-local

Deploy applications

Deploy them to Google Cloud

Make sure you installed docker to build and push images

# Build space-agon images
make build

# Apply space-agon images
make install

Deploy them to local k8s cluster by minikube

# Build space-agon images for minikube cluster
make build-local

# Apply space-agon images for minikube cluster
make install

View and Play

Get External IP from:

$ kubectl get service frontend

When you run space-agone in minikube, you should followings in another terminal:

$ minikube tunnel

Open http://<external ip>/ in your favorite web browser. You can use "find match" to start searching for a match.

Repeat in a second web browser window to create a second player, the players will be connected and can play each other.

Access GameServer

View Running Game Servers:

$ kubectl get gameserver

Then use the connect to server option with the value <ip>:<port>.

Clean Up

Delete the deployment

$ make uninstall

Uninstall Agones

# Deployed space-agone to Google Cloud
$ make agones-uninstall

# Deployed space-agone to minikube
$ make agones-uninstall-local

Uninstall Open-Match

# Deployed space-agone to Google Cloud
make openmatch-uninstall

# Deployed space-agone to minikube
$ make openmatch-uninstall-local

Delete your Google Cloud Project

$ gcloud projects delete $PROJECT_ID

Develop Applications

In case testing your original match making logics, skaffold can help you debug your applications.

Setup

  1. Create a space-agon k8s cluster.
  2. Install skaffold if you haven't.
  3. Run make skaffold-setup on the project root to make a skaffold.yaml

Now you're ready to run skaffold commands.

Debug

Once you create a skaffold.yaml, you can run skaffold commands.

You can check your own logic and debug.

# Build space-agon images with Cloud Build
$ skaffold build 

# Run Applicaitons in the space-agon cluster for debugging.
$ skaffold dev

Modifying applications during skaffold dev triggers Build and Deploy automatically. For more commands and details, visit skaffold.

Test the Cluster

When you would like to test the application, follow the steps below.

Google Cloud

  1. Install skaffold if you haven't.
  2. Create a space-agon k8s cluster.
  3. Run make skaffold-setup on the project root to make a skaffold.yaml
  4. Run below commands for integration test.
# Run you space-agon applications
$ skaffold dev

# Open another terminal and
# Run Test command
$ make integration-test

minikube

  1. Create a space-agon k8s cluster via minikube.
# Connect to service in minikube
$ minikube tunnel

# Open another terminal and
# Run Test command
$ make integration-test

LICENSE

This is Apache 2.0 License.

Note

This is not an officially supported Google product.

space-agon's People

Contributors

kemurayama avatar govargo avatar kazu0716 avatar shin5ok avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.