Contains sample services 'bookings' and 'agents'
In order to get started, make sure you have Golang, Docker and Protobuf installed:
- Install Docker on MacOS (https://docs.docker.com/docker-for-mac/install/).
- Install Protobuf through Homebrew (https://brew.sh/) by typing
brew install protobuf
in Terminal. - Install Golang via (https://golang.org/doc/install) or typing
brew install go
in Terminal. Make sure you have go modules enabled. - Install Go-Micro Plugin for Protobuf (https://github.com/micro/protoc-gen-micro) by typing
go get github.com/micro/protoc-gen-micro
in Terminal. - Install gRPC Plugin for Protobuf (https://github.com/grpc-ecosystem/grpc-gateway) by typing
go get -v -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
in Terminal.
Clone this repository by using go get
:
go get github.com/diendang271/booking/...
cd $GOPATH/src/github.com/diendang271/booking
Note the code must be run from $GOPATH/src
. (If you don't have $GOPATH
set, see https://github.com/golang/go/wiki/SettingGOPATH)
This repository uses vendor, so you will need to disable Go Modules for it to work:
export GO111MODULE=off
In order to run the services, simply open up the Terminal and call the script we have prepared for you.
./start.sh
This script takes care of building and deploying bookings
service into a docker container along with other containers such as DynamoDB and agents
service. If at any point you simply want to build, you can use the Makefile we've prepared.
make all
curl http://localhost:8080/v1/createBooking -d ''
Some sample data has already been created with the following BookingIDs. Use the dynamodb-admin tool below to view them.
test-booking-1
test-booking-2
test-booking-3
A https://github.com/aaronshaf/dynamodb-admin server is included by default. Visit http://localhost:8001 to browser the local DynamoDB.