Giter Site home page Giter Site logo

vmodule / devicehive-java-server Goto Github PK

View Code? Open in Web Editor NEW

This project forked from devicehive/devicehive-java-server

0.0 1.0 0.0 9.02 MB

DeviceHive Java Server

Home Page: http://www.devicehive.com

License: Apache License 2.0

Java 97.30% HTML 1.12% PLpgSQL 0.65% Shell 0.93%

devicehive-java-server's Introduction

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

We have published a DeviceHive docker container so you can utilize docker's virtualization features with DeviceHive. Check out DeviceHive on Docker Hub with the instructions on how to use it. You can check dockerfile implementation as well as the script for setting up a new instance running under nginx on DeviceHive 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}.

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 Hazelcast

To start download Hazelcast IMDG 3.8.1 from official site (https://hazelcast.org/download/), extract to local drive and create in Hazelcast bin folder file hzstart.sh with folling contents:

export JAVA_OPTS="$JAVA_OPTS -cp /path/to/jar/from/devicehive-hazelcast/devicehive-common-<version>-shade.jar:/path/to/HAZELCAST_HOME/lib/hazelcast-all-3.8.1.jar"
./start.sh

Replace

<serialization>
   <portable-version>0</portable-version>
</serialization>

with

<serialization>
   <portable-version>0</portable-version>
   <portable-factories>
        <portable-factory factory-id="1">com.devicehive.model.DevicePortableFactory</portable-factory>
   </portable-factories>
</serialization>

in hazelcast.xml localted in bin folder of hazelcast. Also replace all the map and and multimap sections of hazelcast.xml with:

<map name="default">
  <eviction-policy>LRU</eviction-policy>
</map>
<map name="NOTIFICATIONS-MAP">
  <time-to-live-seconds>120</time-to-live-seconds>
</map>
<map name="COMMANDS-MAP">
  <time-to-live-seconds>120</time-to-live-seconds>
</map>
<multimap name="default">
  <backup-count>0</backup-count>
  <async-backup-count>1</async-backup-count>
  <value-collection-type>SET</value-collection-type>
</multimap>

Run hzstart.sh. At this ensure that correct value of property hazelcast.cluster.members is installed in

/path/to/devicehive-java-server/devicehive-backend/src/main/resources/application.properties

You can also pass this property in JAVA_OPTS when running devicehive-backend.

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.

Running application

  • To start application, you have to start backend, frontend and auth microservices. To do this, first run following command:

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

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.

devicehive-java-server's People

Contributors

akrasikov avatar aleksandrpavlenko avatar alexkebkalo avatar amedviediev avatar andreylatysh avatar aovchinnikov avatar apanevin avatar azavgorodniy avatar demon-xxi avatar dendec avatar edubovik avatar floginov avatar glebpopov avatar jkulagina avatar jvovk avatar mdolbin avatar n-loboda avatar natalia-chikina avatar ogumennyi avatar oleksii-suprun avatar rroschin avatar sitnik avatar sorjef avatar stanislavsidorenko avatar stanislavsidorenkodataart avatar tmatvienko avatar vikua avatar yermakovsergiy avatar yuryoff avatar zubrabubra avatar

Watchers

 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.