This repo contains an Ansible playbook for deploying Postresql cluster DB with etcd and haproxy as load balancer. The app is distributed in a Docker container and can be deployed via Helm chart. Simple API in the app returns weather information from the database.
- Clone repo and
cdinto it. - Place the
kubeconfigfile in the master withstudent*name pattern. - Add SSH public keys to hosts.
- Setup Ansible inventory:
- Fill internal IPs for etcd_cluster \ balancers (which will haproxy) \ master \ replica in inventory file
- Change
ansible_ssh_private_key_file=to your private SSH key path for hosts.
- Setup credentials for the DB connection in
./vars/main.yml-adminas an example. - Run playbook -
ansible-playbook deploy_pgcluster.yml - After successful Ansible Playbook execution, you will see a public IP for Haproxy.
- Setup Helm values in
./app/values.yalm:- Change
PGID,PGPASSfrom step 5 to yours andPGIPto Haproxy IP from step 7. - Change
DOTNET_ENVIRONMENTtoDevelopmentif you want see Swagger page on the$IP/swagger/index.html
- Change
- Deploy Helm chart in K8S:
helm --kubeconfig ./student*.yaml install app /app - Run
./app/test-api.shto see an example API response from DB.
