Compare commits
6 Commits
POCONSOLE-
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c8c7e4d59c | ||
|
|
4a8d440bae | ||
|
|
18bc2937b5 | ||
|
|
aef753a3e8 | ||
|
|
e751540ee6 | ||
|
|
4305685acb |
37
README.md
Normal file
37
README.md
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
# Henry Pump Datalogger Website #
|
||||||
|
|
||||||
|
## Installation ##
|
||||||
|
|
||||||
|
### Prerequisites ###
|
||||||
|
- Set the FQDN for your device in /etc/hosts
|
||||||
|
```
|
||||||
|
127.0.0.1 device.company.poconsole.net device
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
#!bash
|
||||||
|
|
||||||
|
sudo apt-get install build-essential python-dev libssl-dev libffi-dev python-pip
|
||||||
|
pip install -r requirements.txt
|
||||||
|
```
|
||||||
|
- Install the [pycomm](https://github.com/ruscito/pycomm) module for python
|
||||||
|
- Install the [pycomm-helper](https://github.com/Henry-Pump/Pycomm-Helper) module for python
|
||||||
|
|
||||||
|
### DataLogger Website ###
|
||||||
|
|
||||||
|
```
|
||||||
|
#!bash
|
||||||
|
|
||||||
|
chmod +x start.sh webserver.sh renew_certs.sh
|
||||||
|
sudo cp webserver.sh /etc/init.d/webserver
|
||||||
|
sudo update-rc.d webserver defaults
|
||||||
|
```
|
||||||
|
|
||||||
|
### Database Setup ###
|
||||||
|
|
||||||
|
To set up the database and seed the POC tag data into the database run:
|
||||||
|
```
|
||||||
|
#!bash
|
||||||
|
|
||||||
|
python setupdb.py seed
|
||||||
|
```
|
||||||
@@ -53,7 +53,7 @@ poconsole.factory('Tag',function($q, $http, $log, dateConversion){
|
|||||||
var deferred = $q.defer();
|
var deferred = $q.defer();
|
||||||
$http.get('/api/latest').success(function(data) {
|
$http.get('/api/latest').success(function(data) {
|
||||||
var vals = data.map(function(v){
|
var vals = data.map(function(v){
|
||||||
v.created_on = Date.create(v.created_on + "Z", { fromUTC: true });
|
v.datetime = Date.create(v.datetime + "Z", { fromUTC: true });
|
||||||
return v;
|
return v;
|
||||||
});
|
});
|
||||||
deferred.resolve(vals);
|
deferred.resolve(vals);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ pyOpenSSL==16.2.0
|
|||||||
python-dateutil==2.6.0
|
python-dateutil==2.6.0
|
||||||
python-mimeparse==1.6.0
|
python-mimeparse==1.6.0
|
||||||
requests==2.12.1
|
requests==2.12.1
|
||||||
|
service_identity=16.0.0
|
||||||
six==1.10.0
|
six==1.10.0
|
||||||
SQLAlchemy==1.1.4
|
SQLAlchemy==1.1.4
|
||||||
Twisted==16.6.0
|
Twisted==16.6.0
|
||||||
|
|||||||
2
run.py
2
run.py
@@ -1,5 +1,5 @@
|
|||||||
from app import app
|
from app import app
|
||||||
import ssl
|
# import ssl
|
||||||
|
|
||||||
# context = ssl.SSLContext(protocol=ssl.PROTOCOL_TLSv1_2)
|
# context = ssl.SSLContext(protocol=ssl.PROTOCOL_TLSv1_2)
|
||||||
# context.load_cert_chain('/Users/patrickjmcd/Henry_Pump/tagserver/web_db/flask/app/hplumberjack.crt', '/Users/patrickjmcd/Henry_Pump/tagserver/web_db/flask/app/hplumberjack.key')
|
# context.load_cert_chain('/Users/patrickjmcd/Henry_Pump/tagserver/web_db/flask/app/hplumberjack.crt', '/Users/patrickjmcd/Henry_Pump/tagserver/web_db/flask/app/hplumberjack.key')
|
||||||
|
|||||||
4
start.sh
4
start.sh
@@ -1,5 +1,3 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
OLDDIR=$PWD
|
export PYTHONPATH=${PYTHONPATH}:/root/www
|
||||||
cd /root/www
|
|
||||||
twistd --pidfile=/root/webserver.pid web --https=5000 --wsgi app.app -c /root/ssl/poconsole.crt -k /root/ssl/poconsole.key
|
twistd --pidfile=/root/webserver.pid web --https=5000 --wsgi app.app -c /root/ssl/poconsole.crt -k /root/ssl/poconsole.key
|
||||||
cd $OLDDIR
|
|
||||||
|
|||||||
9
webserver.service
Normal file
9
webserver.service
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Datalogger Web Server
|
||||||
|
After=syslog.target network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/root/www/start.sh
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
Reference in New Issue
Block a user