Microservice responsible for main backend services.
This project uses the Go programming language (Golang), PostgreSQL as the relational database and Redis as the cache.
Clone the repository and enter the folder
git clone https://gitlab.com/gym-global/backend.git && cd backend
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/'
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/'
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
go test ./...
or
make test
make api-test
migrate create -ext sql -dir migration -seq some_migration_name
bash deploy-img-to-registry.sh