A containerised eShopFiberMicroserviceBoilerplate (mmm Java-style naming)
| Component | Link |
|---|---|
| Language | Go |
| Framework | Fiber |
| Hot Reloading | Air |
| Containerisation | Docker |
| Profiler | Pyroscope |
- Hot-reloading in dev mode;
- Containerized debug mode;
- Profiler in debug mode;
- Health checks;
- Configuration;
- /api
- /assets
- /cmd
- /internal/adapters
- /internal/configs
- /internal/handlers
- /internal/mappers
- /internal/middlewares
- /internal/models
- /internal/repositories
- /internal/routers
Install the dependencies:
Note: this project uses Go mod, the official module manager, to handle Go modules in a portable way without having to worry about GOPATH.
go mod download
go mod vendor
go mod verifyDefine configs using yaml:
cp config.example.yaml config.yamlRun locally:
Note: this builds the Docker image and runs it automatically with the config defined in
docker-compose.yaml. This saves you having to build the docker image and then run a manualdocker runcommand with all the flags (for environment variables, ports, etc).
Local:
task wire && airUsing Docker (change target to dev in .env):
docker compose up --build -d appNote: in debug mode available port for break points and profiler
Using Docker (change target to debug in .env):
docker compose up --build -d appNote: Environment variables are never baked into the image, or they wouldn't be environment variables. The production environment will start a Docker container based on this image, but it will have to pass the environment variables to the container when it runs it.
Using Docker (change target to prod in .env):
docker compose up --build --remove-orphans app