This repo holds all files requested by the Colombia Mission Technical Operations Test
The following environment variables must be passed to the Docker container for the app to start properly
Property | Description |
---|---|
POSTGRES_ADDR | PostgreSQL DB to connect to, this address must not contain a protocol |
POSTGRES_PORT | PostgreSQL DB port to connect to |
POSTGRES_USER | PostgreSQL user to connect as |
POSTGRES_PASS | PostgreSQL password for the above user |
POSTGRES_DB | PostgreSQL database to use |
HTTP_PORT | http port to expose service in |
Please remember to create a user with SELECT, INSERT, UPDATE, DELETE & CONNECT
privileges to the database selected in POSTGRES_DB
- Clone this repo
- Download & install golang from here
- Run
go get
to download all dependencies - Run
go build
to create the final executable - Run
colombia-mission-test
executable after setting up the above environment variables & PostgreSQL instance
The ansible
folder includes an ansible playbook to do the following:
- Create a Kubernetes Cluster in Google Cloud (GKE)
- Save the associated kubeconfig file for the cluster
- Create a Node Pool in said cluster
- Create Database inside PostgreSQL
- Deploy the application as described in the
deployment.yaml
file
To run the playbook, the following libraries must be installed:
- requests >= 2.18.4
- google_auth >= 1.3.0
- pyyaml >= 5.0
The folder includes a requirements.txt
file to install all required libraries.
Once all libraries are installed, a service account must be created in the project with the following roles:
- Service Account User (to allow the service account to run tasks)
- Kubernetes Engine Admin (to create the cluster)
- Compute Engine Admin (to create the cluster)
- CloudSQL Admin (to create the CloudSQL instance)
Download a Service Account JSON authentication file and place it in your local disk, the location of the file must be referenced in the ansible vars.yaml
file.
Also, create a CloudSQL instance in the project, this instance is not created as part of the playbook due to data consistency.
Finally, update the k8s/configmap.yaml
& k8s/deployment.yaml
to add your PostgreSQL/CloudSQL values