Skip to content

Latest commit

 

History

History
41 lines (26 loc) · 1.53 KB

README.md

File metadata and controls

41 lines (26 loc) · 1.53 KB

API

This container is a wrapper for REST APIs called from the Grafana Dash.

The Grafana weather dashboard uses the grafana-json-datasource to retrieve sunset and sunrise times. The underlying REST API only returns times in GMT. This container acts as wrapper for the sunrise API adjusting the times.

From the Balena point of view this container is the simplest. The only thing to watch out for is that the container is configured to use the bridge network. This means that the Sinatra app needs to be configured to bind to all interfaces:

set :bind, '0.0.0.0'

Otherwise, Sinatra will only bind to the loopback interface, and you won't be able to access the API from outside the container.

Configuration

This container makes use of three device service variables. LATITUDE the latitude value for the sunrise/sunset location, LONGITUDE the longitude value for the sunrise/sunset location and TIMEZONE for the timezone in which to display the times.

Technologies

This container is implemented in Ruby based on a simple Sinatra app for serving the custom JSON APIs.

Development

To run the API server locally, run:

bundle exec rake run

Copy .template.env to .env and adjust LATITUDE, LONGITUDE and TIMEZONE to match your location.

Misc