Giter VIP home page Giter VIP logo

ruuvitracker_server's Introduction

ruuvi-server

Clojure based implementation of RuuviTrackerServer.

See http://www.ruuvitracker.fi/ for more details.

Server works either with standalone servlet container (for example Jetty) or with Heroku cloud.

Prerequisites

Implementation

Currently server implements Tracker API and Client API partially.

  • Requests are saved to database, but they are not properly validated yet.

Standalone usage with Jetty

  1. Fetch sources
git clone git://github.com/jsyrjala/ruuvitracker_server.git
  1. Setup database, see src/resources/server-dev-config.clj
  2. Fetch dependencies
lein deps
  1. Create tables to database and populate database
lein run -m ruuvi-server.launcher migrate
lein run -m ruuvi-server.launcher load-test-data
  1. Start server
lein ring server
  1. Access web application http://localhost:3001/api/v1-dev/events

Heroku usage

  1. Get sources
git clone git://github.com/RuuviTracker/ruuvitracker_server.git
  1. Create Heroku account
  • Simply create an Heroku account and push code to Heroku.
  1. Create heroku application
heroku create --stack cedar
  1. Add heroku as git remote
git remote add heroku [email protected]:APPNAME.git
  1. 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
heroku run lein run -m ruuvi-server.launcher load-test-data
  1. Start heroku process
heroku scale web=1
  1. 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

  • master branch:

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

  • 'ruuvi_server/' contains main functionality of the server.
  • 'launcher.clj' is the starting point. Handles configuration and starts up serveres.
  • 'configuration.clj' contains functions to handle configuration data. It also contains atom that holds current configuration.
  • 'core.clj' sets up basic REST routes for whole software.
  • 'api.clj' is the main starting point for API.
  • 'client_api.clj' contains implementation of client part of API. Clients (web browsers, mobile devices) can get location data via JSON api.
  • 'tracker_api.clj' contains implementation of tracker API. Tracker device can send location and other data using JSON API.
  • 'tracker_security.clj' implements security features used in tracker API. HMAC based message verification.
  • 'util.clj' contains generic utility functions.
  • 'parse.clj' contains input parsing functions.
  • 'lobos/' contains database migration files (a.k.a database schema changes). Migrations are implemented with Lobos frameworks.
  • 'ruuvi_server/database/' contains database access layer, scripts for initally populating the database with test data and connection pooling. Database access is implemented with Korma library.
  • 'entities.clj' contains definitions for ORM entities.
  • 'event_dao.clj' contains DAO functions for manipulating event data.
  • 'pool.clj' constructs a connection pool.

License

Copyright (C) 2012 Juha Syrjälä

BSD License

ruuvitracker_server's People

Contributors

jsyrjala avatar technomancy avatar

Watchers

James Cloos avatar naheed avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.