GOingToREST is a simple 3-app system built for me to learn about communicating between different services.
poster/poster.go
- Listens to POST requests
- Redirects data from POSTs to Rabbitmq
saver/saver.go
- Consumes Rabbitmq queue
- Saves incoming data to Redis
explorer/explorer.go
- Listens to GET requests @
/size
- Returns the count of all keys in Redis
- Listens to GET requests @
user/user.go
- Struct User with some sample fields like id, name, surname, and age.
For debugging/testing purposes, in scripts/
there is post_curl.sh
which sends random POSTs of correct form
(remark: jq required)
- Docker bridge
$ docker network create <network-name>
- Redis (@ port 6379 & name=redis by default, can be changed in
config.yaml
) - Rabbitmq (@ port 5672 & name=rabbitmq by default, can be changed in
config.yaml
)
In order to build docker images for apps in poster/
, saver/
, and explorer/
run
$ # Let <name> = poster, etc.
$ docker build -t <name> .
To run:
$ docker run --rm -it --name <name> --network <network-name> -v <path to config file>:<$CONFIG_PATH><$CONFIG_NAME>.<$CONFIG_TYPE> -p <ports> <name>