Skip to content

LanDinh/khaleesi-ninja

Repository files navigation

khaleesi-ninja

latest version CI badge codecov badge lines of code badge licence badge

Available Systems

The following environments are ready to use.

Environment Intended Use Install Location Debug Mode Users
development development localhost ✔️ self only
integration development localhost self only
staging quality assurance upstream selected few users
production production upstream real users

The following gates are ready to use.

Gate Domain production staging Use
core - not deployed not deployed Code shared by all gates

Getting Started

Prerequisites

You need to make sure that these conditions are met:

  • Setup a local kubernetes cluster (instructions are in their official documentation)
  • If your local kubernetes setup didn't ship with it, you'll also need to install kubectl to control that cluster
  • Install helm (instructions are in their official documentation)
  • If you want to test the changes on your Android phone without rooting it, you will need to set up a proxy on your development machine and follow the instructions here.

Technologies used

You might want to make yourself familiar with the technologies used.

The general deployment is done with:

helm badge kubernetes badge docker badge

Other infrastructure consists of:

kube-promethus badge

Service Type General Infrastructure Development
Frontgate typescript badge
react badge
react-router badge
grpc-web badge
nginx badge
nginx-prometheus-exporter badge
create-react-app badge
jest badge
eslint badge
Backgate / Micro python badge
grpcio badge
django badge
kubegres badge grpcui badge
grpcio-tools badge
pylint badge
Backgate envoy badge

Structure

The folder structure is as follows:

  • .github CI related configuration - documentation
  • backend The code for the backgates and microservices. They are grouped by gate. One django project per service - documentation
  • data Lists of things (e.g. services, environments etc.) in json formats
  • documentation A bunch of markdown files to document everything
  • frontgate The code for the frontgates. One react project per frontgate - documentation
  • kubernetes Kubernetes related configuration - documentation
  • proto Protobuf definitions
  • scripts Utility scripts - documentation
  • templates Templates used when creating new services - documentation

Starting the ecosystem locally

Build and deploy changes by running the following commands (for local deployments, the environment will be either development or integration):

  1. ./scripts/operations/setup_cluster.sh will add the necessary controllers to the cluster
  2. ./scripts/operations/setup_environment.sh <ENVIRONMENT> will set up resources for the chosen environment
  3. ./scripts/operations/deploy.sh <ENVIRONMENT> will start up all gates and services for that environment

If self-signed TLS certificates are required, make sure that the following files exist:

  • Private key: letsencrypt/live/live/<ENVIRONMENT>.khaleesi.ninja/privkey.pem
  • Certificate: letsencrypt/live/live/<ENVIRONMENT>.khaleesi.ninja/fullchain.pem

This happens ideally before step 2, otherwise, simply repeat step 2.

Automated tests

Execute the tests by running ./scripts/development/test.sh

Hints

  • For local development, it is typical to work on a single service for a lengthy amount of time. To make this more user friendly, it is possible to pass the argument current_service to both ./scripts/development/test.sh as well as ./scripts/operations/deploy.sh (in front of all optional arguments). The first time current_service is passed, an interactive prompt will require choosing the service to be worked on. When it is time to switch work to a different service, simply call ./scripts/development/switch_current_service.sh.