Skip to content

aseerkt/go-terraform-aws-eks

Repository files navigation

Simple Bank

Prerequisites

  • Go 1.22.2
  • Docker Desktop
  • golang-migrate
  • sqlc
  • mockgen
  • AWS CLI - v2
  • kubectl
  • eksctl
  • minikube

Getting Started

  • If you don't already have postgres:16-alpine docker image;
# Pull docker image
docker pull postgres:16-alpine

# Run postgres docker container
make postgres

# Create database in postgres docker container 
make createdb

# Run migration
make migrateup

For more scripts checkout Makefile

Local k8s setup

Setting up server in minikube k8s cluster

  • Create env file
cp app.example.env app.env
  • Start minikube k8s cluster
minikube start
  • Set minikube docker env
eval $(minikube docker-env)
  • Build simplebank docker image
docker build . -t aseerkt/simplebank:latest
  • Create simplebank* namepsace
kubectl create namespace simplebank
  • Apply simplebank k8s deployment objects
kubectl apply -f eks/deployment.yml

Post cleanup

kubectl delete -f eks/deployment.yml
docker rmi aseerkt/simplebank:latest
eval $(minikube docker-env --unset)
minikube stop && minikube delete

Deployment

  • Create IAM user with required permissions and create access key
  • Configure AWS CLI
aws configure