Skip to content

Latest commit

 

History

History
89 lines (76 loc) · 2.08 KB

README.md

File metadata and controls

89 lines (76 loc) · 2.08 KB

Backend Core

Microservice responsible for main backend services.

Go Postgres Redis

Solution Architecture

sa

Getting Started

This project uses the Go programming language (Golang), PostgreSQL as the relational database and Redis as the cache.

Steps to run

Clone the repository and enter the folder

git clone https://gitlab.com/gym-global/backend.git && cd backend
Debug mode

Compose the local environment (cache + db)

make local
make stop-local

Install, Build and Run Go binary

go run cmd/api/main.go or
go mod download && go build -o gym cmd/api/main.go && ./gym

Test the app

curl --location --request GET 'http://localhost:8080/health'
curl --location --request GET 'http://localhost:8080/'
Docker compose network

Compose the dev environment (app + cache + db)

make dev
make stop-dev

Test the app

curl --location --request GET 'http://localhost:6000/health'
curl --location --request GET 'http://localhost:6000/'
Kubernetes

Apply the definition files

kubectl apply -f kubernetes

Get pod name and port-foward

kubectl get pods
kubectl port-forward {pod-name} 5555:6000 
eg. kubectl port-forward gym-app-5bcb8c5c4d-cxbp9 5555:6000

Test the app

curl --location --request GET 'http://localhost:5555/health'
curl --location --request GET 'http://localhost:5555/'

Scale the pods

kubectl scale --replicas=3 deployment gym-app

Running the tests

go test ./...
or 
make test
make api-test

Creating a migration

migrate create -ext sql -dir migration -seq some_migration_name

Deploying an img to registry

bash deploy-img-to-registry.sh