- Golang 1.20+
- GNU Makefile
- Docker for Mac
$GOBIN&$GOROOTare correctly setGO111MODULEis "on"
-
Update Module.yml for correct service name, port and other attributes if applicable. This file will be used for to setup the Makefile and CI/CD related scripts.
-
Update go.mod to make sure latest
go-lanailibrary is used -
Run
make init CLI_TAG="main"Note: If using released version of
go-lanai, "version" can be used instead of "branch" inCLI_TAG="..."This step would setup the workspace as following:
- Setup Golang private repository.
- Install
lanai-cli, which is the CLI tool that come withgo-lanai. - Generate
Makefile-Buildfor developer day-to-day tasks (build, test, lint, etc.). - Generate
Makefile-Generatedfor CI/CD tasks, this file is typically excluded form Source Control. - Generate
Dockerfile - Install Golang CLI utilities that are required for this project. (
Module.ymlcan be used to overwrite this)
-
Update codegen.yml to prepare for code generation. Make sure service name, port, context-path, etc. to be in sync with Module.yml
-
Update OpenAPI contract document configs/api-docs-v3.yml
-
Run
lanai-cli codegen -o ./
This step would generate skeleton code based on provided OpenAPI contract and
codegen.yml. -
Review
configs/application.ymlandconfigs/bootstrap.yml -
Try run the generated service
go run cmd/<service-name>/main.go
-
Verify
- Service is registered with consul
- Service is healthy
- APIs are serving
- Swagger page can be accessed (this would require auth service)
Show application information.
Show health status.
Show all properties applied to the running service and their sources.
Show and Modify log levels
make buildmake testmake lintmake init FORCE=truemake init CLI_TAG="<github-branch>"e.g.
make init CLI_TAG="develop"