-
Notifications
You must be signed in to change notification settings - Fork 660
Running Compose
A makefile
has been provide to allow for the building, running, and testing the project. It is accessible from the root of the project.
$ cd $HOME/code/service
This command will build the sales-api
and metrics
images.
$ make all
This command will leverage Docker Compose to run all the services, including the 3rd party services. The first time you run this command, Docker will download the required images for the 3rd party services. The command will also create a schema in the database and seed the database with test data.
$ make run
That is equivalent to running.
$ make up
$ make seed
docker-compose up --detach --remove-orphans
go run app/sales-admin/main.go --db-disable-tls=1 migrate
go run ./app/sales-admin/main.go --db-disable-tls=1 seed
This command will shutdown the running Docker Compose environment.
$ make down
docker-compose down --remove-orphans
This command will tail the logs from the running Docker Compose environment.
$ make logs
docker-compose logs -f
Before any requests can be made you must acquire an auth token. Make a request using HTTP Basic auth with the test user email and password to get the token.
$ curl --user "[email protected]:gophers" http://localhost:3000/v1/users/token
I suggest putting the resulting token in an environment variable like $TOKEN
.
$ export TOKEN="COPY TOKEN STRING FROM LAST CALL"
To make authenticated requests put the token in the Authorization
header with the Bearer
prefix.
$ curl -H "Authorization: Bearer ${TOKEN}" http://localhost:3000/v1/users
Contact Bill Kennedy at [email protected] if you are having issues getting the project running.