weatherbox:dashboard:start

Dashboard

Visible at http://dashboard.scel-hawaii.org the dashboard provides a means for anyone to access and view the data we are collecting. A module of the Unified Software Team.

Dashboard Repository:



  • Better handling of data
    • Faster load times
    • Generating plots on client using JavaScript
  • Display data across generations on a single plot
    • Allow for comparison of data between boxes
    • Current plotting function allows for generating plots with data from multiple boxes
  • Collaborate with Forecasting team
    • Apply their algorithms to display weather “predictions”
  • Implement real-time updating plots
  • Improve quality of viewing on mobile devices

  • Provide human readable data for the other lab members and general public
  • Effectively and accurately display gathered data for each weatherbox generation


  1. Install Python
  2. Install pip
  3. pip install plotly
  4. pip install numpy
  5. pip install django
  6. Verify dashboard is working by running the following command on master branch: python manage.py runserver
  7. On web browser go to 127.0.0.1:8000 to view the dashboard
  8. If you don't see it or get an error, something went wrong
  • You can also use a virtualenvironment for the Python packages if you wish
  1. Launch a virtual machine of your choice (I chose Ubuntu on VirtualBox)
  2. Follow the instructions for 'Working on Dashboard Development WITHOUT Database Connection' on your virtual machine
  3. Outside of the dashboard project directory, clone the git repository at http://github.com/scel-hawaii/control_tower
  4. Run control_tower/sample_data/setup_sample_tables.sh to setup database and tables with sample weatherbox data
  5. Switch to psql branch of dashboard (in Dashboard project enter command git checkout psql)
  6. Run dashboard with following command: python manage.py runserver
  7. Should generate graphs with database data instead of csv

Follow the following steps to for deploying the dashboard on a server

  1. Install and Configure VirtualEnv and VirtualEnvWrapper
    1. sudo apt-get install python-pip (skip this if pip already installed)
    2. sudo pip install virtualenv virtualenvwrapper
    3. echo “export WORKON_HOME=~/Env” » ~/.bashrc
    4. echo “source /usr/local/bin/virtualenvwrapper.sh” » ~/.bashrc
    5. source ~/.bashrc
  2. Setup Dashboard Django Project
    1. sudo apt-get install git (skip this if git already installed)
    2. cd ~
    3. mkvirtualenv dashboard
    4. git clone http://github.com/scel-hawaii/dashboard (provide credentials to access private dashboard repo)
    5. cd Dashboard/Dashboard
    6. pip install django psycopg2 plotly numpy
    7. python manage.py collectstatic
    8. test django app working properly with: python manage.py runserver 127.0.0.1:8080
    9. exit virtualenv with: deactivate
  3. Setup uWSGI Application Server
    1. sudo apt-get install python-dev
    2. sudo pip install uwsgi
    3. quickly test uWSGI with: uwsgi –http :8080 –home /home/user/Env/dashboard –chdir /home/user/dashboard/dashboard -w dashboard.wsgi (in the currently deployed dashboard, user is replaced with control_tower)
    4. sudo mkdir -p /etc/uwsgi/sites
    5. cd /etc/uwsgi/sites
    6. create file called dashboard.ini with your favorite editor (ex: vim) and insert the following contents:
      [uwsgi]
      project = dashboard
      base = /home/**user**
      
      chdir = %(base)/%(project)/%(project)
      home = %(base)/Env/%(project)
      module = %(project).wsgi:application
      
      master = true
      processes = 5
      
      socket = %(base)/%(project)/%(project)/%(project).sock
      chmod-socket = 666
      vacuum = true
    7. create file at /etc/systemd/system/uwsgi.service with editor (ex: vi /etc/systemd/system/uwsgi.service) and insert the following contents:
      [Unit]
      Description=uWSGI Emperor service
      After=syslog.target
      
      [Service]
      ExecStart=/usr/local/bin/uwsgi --emperor /etc/uwsgi/sites
      Restart=always
      KillSignal=SIGQUIT
      Type=notify
      StandardError=syslog
      NotifyAccess=all
      
      [Install]
      WantedBy=multi-user.targetr.target
    8. sudo systemctl daemon-reload
  4. Configure Nginx
    1. create file at /etc/nginx/sites-available/dashboard with your favorite editor (ex: vi /etc/nginx/sites-available/dashboard) and insert the following contents:
      server {
          listen 80;
          server_name dashboard.scel-hawaii.org www.dashboard.scel-hawaii.org;
      
          location = /favicon.ico { access_log off; log_not_found off; }
          location /static/ {
              root /home/**user**/dashboard/dashboard;
          }
      
          location / {
              include         uwsgi_params;
              uwsgi_pass      unix:/home/**user**/dashboard/dashboard/dashboard.sock;
          }
      }
    2. sudo ln -s /etc/nginx/sites-available/dashboard /etc/nginx/sites-enabled
    3. Check syntax with: sudo service nginx configtest (if errors exist, fix before proceeding)
    4. sudo service nginx restart
    5. sudo systemctl start uwsgi
    6. To start uWSGI on reboot: sudo systemctl enable uwsgi

  • Noticeable load time of plots causing entire page to hang
    • Utilize separate process to handle plot generation
    • Load the plots with HTTP Request to specific url

Authors

Contributing authors:

tbyers

Created by tbyers on 2017/05/01 07:04.

  • weatherbox/dashboard/start.txt
  • Last modified: 2021/09/19 21:59
  • (external edit)