Simple Gin Starter project with some industry standard tools setup for production. Monitoring and alerting included. Derived from go-template-simple-server (use this if you do not wish to use the monitoring tools in this repo)
Clone this repository git clone https://github.com/thomasmendez/go-template-simple-server.git
or click 'Use this template'
in the Github UI to use the current project as a template.
Install the latest version of Go here
Verify Go is installed by checking the Go version with go version
This project uses the Makefile
in order to easily run sets of commands. The commands can also be run invidually using the commands listed for the makefile command
Run make tidy
in order to run the Go commands needed to install releated dependencies properly
Create a .env
file from the .env.example
file and modify the environment variables as needed
To build the project run make build
Note: Make sure Docker is running on your machine
The microservice and monitoring applications can be build and deployed with make docker
- API documentation can be viewed at http://localhost:8081/api/swagger
- Prometheus can be accessed at http://localhost:9090
- Alertmanager can be accessed at http://localhost:9093
- Grafana dashboard can be accessed at http://localhost:3000 with username and password set as
admin
by default
Application can stop running by pressing ctrl+c
on the terminal
To run the unit test for the project, run make test
Gin is a high performance web framework in Golang
Viper is a highly flexible configuration library
Zap fast, structured, leveled logging in Golang
Testify is an assertion library. Can also be used for mocking and building testing suites
Prometheus Go Client is the Go client library for Prometheus. It is used to provide application metrics
Swagger is used as API documentation
Can be modified in the swagger/swagger.yaml
file
Docker allows you to build and run this microservice
Prometheus provides metrics for the application
Alertmanager handles alerts sent by client applications such as the Prometheus server
Grafana allows you to query, visualize, and alert on and understand your metrics
Husky allows you to run scripts in the git lifecyle
This project is configured to run test before making a successful commit
Modify the pre-commit
hook with commands you wish to run before committing