GithubHelp home page GithubHelp logo

device-manager's Introduction

DeviceManager

License badge Docker badge

The DeviceManager handles all operations related to creation, retrieval, update and deletion of devices in dojot. For more information on that, check this file.

Dependencies

DeviceManager has the following dependencies:

  • flask (including flask_sqlalchemy)
  • psycopg2
  • marshmallow
  • requests
  • gunicorn
  • gevent
  • json-logging-py
  • kakfa-python

But you won't need to worry about installing any of these - they are automatically installed when starting DeviceManager. There must be, though, a postgres instance accessible by DeviceManager.

How to run

If you really need to run DeviceManager as a standalone process (without dojot's wonderful docker-compose), we suggest using the minimal compose file available under docker/compose.yml. That contains only the set of external systems (postgres and kafka) that are used by device manager to implement its features. To have this minimal environment running, please:

# spin up local copies of remote dependencies
docker-compose -f local/compose.yml -p devm up -d
# Builds devm container (this may take a while)
docker build -f Dockerfile -t local/devicemanager .
# Runs devm manually, using the infra that's been just created
docker run --rm -it --network devm_default local/devicemanager
#
# Hitting ^C will actually kill device-manager's process and the container
#

"Ok, but I really want to run device manager on my machine - no docker no nothing."

You can execute the following commands (it's just what runs in the container, actually - check docker/entrypoint.sh and Dockerfile).

# install dependencies locally (may take a while)
python setup.py develop

export DBHOST="postgres ip/hostname goes here"
export KAFKA_HOST="kafka ip/hostname goes here"

docker/waitForDb.py
gunicorn DeviceManager.main:app -k gevent --logfile - --access-logfile -

Do notice that all those external infra (kafka and postgres) will have to be up and running still. At a minimum, please remember to configure the two environment variables above, to their real values (specially if they are both localhost).

Keep in mind that running a standalone instance of DeviceManager misses a lot of security checks (such as user identity checks, proper multi-tenancy validations, and so on). In particular, every request sent to DeviceManager needs an access token, which should be retrived from auth component. In the examples listed in this README, you can generate one by yourself (for now, DeviceManager doesn't check if the token is actually valid for that user - they are verified by auth and the API gateway) but this method might not work in the future as more strict token checks are implemented in DeviceManager.

How to use

There are a few examples on how to use DeviceManager in this page.

device-manager's People

Contributors

alexandre-vasc avatar aluisribeiro avatar andersonluisribeiro avatar cfrancisco avatar eliasreis54 avatar felipemuhamed avatar giovannicuriel avatar jsiloto avatar mmagr avatar pedropaulomartucci avatar rascaraficci avatar raulnegreiros avatar

Watchers

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