RoyalAfgInGo

module
Version: v0.0.0-...-2a6385f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2021 License: MIT

README

RoyalAfg - Online Casino

RoyalAfg is a online casino developed using react Nextjs and Go It was designed in an microservice architecture
for a special learning achievement.

The released version of this project is found in the release_01 branch

Documentation

To run individual Services review the build and run guide of your choosing.

For a complete deployment see this.

Motivations

While this is a project for a special learning achievement, it also serves as a full example of a Kubernetes and microservice oriented application.

A online casino is a perfect example for a microservice architecture, because many services need to communicate with each other, which is the main problem of this pattern.

Installation

Bazel

This project is build with Bazel tools, which create a sandbox to compile the source code. The authentication service would be build using the following output

#Builds the authentication service
bazel build //services/auth:auth

#Run the authentication service (does not 
require the previous step)
bazel run //services/auth:auth

if you want to specify the configuration used by the service you can set the --config Flag like this

bazel run //services/auth:auth --config=./pathToYourConfig

Bazel is able to build directly to containers from the source code. This can be done using the

bazel build //services/auth:image --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64

Notice that the --platform is important to tell Bazel that the go code should be compiled for the Linux runtime, since the Container is run in Linux.

Standard Go Compiler

Apart from the Bazel build tool every service can be build using the standard go tools

#Build authentication service
go build ./services/auth/main.go

#Run the service
go run ./serivces/auth/main.go --config=./pathToConfig

Build the docker image

The Docker file in the root directory can accommodate every go service of the system. To specify a service to be build to an Docker image use the following command

docker build -t royalafg_auth --build-arg service=./services/auth/main.go .

This will create the Docker image with the tag of royalafg_auth. Run docker run royalafg_auth to run the application

Deploy

I publish each service as a docker container in my docker hub page. This is used by the deployment scripts aswell.

To deploy the application please refer to the DEPLOY.md under /deployments

The following script is not ready yet.


To deploy the application on linux simply run

make deploy

which should deploy each service configured with default configuration. Keep in mind this also includes encryption keys and other private keys. Only use it for testing purposes

This script has the follwing requirements:

  • access to a terminal
  • docker installed
  • minikube installed. (On Linux the docker or none options are available to prevent the extra virutal machine)
  • kubectl installed (comes with minikube)
  • Helm installed

It will fire of a new minikube instance, which will configure kubectl and helm and the deploy the deployments described in /deployments in the correct order. In addition to that it will add the required helm repositories and install them. This includes Agones .

Architecture

Following services are integrated into the system:

Auth

The authentication service is responsible to generate authentication tokens (jwt) and verify and extend these tokens.

User

The user service is the governing body on the users data. It uses mongodb to persist this data and has grpc and http endpoint to enable communication.

Bank

The bank service creates a bank account for every user. It tracks every transaction and uses a event sourced system to ensure the safety and reliability of the system.

The search service uses elasticsearch to provide search functionality for the front end.

Web

The front end of the casino.

Poker-Matchmaker

The Matchmaker for the poker game. It is responsible to verify the buy in and to generate tickets to individual gameservers.

Poker

The Poker Gameserver provides a websocket connection to the poker game functionality.

Docs

A swagger generate documentation page.

License

This code is licensed under an MIT license. Ⓒ Jonas Schneider

Directories

Path Synopsis
docs module
mocks
pkg
log
mw
services
docs/classification
Package classification github.com/JohnnyS318/RoyalAfgInGo API Documentation for github.com/JohnnyS318/RoyalAfgInGo API Schemes:http, https BasePath: / Version: 0.0.1 Host: royalafg.games Contact: jonas.max.schneider@gmail.com License: MIT http://opensource.org/license/MIT Consumes: - application/json - application/x-www-form-urlencoded Produces: - application/json Security: - api_key: SecurityDefinitions: api_key: type: apiKey name: identity in: cookie swagger:meta
Package classification github.com/JohnnyS318/RoyalAfgInGo API Documentation for github.com/JohnnyS318/RoyalAfgInGo API Schemes:http, https BasePath: / Version: 0.0.1 Host: royalafg.games Contact: jonas.max.schneider@gmail.com License: MIT http://opensource.org/license/MIT Consumes: - application/json - application/x-www-form-urlencoded Produces: - application/json Security: - api_key: SecurityDefinitions: api_key: type: apiKey name: identity in: cookie swagger:meta
shared module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL