ruuvi / ruuvitracker_server

RuuviTracker Server
https://ruuvi.com
BSD 2-Clause "Simplified" License
22 stars 7 forks source link

ruuvi-server

Clojure based implementation of RuuviTrackerServer.

See http://www.ruuvi.com for more details.

Server works either as standalone application, using a HTTP Servlet container (for example Jetty) or with Heroku cloud.

This software provides only REST and WebSocket APIs. User interface is available in separate project RuuviTracker/ruuvitracker_web.

New development

There is a rewrite of the server application works at https://github.com/jsyrjala/massive-batman

Discussion

Most of the discussions about development happen on IRCNet channel #ruuvitracker.

There is also a mailing list at https://groups.google.com/forum/?fromgroups#!forum/ruuvitracker-dev

Prerequisites

Implementation

Currently server implements Tracker API and Client API partially.

Standalone application

  1. Fetch sources

    git clone git://github.com/jsyrjala/ruuvitracker_server.git
  2. Setup database, see src/resources/server-dev-config.clj

  3. Fetch dependencies

    lein deps
  4. Create tables to database

    lein run -m ruuvi-server.launcher migrate
    
  5. (Optional) Import example data to database

    lein run -m ruuvi-server.launcher load-example-data
    
  6. Start server

    lein ring server
  7. Access web application http://localhost:3001/api/v1-dev/events

Heroku usage

  1. Get sources
    git clone git://github.com/RuuviTracker/ruuvitracker_server.git
  2. Create Heroku account
    • Simply create an Heroku account and push code to Heroku.
  3. Create heroku application
    heroku create --stack cedar
  4. Add heroku as git remote
    git remote add heroku git@heroku.com:APPNAME.git
  5. Configure heroku
heroku addons:add heroku-postgresql:dev
heroku config:add RUUVISERVER_ENV=heroku --app APPNAME
  1. Create tables to database and some content to tables

    heroku run lein run -m ruuvi-server.launcher migrate
    
  2. (Optional) Import example data to database

    heroku run lein run -m ruuvi-server.launcher load-example-data
    
  3. Start heroku process

    heroku scale web=1
  4. Access the app http://APPNAME.herokuapp.com/api/v1-dev/events

Database

Server uses PostgreSQL or H2 database engines. See resources/server-XXX-config.clj files for database configuration.

UI develpment

Static html files are located in resources/public. Add javascript ui there.

Continuous Integration

Travis is used as CI.

See http://travis-ci.org/#!/RuuviTracker/ruuvitracker_server

Guide to source tree

Production code lives under 'src', unit-tests and other automatic tests live under 'test'. Directory 'test-utils' contains scripts usable in manual testing. Directory 'resources' contains data files that are not executable code.

Unit tests are implemented with Midje.

src directory

License

Copyright (C) 2012 Juha Syrjälä

BSD License