A web based API to collect and aggregate metrics from plants
Build the containers:
docker-compose build --pull
Run migrations:
docker-compose run --rm web rake sequel:migrate
Create a user:
docker-compose run --rm web ./shell
u = User.new(email: 'admin')
u.set_password('secret')
u.save()
Start the service
docker-compose up
Everything should now be available on port 5000
on your machine.
- Ruby >= 2.0.0
- Docker
gem install bundler
bundle install
docker run -p 0.0.0.0:5432:5432 --rm pipelinedb/pipelinedb
bundle exec rake sequel:migrate
bundle exec ./shell
u = User.new(email: 'admin')
u.set_password('secret')
u.save()
bundle exec ruby server.rb
To add some data, PUT
against /api/metrics
. This accepts json like this:
[
{
"id": 1,
"type": "temp",
"value": 20
},
{
"id": 1,
"type": "moisture",
"value": 200
}
]
If you save this JSON to a file called metrics.json
, you can submit these metrics using curl:
curl -X PUT -u admin:secret -d @- http://localhost:4567/api/metrics < metrics.json
and retrieve the result using curl
curl -u admin:secret http://localhost:4567/api/temperature/1
- Frontend