Skip to content

ai-hospital-services/infrastructure-as-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

infrastructure-as-code

license

Infrastructure as Code (IaC) for AI-HOSPITAL.SERVICES
Visit https://github.com/ai-hospital-services/medicine-prescriber-prototype to install the remaining Kubernetes workloads.

gcp-topology-infrastructure

Table of Contents

Repository map

 📌 ------------------------------> you are here
┬
├── ai-hospital.services   -------> domain website
│   ├── archive/terraform   ------> contains Terraform code for running workloads in Azure Kubernetes Services (AKS)
│   └── helm/wordpress   ---------> contains Helm charts for Kubernetetes workloads - wordpress and mysql
│── backend   --------------------> code for infrastructure and related workload deployment for backend application
│   └── terraform   --------------> contains Terraform code for running application workloads in Google Kubernetes Engine (GKE)
│   └── helm/mongodb   -----------> contains Helm charts for Kubernetes workload - mongodb used by backend api
│── media   ----------------------> contains images

Built with

  • Terraform v1.3
  • Kubernetes & Helm chart

Getting started

To get a local copy up and running, follow these steps.

Prerequisites

Setup backend infrastructure

# change directory
cd backend/terraform

# copy the values.tfvars to values-secret.tfvars
cp values.tfvars values-secret.tfvars

# update the 'values-secret.tfvars' file like the following, where,
# - 'project_id' is the google cloud project id
# - 'region' is the google cloud region code for e.g. asia-southeast1
# - 'zone' is the google cloud zone code for e.g. asia-southeast1-b
# - 'replica_zone' is the google cloud zone code for e.g. asia-southeast1-c
# - 'prefix' is the prefix for naming resources for e.g. ai-hospital-svcs
# - 'environment' is the middle name for naming resources for e.g. prototype
# - 'ssh_ip' is the user's public ip address who can SSH to the jump host

# initialise providers and modules
terraform init

# install infrastructure
terraform apply -var-file=values-secret.tfvars

# if you want to delete all resources created by terraform
terraform destroy -var-file=values-secret.tfvars

Setup kube config context

# login to gcloud
gcloud auth application-default login

# get kube config credentials for gke cluster
gcloud container clusters get-credentials <PREFIX>-<ENVIRONMENT>-gke01 --region <REGION> --project <PROJECT ID>

Setup mongodb database

# change directory
cd backend/helm

# prepare the 'mongodb/values-secret.yaml'
touch mongodb/values-secret.yaml

# update the 'mongodb/values-secret.tfvars' file like the following, where,
# mongodb:
#   rootUsername: "<MONGODB ROOT USERNAME>"
#   rootPassword: "<MONGODB ROOT PASSWORD>"
#   appUsername: "<MONGODB APP USERNAME>"
#   appPassword: "<MONGODB APP PASSWORD>"
# persistentVolume:
#   diskId: "projects/<PROJECT ID>/regions/<REGION>/disks/<PREFIX>-<ENVIRONMENT>-mongodbdisk01"

# to override arm64 node selection and tolerations, add,
# nodeSelector: {}
# tolerations: []

# create namespace
kubectl create namespace mongodb

# install/upgrade helm chart
helm upgrade -i mongodb mongodb -n mongodb -f mongodb/values-secret.yaml

# if you want to stop and remove helm chart and namespace
helm delete -n mongodb mongodb
kubectl delete namespace mongodb

Setup mysql database

# change directory
cd ai-hospital-services/helm

# prepare the 'mysql/values-secret.yaml'
touch wordpress/values-secret.yaml

# update the 'mysql/values-secret.yaml' file like the following, where,
# mysql:
#   rootPassword: "<MYSQL ROOT PASSWORD>"
#   wordpressUsername: "<MYSQL WORDPRESS USERNAME>"
#   wordpressPassword: "<MYSQL WORDPRESS PASSWORD>"
# persistentVolume:
#   diskId: "projects/<PROJECT ID>/regions/<REGION>/disks/<PREFIX>-<ENVIRONMENT>-mysqldisk01"

# to override arm64 node selection and tolerations, add,
# nodeSelector: {}
# tolerations: []

# create namespace
kubectl create namespace mysql

# install/upgrade helm chart
helm upgrade -i mysql mysql -n mysql -f mysql/values-secret.yaml

# if you want to stop and remove helm chart and namespace
helm delete -n mysql mysql
kubectl delete namespace mysql

Setup wordpress

# change directory
cd ai-hospital-services/helm

# prepare the 'wordpress/values-secret.yaml'
touch wordpress/values-secret.yaml

# update the 'wordpress/values-secret.yaml' file like the following, where,
# wordpress:
#   mysqlUsername: "<MYSQL WORDPRESS USERNAME>"
#   mysqlPassword: "<MYSQL WORDPRESS PASSWORD>"
# persistentVolume:
#   diskId: "projects/<PROJECT ID>/regions/<REGION>/disks/<PREFIX>-<ENVIRONMENT>-wordpressdisk01"
# letsencrypt:
#   enabled: true
#   email: "<DOMAIN EMAIL ADDRESS>"
#   mode: "production"

# to override arm64 node selection and tolerations, add,
# nodeSelector: {}
# tolerations: []

# create namespace
kubectl create namespace wordpress

# install/upgrade helm chart
helm upgrade -i wordpress wordpress -n wordpress -f wordpress/values-secret.yaml

# if you want to stop and remove helm chart and namespace
helm delete -n wordpress wordpress
kubectl delete namespace wordpress

Visit https://github.com/ai-hospital-services/medicine-prescriber-prototype to install the remaining Kubernetes workloads.

Authors

👤 Ankur Soni

  • Github
  • LinkedIn
  • Twitter

📝 License

This project is Apache licensed.