Commit a26a5bcb0477ad0d08f678453b31696948e39e07
1 parent
f6260cb7
Exists in
rhitier-dev
Upgrade README
Showing
2 changed files
with
83 additions
and
83 deletions
Show diff stats
README.md
1 | +# Heliopropa Web | ||
1 | 2 | ||
2 | -## http://heliopropa.irap.omp.eu | 3 | +A web site writen in flask for the visualisation of solarwind propagation simulations. |
3 | 4 | ||
4 | -# What | 5 | +Builds and serves heliopropa's visualizations. |
5 | 6 | ||
6 | -## Web Server | ||
7 | - | ||
8 | -Build and serve heliopropa's visualizations. | ||
9 | It's a `flask` webserver, serving `d3.js` plots. | 7 | It's a `flask` webserver, serving `d3.js` plots. |
10 | It also gathers NetCDF data from AMDA, and serves it as CSV to the plotter. | 8 | It also gathers NetCDF data from AMDA, and serves it as CSV to the plotter. |
11 | 9 | ||
12 | - | ||
13 | -### Rationale | ||
14 | - | ||
15 | -- Reading NetCDF from javascript is doable, but still *very* hacky. | ||
16 | -- The bridge can handle pagination and collecting multiple NetCDF into one CSV. | ||
17 | - | ||
18 | - | ||
19 | -# How | ||
20 | - | ||
21 | -## Source | ||
22 | - | ||
23 | -https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE | ||
24 | - | ||
25 | - | ||
26 | -## Overview | 10 | +## Files Overview |
27 | 11 | ||
28 | - `config.yml` : the main configuration file. | 12 | - `config.yml` : the main configuration file. |
29 | - `web/run.py` : the front controller, holding most of the code. | 13 | - `web/run.py` : the front controller, holding most of the code. |
@@ -32,56 +16,14 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE | @@ -32,56 +16,14 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE | ||
32 | - `web/static/js/swapp.ls` : most of the javascript client-side. | 16 | - `web/static/js/swapp.ls` : most of the javascript client-side. |
33 | 17 | ||
34 | 18 | ||
35 | -## Install | ||
36 | - | ||
37 | -### Prerequisites | ||
38 | -gcc | ||
39 | -libncurses-dev | ||
40 | -python3 | ||
41 | -python3-virtualenv | ||
42 | -libapache2-mod-wsgi-py3 | ||
43 | - | ||
44 | ### Python venv | 19 | ### Python venv |
45 | 20 | ||
46 | ``` bash | 21 | ``` bash |
47 | python3 -m venv venv | 22 | python3 -m venv venv |
48 | source venv/bin/activate | 23 | source venv/bin/activate |
49 | -pip install matplotlib | ||
50 | -pip install numpy==1.8.* | ||
51 | pip install -r requirements.txt | 24 | pip install -r requirements.txt |
52 | ``` | 25 | ``` |
53 | 26 | ||
54 | -### CentOs 6 Shenanigans | ||
55 | - | ||
56 | -``` bash | ||
57 | -yum install https://centos6.iuscommunity.org/ius-release.rpm | ||
58 | -yum install python27* | ||
59 | -``` | ||
60 | - | ||
61 | -But then `virtualenv` yields | ||
62 | - | ||
63 | -``` | ||
64 | -File "/var/www/html/HELIOPROPA/web/run.py", line 24, in <module> | ||
65 | -[Fri Nov 30 14:30:38 2018] [error] [client 10.10.135.119] from netCDF4 import Dataset, date2num | ||
66 | -[Fri Nov 30 14:30:38 2018] [error] [client 10.10.135.119] File "/var/www/html/HELIOPROPA/venv/lib/python2.7/site-packages/netCDF4/__init__.py", line 3, in <module> | ||
67 | -[Fri Nov 30 14:30:38 2018] [error] [client 10.10.135.119] from ._netCDF4 import * | ||
68 | -[Fri Nov 30 14:30:38 2018] [error] [client 10.10.135.119] ImportError: /var/www/html/HELIOPROPA/venv/lib/python2.7/site-packages/netCDF4/_netCDF4.so: undefined symbol: PyUnicodeUCS2_FromStringAndSize | ||
69 | -``` | ||
70 | - | ||
71 | -_Solution:_ | ||
72 | -Configure Apache to use `web/run_ssa.wsgi` and use pip2.7 install system wide. | ||
73 | - | ||
74 | - | ||
75 | -### Install libcdf. | ||
76 | - | ||
77 | -``` bash | ||
78 | -wget https://spdf.gsfc.nasa.gov/pub/software/cdf/dist/cdf38_1/cdf38_1-dist-all.tar.gz | ||
79 | -tar -xzvf cdf38_1-dist-all.tar.gz | ||
80 | -cd cdf38_1-dist | ||
81 | -make all OS=linux ENV=gnu | ||
82 | -make INSTALLDIR=/usr/local/lib/libcdf install | ||
83 | -``` | ||
84 | - | ||
85 | ## Develop | 27 | ## Develop |
86 | 28 | ||
87 | ``` bash | 29 | ``` bash |
@@ -91,29 +33,12 @@ DEBUG=true python web/run.py | @@ -91,29 +33,12 @@ DEBUG=true python web/run.py | ||
91 | 33 | ||
92 | Then, browse [localhost:5000](http://localhost:5000). | 34 | Then, browse [localhost:5000](http://localhost:5000). |
93 | 35 | ||
94 | - | ||
95 | -## Troubleshoot | ||
96 | - | ||
97 | -### Installing scipy | ||
98 | - | ||
99 | -Getting `MemoryErrors` ? | ||
100 | -Try with the `--no-cache-dir` option. | ||
101 | - | ||
102 | -`pip install scipy --no-cache-dir` | ||
103 | - | ||
104 | -### Fix permissions problems with the cache | ||
105 | - | ||
106 | -``` | ||
107 | -sudo setfacl -R -m u:apache:rwx -m u:`whoami`:rwx cache | ||
108 | -sudo setfacl -dR -m u:apache:rwx -m u:`whoami`:rwx cache | ||
109 | -``` | ||
110 | - | ||
111 | -# Gunicorn and Nginx deployment on OVH for development | 36 | +## Gunicorn and Nginx deployment on OVH for development |
112 | 37 | ||
113 | see [ Digital Ocean documentation ] (https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-gunicorn-and-nginx-on-ubuntu-20-04-fr) | 38 | see [ Digital Ocean documentation ] (https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-gunicorn-and-nginx-on-ubuntu-20-04-fr) |
114 | 39 | ||
115 | 40 | ||
116 | -## wep app service and Gunicorn | 41 | +### wep app service and Gunicorn |
117 | 42 | ||
118 | see ./resources/heliopropa.service | 43 | see ./resources/heliopropa.service |
119 | 44 | ||
@@ -133,7 +58,7 @@ see ./resources/heliopropa.service | @@ -133,7 +58,7 @@ see ./resources/heliopropa.service | ||
133 | [Install] | 58 | [Install] |
134 | WantedBy=multi-user.target | 59 | WantedBy=multi-user.target |
135 | 60 | ||
136 | -## Nginx | 61 | +### Nginx |
137 | 62 | ||
138 | see ./resources/heliopropa.nginx | 63 | see ./resources/heliopropa.nginx |
139 | 64 | ||
@@ -150,7 +75,7 @@ see ./resources/heliopropa.nginx | @@ -150,7 +75,7 @@ see ./resources/heliopropa.nginx | ||
150 | } | 75 | } |
151 | 76 | ||
152 | 77 | ||
153 | -## Start and Allow at system reboot | 78 | +### Start and Allow at system reboot |
154 | 79 | ||
155 | sudo systemctl start nginx | 80 | sudo systemctl start nginx |
156 | sudo systemctl start heliopropa | 81 | sudo systemctl start heliopropa |
@@ -0,0 +1,75 @@ | @@ -0,0 +1,75 @@ | ||
1 | + | ||
2 | +## http://heliopropa.irap.omp.eu | ||
3 | + | ||
4 | +# What | ||
5 | + | ||
6 | + | ||
7 | +### Rationale | ||
8 | + | ||
9 | +- Reading NetCDF from javascript is doable, but still *very* hacky. | ||
10 | +- The bridge can handle pagination and collecting multiple NetCDF into one CSV. | ||
11 | + | ||
12 | + | ||
13 | +# How | ||
14 | + | ||
15 | +## Source | ||
16 | + | ||
17 | +https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE | ||
18 | + | ||
19 | + | ||
20 | +## Install | ||
21 | + | ||
22 | +### Prerequisites | ||
23 | +gcc | ||
24 | +libncurses-dev | ||
25 | +python3 | ||
26 | +python3-virtualenv | ||
27 | +libapache2-mod-wsgi-py3 | ||
28 | +### CentOs 6 Shenanigans | ||
29 | + | ||
30 | +``` bash | ||
31 | +yum install https://centos6.iuscommunity.org/ius-release.rpm | ||
32 | +yum install python27* | ||
33 | +``` | ||
34 | + | ||
35 | +But then `virtualenv` yields | ||
36 | + | ||
37 | +``` | ||
38 | +File "/var/www/html/HELIOPROPA/web/run.py", line 24, in <module> | ||
39 | +[Fri Nov 30 14:30:38 2018] [error] [client 10.10.135.119] from netCDF4 import Dataset, date2num | ||
40 | +[Fri Nov 30 14:30:38 2018] [error] [client 10.10.135.119] File "/var/www/html/HELIOPROPA/venv/lib/python2.7/site-packages/netCDF4/__init__.py", line 3, in <module> | ||
41 | +[Fri Nov 30 14:30:38 2018] [error] [client 10.10.135.119] from ._netCDF4 import * | ||
42 | +[Fri Nov 30 14:30:38 2018] [error] [client 10.10.135.119] ImportError: /var/www/html/HELIOPROPA/venv/lib/python2.7/site-packages/netCDF4/_netCDF4.so: undefined symbol: PyUnicodeUCS2_FromStringAndSize | ||
43 | +``` | ||
44 | + | ||
45 | +_Solution:_ | ||
46 | +Configure Apache to use `web/run_ssa.wsgi` and use pip2.7 install system wide. | ||
47 | + | ||
48 | + | ||
49 | +### Install libcdf. | ||
50 | + | ||
51 | +``` bash | ||
52 | +wget https://spdf.gsfc.nasa.gov/pub/software/cdf/dist/cdf38_1/cdf38_1-dist-all.tar.gz | ||
53 | +tar -xzvf cdf38_1-dist-all.tar.gz | ||
54 | +cd cdf38_1-dist | ||
55 | +make all OS=linux ENV=gnu | ||
56 | +make INSTALLDIR=/usr/local/lib/libcdf install | ||
57 | +``` | ||
58 | + | ||
59 | + | ||
60 | +## Troubleshoot | ||
61 | + | ||
62 | +### Installing scipy | ||
63 | + | ||
64 | +Getting `MemoryErrors` ? | ||
65 | +Try with the `--no-cache-dir` option. | ||
66 | + | ||
67 | +`pip install scipy --no-cache-dir` | ||
68 | + | ||
69 | +### Fix permissions problems with the cache | ||
70 | + | ||
71 | +``` | ||
72 | +sudo setfacl -R -m u:apache:rwx -m u:`whoami`:rwx cache | ||
73 | +sudo setfacl -dR -m u:apache:rwx -m u:`whoami`:rwx cache | ||
74 | +``` | ||
75 | + |