Blame view

README.md 2.49 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

641893b9   hitier   Add solar-orbiter...
23
24
## Develop

9ecb6089   hitier   Move config name ...
25
26
27
28
29
30
31
### Configuration

``` bash
cp config.yml-dist config.yml
$(EDITOR) config.yml # but defaults should be ok
```

29551a9f   hitier   Update prerequisites
32
33
### Python venv

19268da3   Goutte   Initial commit.
34
``` bash
1db3095f   hitier   Update dependencies
35
python3 -m venv venv
19268da3   Goutte   Initial commit.
36
source venv/bin/activate
19268da3   Goutte   Initial commit.
37
38
39
pip install -r requirements.txt
```

641893b9   hitier   Add solar-orbiter...
40
### Run locally
19268da3   Goutte   Initial commit.
41
42
``` bash
source venv/bin/activate
206d8d14   Goutte   Clean up.
43
DEBUG=true python web/run.py
19268da3   Goutte   Initial commit.
44
45
46
```

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

a26a5bcb   hitier   Upgrade README
48
## Gunicorn and Nginx deployment on OVH for development
8cfeb607   hitier   More install and ...
49
50
51
52

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
53
### wep app service and Gunicorn
8cfeb607   hitier   More install and ...
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72

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
73
### Nginx
8cfeb607   hitier   More install and ...
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89

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
90
### Start and Allow at system reboot
8cfeb607   hitier   More install and ...
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114

	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