The stack consists of several docker containers as follows
- A web app built in rails that handles bugs and consists of simple models that represents Bugs and States(The state of the device the bug was created on).
- A Postgres database container.
- A RabbitMQ message queuing service container.
- An Elasticsearch container.
Communication between containers are done using container links.
To start the whole stack execute:
docker-compose up
For Testing the POST /bugs end point we can execute:
curl -X POST \
http://localhost:3000/bugs/ \
-H 'content-type: application/json' \
-H 'accept: bugapp.v1' \
-d '{
"appToken": "[appToken]",
"status": "[status]",
"priority": "[priority]",
"comment": "[comment]",
"state": {
"device": "[device_name]",
"os": "[device_os]",
"memory": "[device_memory]",
"storage": "[device_storage]"
}
}'
where [status] can be one of [fresh, in_progress, closed]
and [priority] can be one of [minor, major, critical]
For Testing the GET /bugs end point we can either execute:
curl -H 'accept: bugapp.v1' -X GET http://localhost:3000/bugs/
which will get a full list of bugs.
or we can execute:
curl -H 'accept: bugapp.v1' -X GET http://localhost:3000/bugs/[bug_number]?appToken=[appToken]
which will get us a specific bug.
We can invoke the searching end-point to search for a specific query, like:
curl -H 'accept: bugapp.v1' -X GET http://localhost:3000/bugs/search?q=major
will return all the bugs with priority of 'major', or maybe some bug that has a comment containing the word 'major'(case-insensitive), it also matches on any other field.
We can also use the search end-point for multi term queries, like:
curl -H 'accept: bugapp.v1' -X GET http://localhost:3000/bugs/search?q=fresh in_progress
will return all the bugs with status of either 'fresh' or 'in_progress'(will also include comments).