Anuj Bansal 53cc1876c0 Make content secret required 2 years ago
..
.gitignore a2c9b38009 Add Orion, mongo service deployment, readme 2 years ago
Pulumi.yaml 53cc1876c0 Make content secret required 2 years ago
README.md 53cc1876c0 Make content secret required 2 years ago
index.ts 53cc1876c0 Make content secret required 2 years ago
mongo.ts a2c9b38009 Add Orion, mongo service deployment, readme 2 years ago
package.json a2c9b38009 Add Orion, mongo service deployment, readme 2 years ago
tsconfig.json a2c9b38009 Add Orion, mongo service deployment, readme 2 years ago

README.md

Amazon Kubernetes Cluster: Orion

Deploy Orion to a Kubernetes cluster

Deploying the App

To deploy your infrastructure, follow the below steps.

Prerequisites

  1. Install Pulumi
  2. Install Node.js
  3. Install a package manager for Node.js, such as npm or Yarn.
  4. Configure AWS Credentials
  5. Optional (for debugging): Install kubectl

Steps

After cloning this repo, from this working directory, run these commands:

  1. Install the required Node.js packages:

This installs the dependent packages needed for our Pulumi program.

   $ npm install
  1. Create a new stack, which is an isolated deployment target for this example:

This will initialize the Pulumi program in TypeScript.

   $ pulumi stack init
  1. Set the required configuration variables in Pulumi.<stack>.yaml

    $ pulumi config set-all --plaintext queryNodeEndpoint='http://host.minikube.internal:8081/graphql' \
    --plaintext isMinikube=true --plaintext orionImage='joystream/orion:latest' \
    --plaintext contentSecret='password123' \
    --plaintext aws:region=us-east-1 --plaintext aws:profile=joystream-user
    

If you want to build the stack on AWS set the isMinikube config to false

   $ pulumi config set isMinikube false

You can also set the storage config parameter if required. Check Pulumi.yaml file for additional parameters.

  1. Stand up the EKS cluster:

Running pulumi up -y will deploy the EKS cluster. Note, provisioning a new EKS cluster takes between 10-15 minutes.

  1. Once the stack if up and running, we will modify the Caddy config to get SSL certificate for the load balancer

Modify the config variable isLoadBalancerReady

   $ pulumi config set isLoadBalancerReady true

Run pulumi up -y to update the Caddy config

  1. Access the Kubernetes Cluster using kubectl

To access your new Kubernetes cluster using kubectl, we need to set up the kubeconfig file and download kubectl. We can leverage the Pulumi stack output in the CLI, as Pulumi facilitates exporting these objects for us.

   $ pulumi stack output kubeconfig --show-secrets > kubeconfig
   $ export KUBECONFIG=$PWD/kubeconfig
   $ kubectl get nodes

We can also use the stack output to query the cluster for our newly created Deployment:

   $ kubectl get deployment $(pulumi stack output deploymentName) --namespace=$(pulumi stack output namespaceName)
   $ kubectl get service $(pulumi stack output serviceName) --namespace=$(pulumi stack output namespaceName)

To get logs

   $ kubectl config set-context --current --namespace=$(pulumi stack output namespaceName)
   $ kubectl get pods
   $ kubectl logs <PODNAME> --all-containers

To run a command on a pod

   $ kubectl exec ${POD_NAME} -c ${CONTAINER_NAME} -- ${CMD} ${ARG1}

To see complete pulumi stack output

   $ pulumi stack output

To execute a command

   $ kubectl exec --stdin --tty <PODNAME> -c colossus -- /bin/bash
  1. Once you've finished experimenting, tear down your stack's resources by destroying and removing it:

    $ pulumi destroy --yes
    $ pulumi stack rm --yes