Skip to content

okfn-brasil/querido-diario-infra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 

Repository files navigation

querido-diario-infra

This repository contains a bunch of different script to deploy the infrastructure used in the Querido Diário project. Terraform is used to deploy all the Digital Ocean infrastructure used to run the workloads. The Terraform script deploy a database, Kubernetes cluster, digital ocean spaces (s3ish storage) and everything necessary to support the project applications.

Once you have the base infrastructure in place, Helm charts are used to deploy the some applications required to run our workloads.

How to use it?

First of all, it is necessary sipping up the base infrastructure. For that, you can go to the terraform directory and initialize the Terraform working directory. It will create some initial files, downloads providers and everything else that is necessary to run the deploy. After the initialization, you can run the command to ask Terraform to plan the changes in your infrastructure and then, apply it. All the commands for the previously described process is:

terraform init
terraform plan
terraform apply

After this process, if everything run successfully, you will have a kubeconfig file inside the terraform directory. This file, give you access to the Kubernetes cluster deployed. This file is used in the further step to install some base applications needed by the project. For that, you export the KUBECONFIG environment variable or copy the file to the $HOME/.kube/config file. To export the environment variable you can use a command similar to this:

export KUBECONFIG=/path/to/the/querido-diario-automation/repo/terraform/kubeconfig

Once you did that, if you have the kubectl installed in the local machine, check if you have access to the cluster:

kubectl get nodes

Now you have the infrastructure in place, you can start deploy some apps in the cluster. In this documentation we will show how to deploy two requirements to run the Querido Diário project: Nginx ingress controller and Elasticsearch.

Nginx Ingress Controller

Nginx ingress controller is used to give access to services running inside the cluster to the external world. For that, we will create some required resources to run in our cloud provider (Digital Ocean) and than run the helm command to install the Nginx Ingress Controller chart:

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.46.0/deploy/static/provider/do/deploy.yaml
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update

helm install ingress-nginx ingress-nginx/ingress-nginx

Elasticsearch

Elasticsearch (a.k.a. ES) is our search index of choice. Querido Diário index all the crawled documents in a ES index. So, we need to deploy it in our cluster as well. We will use again the Helm chart available in the Elastic (ES main developer) repository:

helm repo add elastic https://helm.elastic.co
helm install elasticsearch --version 7.12.1 elastic/elasticsearch

Once you follow all these steps you should have the base infrastructure used to run Querido Diário workloads.

About

Querido diário deploy scripts

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages