This microservice describe and realize business logic for e-wallet handling based on DDD approach.
These instructions will help you to up and running service on your local machine for development and testing purposes.
You can skip prerequisites, local setup and skip it for docker-compose point
Service required goose utility for migrations, vegeta for load testing
To install it automatically use:
$ make init
- cmd - contains main files for walletsvc and docgen.
- config - hold main app configuration and configs that mapped for docker-compose.
- db - migration's sql files, initialization, config, types and models
- docs - project documentation.
- domain - domain layer source code, domain model, repository interfaces, domain services interfaces.
- infrastructure - infrastructure layer source code, services and gateway implementation.
- internal - generated mocks, internal modules
- transport - contains endpoints, application layer source code for http interactions
- vendor - contains vendored dependencies
Local stack:
- golang go1.12.7
- postgresql 11.4
- config/walletsvc/config.yaml - main configuration file, describes listen port & address of application
- db/dbconf.yaml - used to configure goose utility & app's database same time.
After successful configuration you can run walletscv service by:
$ go run ./cmd/walletsvc/main.go
Auto-generated api documentation stored in docs/api.md
Project uses chi-docgen utility to auto-generate, api documentation so you can easily regenerate it by:
$ go run ./cmd/docgen/main.go
- docker-compose version 1.24.1, build 4667896b
- docker engine 19.03.1
Docker compose stack:
- db - main database service, has local config config/postgresql.conf
- nginx - service that provides proxy & load balancer, that provides main application saleability, has local config config/nginx.conf
- app - main service contain walletsvc microservice
- migration - short-live container that will migrate up your data
Optionally you can to build all related local images by running:
$ make docker-compose-build
This will also pass $TAG, $BRANCH and $COMMIT variables to app image. That will "sign" service binary in main app container in build phase.
To start up project services, and apply all migrations:
$ make docker-compose-up
Shut down all services:
$ make docker-compose-down
Separately you can build walletscv service container. Use this command for the auto build:
$ make build
$ make test
To run unit tests for all subdirectories.
$ make test-integration
Provides integration tests, based on parallel http servers that runs from one point, uses docker-compose system parts.
$ make docker-scale-load-test
For 2 nodes scale test based on vegeta util, was made for fun ;)
Project uses gomock and go-sqlmock
You can regenerate mocking structures by using:
$ go generate ./...
Please refer to each project's style and contribution guidelines for submitting patches and additions. In general, we follow the "fork-and-pull" Git workflow.
- Fork the repo on GitHub
- Clone the project to your own machine
- Commit changes to your own branch
- Push your work back up to your fork
- Submit a Pull request so that we can review your changes