Skip to content

Latest commit

 

History

History
173 lines (138 loc) · 6.08 KB

README.md

File metadata and controls

173 lines (138 loc) · 6.08 KB

Goilerplate

For the perfect template. 🔥🔥🔥

Contents

Features

Structure

  • Routing - Gin Web Framework ---------------------------- 📚 :octocat:
  • CLI - Cobra ------------------------------------------------- 📚 :octocat:
  • DI pattern - Fx --------------------------------------------- 📚 :octocat:
  • Environment - Viper --------------------------------------- :octocat:
  • Logging - Zap ---------------------------------------------- :octocat:
  • PostgreSQL ORM - GORM --------------------------------- 📚 :octocat:
  • Redis ORM - Go-Redis ------------------------------------- 📚 :octocat:
  • DB Viewer - pgAdmin4 (Web) ----------------------------- 📚 🐳 :octocat:
  • Authentication - JWT (Access + Refresh) ----------------- 📚 :octocat:
  • Makefile - make -------------------------------------------- 📚
  • CI/CD - GitHub-Actions ------------------------------------ 📚

Infra

  • CNI(Container Network Interface)- flannel --------------- :octocat:
  • Load Balancer - MetalLB ----------------------------------- 📚 :octocat:
  • Ingress - NGINX -------------------------------------------- 📚
  • AutoScaling - k8s-HPA ------------------------------------- 📚

Kubernetes

Network

Load Balancer

Ingress

Auto Scaling

API

PostgreSQL

pgAdmin4

Redis

Quick start

Make sure you have make installed.

$ sudo apt install make

Kubernetes in Docker Desktop (localhost)

$ make deploy-to-docker-desktop
API Server URL (api.localhost)

Run in Postman

pgAdmin4 URL

https://pgadimin4.localhost

Kubernetes in Public Cloud (goilerplate.com)

# Check the IP of the Kubernetes control plane.
$ kubectl cluster-info
Kubernetes control plane is running at https://10.0.0.8:6443
CoreDNS is running at https://10.0.0.8:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

# Edit the addresses of ipaddress-pools.yaml.
$ vi k8s/ipaddress-pools.yaml
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
  name: first-pool
  namespace: metallb-system
spec:
  addresses:
  - 10.0.0.8-10.0.0.8             <---- edit IP
---
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
  name: l2-advert
  namespace: metallb-system

$ make deploy-to-cloud
API Server (api.goilerplate.com)

Run in Postman

pgAdmin4

https://pgadimin4.localhost

Makefile Macros

Docker Control

# Push the API Docker Image to the DockerHub.
$ make push_api

# Push the PostgreSQL Docker Image to the DockerHub.
$ make push_postgres

# Push the Redi Docker Image to the DockerHub.
$ make push_redis

# Push the pgAdmin4 Docker Image to the DockerHub.
$ make push_pgadmin4

# Push the All Docker Image to the DockerHub.
$ make push_all

Kubectl Control

# Deploy to the Docker Desktop. (WSL + Docker Desktop)
$ make deploy-to-docker-desktop

# Undeploy to the Docker Desktop. (WSL + Docker Desktop)
$ make delete-to-docker-desktop

# Deploy to the Public Cloud.
$ make deploy-to-cloud

# Undeploy to the Public Cloud.
$ make delete-to-cloud