MadeiraMadeira boilerplate project to build scalable, testable and high performance Go microservices.
- Automatic pre-commit code analysis and lint with
golint
,govet
andgoimports
; - Automatic pre-push testing;
configuration
: easily manage environment variables and app configuration;- it reads a
.env
file when its available, and load system variables when it's not; - it also validates the available variables based on the
AppConfig
struct;
- it reads a
healthcheck
: REST endpoint that returns relevant information about the application status;logger
: easily manage application logs following the MMRFC1 standards;- Docker infrastructure with Docker Compose.
Download and extract the project, then:
$ mv go-service-template-production {your_project_name}
$ git init
$ git remote add origin https://github.com/{user}/{repo}.git
Hint: use
$ git remote -v
to verify new remote
$ ./tools/setup.sh
$ docker-compose -f docker-compose.yml up
$ ./tools/setup.sh
$ go mod download
$ go run ./cmd/SERVICE_NAME/main.go
# eg:
$ go run ./cmd/go_service_template/main.go
# unit tests
$ go test ./...
# e2e tests
[soon]
# test coverage
[soon]
To see a more friendly test output, install gotestsum globally by running
$ go install gotest.tools/gotestsum@latest
And execute at the project root directory:
$ gotestsum --format testname
$ docker build \
--target release \
--build-arg SERVICE_PATH=_SERVICE_NAME_ \
-t _SERVICE_NAME_:VERSION \
-f docker/Dockerfile .
# eg:
$ docker build \
--target release \
--build-arg SERVICE_PATH=go_service_template \
-t go-service-template-production:latest \
-f docker/Dockerfile .