- mysql - container with a database.
- echo - server with API to store and retrieve data to the database.
- generator - server with API to run a generator that makes requests to echo API to populate the database.
- dev - container used for development only. It has vim installed with vim-go plugin enabled.
cd src
cp template.env .env
Edit .env
file to add MYSQL credentials.
Run containers:
docker-compose up -d generator
It runs 3 services: generator, echo and mysql.
Wait several seconds for database availability.
- Get all records from database: GET localhost:80/data
- Get filtered records: GET localhost/data?start_timestamp=1632062101&end_timestamp=1632062111&ID1=1&ID2=F
- Start data generation: POST localhost:8080/start
- Stop: POST localhost:8080/stop
cd src
docker-compose up -d dev
docker attach src_dev_1
cd echo
vim server.go
Note: When edit docker binded files (like "server.go") on the host and in the container at the same time they could be not synchronized.