Table of Contents

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:


Current Status


Future Improvements


Goals (Spring 2017)


Block Diagram


Dashboard Testing/Development

Working on Dashboard Development WITHOUT Database Connection

  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

Working on Dashboard Development WITH Database Connection

  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

Dashboard Deployment

Deploying the Dashboard on Server

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

Problems/Resolutions


Authors

Contributing authors:

tbyers

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