For deployment skip below to deployment.
Setup a venv and source it
python3 -m venv venv
source venv/bin/activate
update pip
(venv)$ pip install --upgrade pip
Install this package and it's requirements with
(venv)$ pip install .
Add a
-e
flag to make it editable if you're changing the code or regularly updating the repo
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
make
make test
sudo make install
Build the simulation data
(venv)$ python -m rfind_monitor.sim.data_gen
To use the local zmq simulation, move the new
data.h5
file into/rfind_monitor/sim/
.
Run the app.
(venv)$ python -m rfind_monitor.frontend.dash
In a separate terminal (sourcing the same venv) run the Redis server
(venv)$ python -m rfind_monitor.backend.redis_store
In a separate terminal (sourcing the same venv) run the middle man.
(venv)$ python -m rfind_monitor.backend.middle_man
In a separate terminal (sourcing the same venv) run the data server
(venv)$ python -m rfind_monitor.sim.zmq_pusher
The middle man handles the zmq binding that has data pushed to it and writes that to the Redis storage.
-
Spin up CC cloud instance (Ubuntu 20.04) using the quick start guide.
-
SSH into the VM.
-
Update the VM with
sudo apt update
andsudo apt upgrade
-
Install some dependencies with
sudo apt install apache2 libapache2-mod-wsgi-py3 python3-venv
(which we'll use to serve both the application and the data) -
Clone this repo into
/home/ubuntu/
then install the venv and this package as described above. Make sure to install redis as well as decribed above. -
Make a folder in the home directory to host the server
cd mkdir public_html mkdir public_html/data mkdir public_html/wsgi
-
Create a file
public_html/wsgi/dash.wsgi
that contains#!/usr/bin/python3 import sys sys.path.insert(0, "/home/ubuntu/rfind-monitor/venv/lib/python3.8/site-packages") from rfind_monitor.frontend.dash import server as application
-
Create a file
/etc/apache2/sites-available/dash.conf
that containsWSGIDaemonProcess dash user=ubuntu group=ubuntu home=/home/ubuntu threads=5 socket-user=#33 WSGIScriptAlias /live /home/ubuntu/public_html/wsgi/dash.wsgi WSGIProcessGroup dash WSGIApplicationGroup %{GLOBAL}
-
Edit
/etc/apache2/sites-available/000-default.conf
:- Change the line
DocumentRoot /var/www
toDocumentRoot /home/ubuntu/public_html
- Change the line
-
Edit
/etc/apache2/apache2.conf
- Change the line
<Directory /var/www/>
to<Directory /home/ubuntu/public_html/>
. - Add
RedirectMatch ^/$ /live
to the bottom of the file.
- Change the line
-
Enable the new wsgi site using
sudo /usr/sbin/a2ensite dash.conf
-
Restart the apache server with
sudo systemctl reload apache2
. -
Move the redis service file into its location and start the service.
sudo cp /home/ubuntu/rfind-monitor/conf/redis.service /etc/systemd/system/redis.service sudo systemctl enable /etc/systemd/system/redis.service sudo systemctl start redis.service
There are also a few lines you need to add to the
redis.conf
file - ask Nick for details. -
Move the middle man service file into its location and start the service.
sudo cp /home/ubuntu/rfind-monitor/conf/middleman.service /etc/systemd/system/middleman.service sudo systemctl enable /etc/systemd/system/middleman.service sudo systemctl start middleman.service
1 Intro to client-side callbacks and the extendData method.
2 Seems like someone was having this exact problem with large images. Will need to look into shaders.
3 Not much in here honestly. The user was on the wrong py version.
4 Explains wsgi conf file.
5 An example.
6 I always forgot this. Don't forget to a2ensuite
!