Catalog
Requirements
go version 1.13
docker
docker-compose
golang-statik: sudo apt install golang-statik
Installation
Use go mod to install dependencies.
go mod tidy
Run docker-compose to build docker images and run necessary containers.
docker-compose up -d
if the command above returns this error
es01 exited with code 78
that is because
elasticsearch | [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
Therefore we need to increase the vm.max_map_count limit:
sudo sysctl -w vm.max_map_count=524288
Now we need to edit /etc/sysctl.conf so the setting will also be in effect after a reboot.
Look for any vm.max_map_count line in /etc/sysctl.conf. If you find one, set its value to 524288. If there is no such line present, add the line
vm.max_map_count=524288
to the end of /etc/sysctl.conf
Dependency
Usage
docker-compose up -d
go run main.go
- open Catalog API
- play!
- add new product, add wish list item, update price, update product, etc.
Swagger update
Architecture and Design
The project code follows the design principles from the resources bellow
Microsoft Micro-Services
https://docs.microsoft.com/en-us/dotnet/architecture/microservices/index
Uber Go Code Structure
https://www.youtube.com/watch?v=nLskCRJOdxM
- extended with receivers and emitters for working with events
Rest HTTP Server by Go veteran
https://www.youtube.com/watch?v=rWBSMsLG8po
License
MIT