Project boilerplate to start new cloud native golang projects quickly
- Clone this boilerplate
git clone git@github.com:msfidelis/cloud-native-microservice-boilerplate.git
- Change project name
Use your CTRL + F or Search/Replace
- Search for
change-me
in project folder - Change for your project name
docker-compose up --force-recreate
change-me_1 |
change-me_1 | __ _ ___
change-me_1 | / /\ | | | |_)
change-me_1 | /_/--\ |_| |_| \_ v1.12.1 // live reload for Go apps, with Go1.14.0
change-me_1 |
change-me_1 | watching .
change-me_1 | watching configs
change-me_1 | watching controllers
change-me_1 | watching controllers/healthcheck
change-me_1 | watching controllers/version
change-me_1 | watching models
change-me_1 | watching models/foo
change-me_1 | watching pkg
change-me_1 | watching pkg/configuration
change-me_1 | watching pkg/system
change-me_1 | !exclude tmp
change-me_1 | building...
curl 0.0.0.0:8080/version -i
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Sun, 02 Aug 2020 22:06:54 GMT
Content-Length: 16
{"version":"v1"}
ENVIRONMENT=test go test -v -cover
docker build -t newproject .
.
βββ Dockerfile (Production golang Dockerfile - Multistage Build)
βββ Dockerfile.dev (Development golang Dockerfile - With Air)
βββ LICENSE
βββ README.md
βββ configs (unsensitive configuration files)
β βββ dev.json
β βββ prod.json
β βββ test.json
βββ controllers (controller folder)
β βββ healthcheck (controller name / context)
β β βββ main.go (main module for controller)
β βββ version
β βββ main.go
βββ docker-compose.yml (docker-compose for development environment)
βββ go.mod
βββ go.sum
βββ pkg (Shared libs folder)
β βββ configuration (Lib Context / Name)
β β βββ main.go (Main module for package)
β βββ system
β βββ main.go
βββ main.go (Entrypoint / Routes)
This boilerplate works with a side-project called gin-chaos-monkey.
You can enable chaos assaults in your app setting some environment variables in runtime, like:
// ...
environment:
- ENVIRONMENT=dev
- CHAOS_MONKEY_ENABLED=true
- CHAOS_MONKEY_MODE=critical
- CHAOS_MONKEY_LATENCY=true
- CHAOS_MONKEY_EXCEPTION=false
- CHAOS_MONKEY_APP_KILLER=true
- CHAOS_MONKEY_MEMORY=false
You can enable assaults in production setting this variables in your platform cluster runtime. For more information, read the docs!
Access Swagger in http://0.0.0.0/swagger/index.html
Swagger runs on production build on Dockerfile
.
π€ Matheus Fidelis
- Website: https://raj.ninja
- Twitter: @fidelissauro
- Github: @msfidelis
- LinkedIn: @msfidelis
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Give a βοΈ if this project helped you!
Copyright Β© 2020 Matheus Fidelis.
This project is MIT licensed.
This README was generated with β€οΈ by readme-md-generator