Mokhtar Naamani 94570aab23 Merge branch 'giza_staging' into giza_staging_k8_support_kind_ingress | 2 سال پیش | |
---|---|---|
.. | ||
docker_dummy | 3 سال پیش | |
.gitignore | 3 سال پیش | |
Pulumi.yaml | 3 سال پیش | |
README.md | 3 سال پیش | |
configMap.ts | 3 سال پیش | |
index.ts | 2 سال پیش | |
indexerDeployment.ts | 2 سال پیش | |
ingress.yaml | 3 سال پیش | |
package.json | 3 سال پیش | |
processorDeployment.ts | 2 سال پیش | |
s3Helpers.ts | 3 سال پیش | |
tsconfig.json | 3 سال پیش |
Deploys an EKS Kubernetes cluster with query node
To deploy your infrastructure, follow the below steps.
After cloning this repo, from this working directory, run these commands:
This installs the dependent packages needed for our Pulumi program.
$ npm install
This will initialize the Pulumi program in TypeScript.
$ pulumi stack init
Set the required configuration variables in Pulumi.<stack>.yaml
$ pulumi config set-all --plaintext aws:region=us-east-1 --plaintext aws:profile=joystream-user \
--plaintext dbPassword=password --plaintext blockHeight=0 \
--plaintext joystreamWsEndpoint=ws://endpoint.somewhere.net:9944 \
--plaintext isMinikube=true --plaintext skipProcessor=false
If you want to build the stack on AWS set the isMinikube
config to false
$ pulumi config set isMinikube false
If you want to use an existing Indexer and not deploy a new one set externalIndexerUrl
$ pulumi config set externalIndexerUrl <URL>
You must have a valid docker image of joystream/apps
either on Docker hub or your local to deploy the infrastructure.
If the image exists locally & you are running on minikube, run
$ pulumi config set-all --plaintext useLocalRepo=true --plaintext appsImage=<IMAGE_NAME>
NOTE: The docker deamon for minikube is different from that of the docker desktop. To connect your Docker CLI to the docker
daemon inside the VM you need to run: eval $(minikube docker-env)
. To copy the image from your local deamon to minikube run
minikube image load joystream/apps:latest --daemon
.
If not using minikube, just specify the appsImage
config.
Running pulumi up -y
will deploy the EKS cluster. Note, provisioning a
new EKS cluster takes between 10-15 minutes.
Modify the config variable isLoadBalancerReady
$ pulumi config set isLoadBalancerReady true
Run pulumi up -y
to update the Caddy config
pulumi stack output endpoint1
or pulumi stack output endpoint2
The GraphQl server is accessible at https://<ENDPOINT>/server/graphql
and indexer at https://<ENDPOINT>/indexer/graphql
minikube service graphql-server -n $(pulumi stack output namespaceName)
This will setup a proxy for your query-node
service, which can then be accessed at
the URL given in the output
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 see complete pulumi stack output
$ pulumi stack output
To execute a command
$ kubectl exec --stdin --tty <PODNAME> -c colossus -- /bin/bash
Once you've finished experimenting, tear down your stack's resources by destroying and removing it:
$ pulumi destroy --yes
$ pulumi stack rm --yes