Skip to content

leeathefei/devicehive-java-server

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status License

DeviceHive Java server

DeviceHive turns any connected device into the part of Internet of Things. It provides the communication layer, control software and multi-platform libraries to bootstrap development of smart energy, home automation, remote sensing, telemetry, remote control and monitoring software and much more.

Connect embedded Linux using Python or C++ libraries and JSON protocol or connect AVR, Microchip devices using lightweight C libraries and BINARY protocol. Develop client applications using HTML5/JavaScript, iOS and Android libraries. For solutions involving gateways, there is also gateway middleware that allows to interface with devices connected to it. Leave communications to DeviceHive and focus on actual product and innovation.

DeviceHive license

DeviceHive is developed by DataArt Apps and distributed under Open Source MIT license. This basically means you can do whatever you want with the software as long as the copyright notice is included. This also means you don't have to contribute the end product or modified sources back to Open Source, but if you feel like sharing, you are highly encouraged to do so!

© Copyright 2013 DataArt Apps © All Rights Reserved

Docker Container

We have published DeviceHive docker container so you can utilize docker's virtualization features with DeviceHive. Check out docker DeviceHive on Docker Hub with the instructions on how to use it. You can check dockerfile implemetation as well as the script for setting up a new instance running under nginx on DeviceHive Java Docker

DeviceHive Java installation instructions

Prerequisites

In order to use DeviceHive framework you must have the following components installed and configured:

Build packages

  • Download source code from GitHub using "Download ZIP" button. It should always point to recent stable or beta release, but you always can get any other tag or branch. It also can be done using one of Git version control client or git command line tool. If you prefer git, clone project using command

git clone https://github.com/devicehive/devicehive-java-server.git

After that you can switch to the tag or branch you need. The list of all available releases can be found at https://github.com/devicehive/devicehive-java-server/releases Execute following command from ${devicehive-java-server-directory}/server.

mvn clean package

If this steps are done correctly you will find devicehive--boot.jar at ${devicehive-java-server-directory}/server/target After successful compilation and packaging go to the next step.

Running Apache Kafka

Start Zookeeper and Apache Kafka brokers as explained at official documentation (http://kafka.apache.org/documentation.html#quickstart). If your Kafka brokers are installed on the different machines, please specify their hostname/ports at app.properties file. You need to update zookeeper.connect (zookeeper's contactpoint) and metadata.broker.list (list of brokers) properties.

Starting database

  • After you have downloaded and installed PostgreSQL (see https://wiki.postgresql.org/wiki/Detailed_installation_guides) you have to create new user. This step is required for database migrations to work properly.
  • Create database using user that have been created at step 1. This user should be owner of database.
  • Database schema will be initializied on application startup.

Running application

  • To start application run following command:

java -jar ${devicehive-java-server-directory}/server/target/devicehive-<version>-boot.jar

This will start embeded undertow application server on default port 8080 and deploy DeviceHive application.

  • Set up OAuth2 providers properties. At the moment DeviceHive supports Google Plus, Facebook, Github OAuth2 identity providers. After registering your application at Google/Facebook/Github you'll be provided with your client id and client secret. To save them you should use link below:

http://localhost:8080/DeviceHiveJava/rest/configuration/${name}/set?value=${value}

For Google: The parameter “name” should be “google.identity.client.id” and “google.identity.client.secret”. To allow google authentication flow set “google.identity.allowed” to "true" (by default it's false)

For Facebook: The parameter “name” should be “facebook.identity.client.id” and “facebook.identity.client.secret”. To allow facebook authentication flow set “facebook.identity.allowed” to "true" (by default it's false)

For Github: The parameter “name” should be “github.identity.client.id” and “github.identity.client.secret”. To allow github authentication flow set “github.identity.allowed” to "true" (by default it's false)

  • Use it.

Packages

No packages published

Languages

  • Java 94.9%
  • CSS 2.1%
  • HTML 2.1%
  • Other 0.9%