Blame view

README.md 2.36 KB
a26a5bcb   hitier   Upgrade README
1
# Heliopropa Web
19268da3   Goutte   Initial commit.
2

a26a5bcb   hitier   Upgrade README
3
A web site writen in flask for the visualisation of solarwind propagation simulations.
19268da3   Goutte   Initial commit.
4

a26a5bcb   hitier   Upgrade README
5
Builds and serves heliopropa's visualizations.
19268da3   Goutte   Initial commit.
6

e5a796dc   Goutte   Update the readme...
7
It's a `flask` webserver, serving `d3.js` plots.
6b149919   Goutte   Add a Download bu...
8
It also gathers NetCDF data from AMDA, and serves it as CSV to the plotter.
19268da3   Goutte   Initial commit.
9

a26a5bcb   hitier   Upgrade README
10
## Files Overview
19268da3   Goutte   Initial commit.
11
12
13

- `config.yml` : the main configuration file.
- `web/run.py` : the front controller, holding most of the code.
6b2d7c9d   Goutte   Comment things.
14
- `web/run.log` : you'll find more information about failures in the log.
6b149919   Goutte   Add a Download bu...
15
- `web/view/home.html.jinja2` : the HTML template.
d1c44c51   Goutte   Enable Earth
16
- `web/static/js/swapp.ls` : most of the javascript client-side.
19268da3   Goutte   Initial commit.
17

265af181   hitier   Set Docker compos...
18
19
20
21
## Quick Start

    docker compose build
    docker compose up
19268da3   Goutte   Initial commit.
22

29551a9f   hitier   Update prerequisites
23
24
### Python venv

19268da3   Goutte   Initial commit.
25
``` bash
1db3095f   hitier   Update dependencies
26
python3 -m venv venv
19268da3   Goutte   Initial commit.
27
source venv/bin/activate
19268da3   Goutte   Initial commit.
28
29
30
pip install -r requirements.txt
```

19268da3   Goutte   Initial commit.
31
32
33
34
## Develop

``` bash
source venv/bin/activate
206d8d14   Goutte   Clean up.
35
DEBUG=true python web/run.py
19268da3   Goutte   Initial commit.
36
37
38
```

Then, browse [localhost:5000](http://localhost:5000).
5ef50583   Goutte   Clean up.
39

a26a5bcb   hitier   Upgrade README
40
## Gunicorn and Nginx deployment on OVH for development
8cfeb607   hitier   More install and ...
41
42
43
44

see [ Digital Ocean documentation ] (https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-gunicorn-and-nginx-on-ubuntu-20-04-fr)


a26a5bcb   hitier   Upgrade README
45
### wep app service and Gunicorn
8cfeb607   hitier   More install and ...
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

see ./resources/heliopropa.service

/etc/systemd/system/heliopropa.service

    [Unit]
    Description=Gunicorn instance to serve Heliopropa
    After=network.target

    [Service]
    User=debian
    Group=www-data
    WorkingDirectory= /home/debian/heliopropa/
    Environment="PATH=/home/debian/heliopropa/venv/bin/"
    ExecStart=/home/debian/heliopropa/venv/bin/gunicorn --workers 3 --bind unix:heliopropa.sock -m 007 web.run:app

    [Install]
    WantedBy=multi-user.target

a26a5bcb   hitier   Upgrade README
65
### Nginx
8cfeb607   hitier   More install and ...
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81

see ./resources/heliopropa.nginx

/etc/nginx/sites-available/heliopropa

	server {
		listen 80;
		server_name heliopropa heliopropa.co-libri.org;

		location / {
			include proxy_params;
			proxy_pass http://unix:/home/debian/heliopropa/heliopropa.sock;
		}
	}


a26a5bcb   hitier   Upgrade README
82
### Start and Allow at system reboot
8cfeb607   hitier   More install and ...
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106

	sudo systemctl start nginx
	sudo systemctl start heliopropa 
	sudo systemctl enable heliopropa 


## Git hook auto deploy

see ./resources/post-receive.git-hook

Set bare repo with hook  on vps

    ssh user@vps
    git clone --bare path-to-heliopropa-repo heliopropa.git
    cd heliopropa.git/hooks
    vim post-receive
    chmod +x post-receive



Push from dev computer

    git remote add helio-dev user@vps:heliopropa.git
    git push heliopropa HEAD:DEV