Giter Club home page Giter Club logo

iotea-hb's Introduction

We deployed the website on CentOS7. Following steps will show you how to deploy.

Step 1. Install Python3

sudo yum -y install epel-release
sudo yum -y install python36

Step 2. Install Python pip and virtual enviroment

wget https://bootstrap.pypa.io/get-pip.py
sudo python36 get-pip.py
sudo pip install virtualenv

Setp 3. Clone our website from GitHub

sudo yum -y install git
git clone https://github.com/SeeedDocument/iotea-hb.git

Step 4. Create and activate virtual enviroment

virtualenv -p python36 iotea-hb
cd iotea-hb
source bin/activate

Step 5. Install dependent libraries

pip install pymysql
pip install dbutils
pip install flask
pip install websocket-client
pip install cofigparser

Step 6. Create database

sudo yum -y install mariadb mariabd-server
sudo systemctl enable mariadb
sudo systemctl start mariadb
mysql -uroot -p

and then use iotea_hb.sql to create a table.

Step 7. Create db.ini, and write these codes to it

[db]
db_port = 3306
db_user = root
db_host = localhost
db_pass = 
db_name = iotea

change db.ini's path in db.py

# in db.py
#cf.read("/data/www/python3_iotea_hb/iotea/conf/db.ini")
cf.read("/home/<your_username>/iotea-hb/db.ini")

Step 8. Change port in app.py and start the website:

# in app.py
#app.run(debug=True, port=6000)
app.run(debug=True, port=8080)

# in terminal
pip install gunicorn
gunicorn -w 5 -b 0.0.0.0:8080 app:app

now visit 127.0.0.1:8080 in your web browser, you can see the website, but real-time data is not displayed.

Step 9. Get loriot data

Open another terminal, reenter virtual enviroment and start loriot app:

cd iotea-hb
source bin/activate
gunicorn loriot:app 

Wait for a while, you will see data displayed in website, or you can change wss in loriot.py:

# in loriot.py
#ws = create_connection("wss://cn1.loriot.io/app?token=vnwEuwAAAA1jbjEubG9yaW90LmlvRpscoh9Uq1L7K1zbrcBz6w==")
ws = create_connection(<your_wss>)

iotea-hb's People

Contributors

lets-blu avatar xyu6 avatar

Watchers

James Cloos avatar Jack Shao avatar  avatar Lambor  avatar  avatar  avatar  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.