• Stars
    star
    367
  • Rank 116,257 (Top 3 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created over 11 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

DeviceHive Java Server

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, Node.js or Java libraries and JSON format. Write and read your data via REST, Websockets or MQTT, explore visualization on Grafana charts.

Develop client applications using HTML5/JavaScript and Android libraries. Leave communications to DeviceHive and focus on actual product and innovation.

DeviceHive license

DeviceHive is developed by DataArt Apps and distributed under Open Source Apache 2.0. 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-2017 DataArt Apps Β© All Rights Reserved

Docker Container

DeviceHive could be deployed manually, via Docker Compose or to Kubernetes cluster. Our suggestion is to start from Docker Compose - the easiest way to start your mastering DeviceHive capabilities. Instructions could be found here. In case you're more familiar with Kubernetes, please follow this link for detailed instructions.

DeviceHive Java installation instructions

Though docker-compose installation is the most developer-friendly way of running DeviceHive locally, sometimes it's required to build and start project manually. Below you can find detailed instructions on that.

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}.

mvn clean package

If there are no errors, compilation and packaging are completed and you can 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 contact point) and bootstrap.servers (list of brokers) properties.

Running Redis

Start Redis is explained in official documentation (https://redis.io/docs/getting-started/). If your Redis instance is intalled on the different machines, please specify the host/port at application.properties file.

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. By default, DH expects that the username is postgres and the password is 12345. You can change this in the DH configuration files.
  • Create database with the name devicehive using user that have been created at step 1. This user should be owner of database.
  • Database schema will be initialized on application startup.

Checking properties

Each microservice has its own src/main/resources/application.properties file which contains all application-level configurations (db credentials, redis address, kafka props etc.). Please check them before building application in order to avoid problems at runtime.

You can also override these values by passing them to JVM while running java -Dapplication.property.name=application.property.name -jar. For example:

java -Dbootstrap.servers=0.0.0.1:9092 -jar ${devicehive-jar}.jar
java -Dproxy.connect=0.0.0.1:3000 -jar ${devicehive-jar}.jar

DB connection properties are managed inside devicehive-rdbms-dao/src/main/resources/application-persistence.properties. To override them do the same:

java -Dspring.datasource.url=jdbc:postgresql://0.0.0.1:5432/devicehive -jar ${devicehive-jar}.jar
java -Dspring.datasource.username=test -Dspring.datasource.password=test -jar ${devicehive-jar}.jar

Running application

DeviceHive ecosystem contains of 3 mandatory and 1 optional services, namely Backend, Frontend, Auth and Plugin management (optional) micro services.

  • To start application, first run following command:

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

This will start Backend. Wait for the application to start, then run:

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

and

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

This will start embedded undertow application server on default port 8080 and deploy DeviceHive application. You can visit http://localhost:8080/dh/swagger from your web browser to start learning the frontend's APIs. Also you can visit http://localhost:8090/dh/swagger from your web browser to start learning the auth's APIs.

For devicehive-frontend and devicehive-backend logging level can be changed by adding the following properties to the command above:

-Droot.log.level=value1 -Dcom.devicehive.log.level=value2

The values can be: TRACE, DEBUG, INFO, WARN, ERROR. If the properties are absent the default values will be used. For devicehive-frontend and devicehive-auth default values for value1 and value2 are WARN and INFO correspondingly. For devicehive-backend the default value for both is INFO.

Plugin management service

There's one optional service inside DeviceHive ecosystem - Plugin Management service. It allows to register and to update DeviceHive plugins (that allow customers to implement their own business logic without diving into DeviceHive source code) via RESTful API.

To start it simply run following command:

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

Service will be started on 8110 port by default, so you can visit its swagger at http://localhost:8110/dh/swagger

More Repositories

1

devicehive-audio-analysis

Python
196
star
2

esp8266-firmware

DeviceHive esp8266 firmware. Control hardware via clouds with DeviceHive!
C
166
star
3

devicehive-video-analysis

Python
155
star
4

devicehive-docker

Run DeviceHive Docker containers with Docker Compose and on Kubernetes
Mustache
92
star
5

AlexaDevice

Alexa virtual device
Python
43
star
6

android-ble

DeviceHive Bluetooth Low Energy bridge for Android
Java
42
star
7

IoT-framework

* DEPRECATED * DeviceHive GO Framework for IoT and M2M
Go
40
star
8

devicehive-python

DeviceHive Python library
Python
30
star
9

framework

* DEPRECATED *
Java
29
star
10

devicehive-.net

DeviceHive .NET library
C#
26
star
11

devicehive-java

DeviceHive java client library
Java
24
star
12

devicehive-grafana-datasource

DeviceHive datasource for Grafana
JavaScript
18
star
13

devicehive-admin-console

[DEPRECATED] DeviceHive OLD admin console (For the newest version please follow https://github.com/devicehive/devicehive-admin-panel)
JavaScript
17
star
14

devicehive-mqtt

MQTT plugin for DeviceHive server
JavaScript
13
star
15

devicehive-obd2

DeviceHive gateway for OBD2 compatible cars
Java
10
star
16

devicehive-freeboard-datasource

DeviceHive datasource plugin for https://freeboard.io/
JavaScript
8
star
17

devicehive-admin-panel

TypeScript
7
star
18

devicehive-javascript

DeviceHive JavaScript Library. Works with NodeJs and browsers.
JavaScript
7
star
19

lora-gateway

Simple gateway implementation between LoRa and DeviceHive.
Python
7
star
20

devicehive-python-device-simulator

Device activity simulating tool.
Python
5
star
21

devicehive-python-webconfig

Simple web interface for devicehive-python
Python
5
star
22

devicehive-go

Golang client library for DeviceHive
Go
5
star
23

devicehive-uc

* DEPRECATED *
C
4
star
24

devicehive-cpp

* DEPRECATED *
C++
4
star
25

devicehive-demo

* DEPRECATED * DeviceHive Server + BLE Gateway Demo
JavaScript
4
star
26

devicehive-playground

DeviceHive Playground website leveraging multi-tenant DeviceHive deployment configuration
HTML
4
star
27

devicehive-arduino

* DEPRECATED * DeviceHive library for Arduino (binary protocol)
Arduino
4
star
28

devicehive-ws-proxy

JavaScript
4
star
29

devicehive-plugin-cassandra-node

DeviceHive Cassandra storage plugin. NodeJS implementation.
JavaScript
4
star
30

dcos-bridging

JavaScript
3
star
31

devicehive-tests

JavaScript
3
star
32

devicehive-plugin-ethereum

Devicehive plugin for smart contracts
JavaScript
3
star
33

devicehive-android

DeviceHive Android example
Java
3
star
34

devicehive-backend-node

JavaScript
2
star
35

alljoyn

* DEPRECATED * AllJoyn Projects Combined
Shell
2
star
36

devicehive-lights

Control your Christmas Lights with DeviceHive
Java
2
star
37

devicehive-.net-mf

* DEPRECATED *
C#
2
star
38

devicehive-plugin-java-template

Java
2
star
39

devicehive-plugin-core-node

DeviceHive custom plugin core functionality. NodeJS implementation
JavaScript
1
star
40

devicehive-rest-api-docs

Generated version of device hive rest api documentation
HTML
1
star
41

devicehive-proxy

Shell
1
star
42

devicehive-ios

* DEPRECATED *
Objective-C
1
star
43

openwrt-firmware

* DEPRECATED * OpenWrt Firmware with built-in DeviceHive support
Makefile
1
star
44

devicehive-mqx

* DEPRECATED * Devicehive cpp gateway example for Freescale MQX RTOS
C++
1
star
45

devicehive-landing-page

CSS
1
star
46

devicehive-coap-proxy

DeviceHive CoAP proxy
JavaScript
1
star
47

devicehive-proxy-message

DeviceHive proxy messages classes
JavaScript
1
star
48

android-sensors

* DEPRECATED * DeviceHive example of collecting statistics from android sensors
Java
1
star
49

devicehive-j2me

* DEPRECATED *
Java
1
star