Overall architecture
Server layout
The flask web service is started by the following uwsgi command.
(py3env) [ec2-user@ip-172-31-2-230 seisfinder2]$ cat webservice-ec2.sh
#!/bin/bash
#sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 5000
/home/ec2-user/py3env/bin/uwsgi --http :5000 --http-websockets --plugin-dir ./ --plugins python37,gevent37 --gevent 1000 --mount /=webservice:sfapp --master --socket /run/seistech.sock --chmod-socket=777 --vacuum --die-on-term
This creates a socket /run/seistech.sock, and Nginx monitors this socket file to route the traffic from port 5000 to port 443. See the line marked with ( *) below from Nginx configuration.
/etc/nginx/nginx.conf
...
server { listen 80; server_name seistech.nz www.seistech.nz; return 301 <https://seistech.nz$request_uri;> } server { listen 80; server_name eap.seistech.nz; return 301 <https://eap.seistech.nz$request_uri;> } # Settings for a TLS enabled server. server { listen 443 ssl http2 default_server; listen [::]:443 ssl http2 default_server; server_name seistech.nz,www.seistech.nz; root /usr/share/nginx/html; ssl_certificate "/etc/letsencrypt/archive/seistech.nz/fullchain1.pem"; ssl_certificate_key "/etc/letsencrypt/archive/seistech.nz/privkey1.pem"; ssl_session_cache shared:SSL:1m; ssl_session_timeout 10m; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_serve # Load configuration files for the default server block.r_ciphers on; include /etc/nginx/default.d/*.conf; location / { rewrite /(.+) /$1 break; include uwsgi_params; uwsgi_pass unix:/run/seistech.sock; ----------------- (*) } } server { listen 443 ssl http2 ; listen [::]:443 ssl http2 ; server_name eap.seistech.nz; root /usr/share/nginx/html; ssl_certificate "/etc/letsencrypt/archive/seistech.nz/fullchain1.pem"; ssl_certificate_key "/etc/letsencrypt/archive/seistech.nz/privkey1.pem"; ssl_session_cache shared:SSL:1m; ssl_session_timeout 10m; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; include /etc/nginx/default.d/*.conf; location / { rewrite /(.+) /$1 break; include uwsgi_params; uwsgi_pass unix:/run/seistech_5001.sock; } }
Sequence Diagram
Requirements
- Create 'My projects' tab where users can see their past projects that they have run
- Crate class 'SingleLocationProject' (in future will have 'MultipleLocationProject')
- Minimum information for project (1) title (2) location (lat/lon)
- Additional project information includes Vs30 value. If differs too much from snapped location, flag.
- In Disagg calculator, allow project location to be selectable
Open / Create a New Project
Questions
Do we charge for each IM for the same location? (ie. different order for an IM?) |
Initially we focus on "products" - disaggregation and gm selection. Where user can freely play with various parameters without extra charge once purchased | |
Bulk order discount? If user wants all IMs? Do we set maximum threshold that gives everything? |
Monetisation scheme will be further explored later. | |
If a user-specified location is snapped to one location that matches an existing project : Should we merge this project to the existing one? (free of charge?) |
We charge again. Each project is linked to user-specified location (not snapped one, without detailed info of snapped one omitted). |
ER Diagram
Next Steps
- Reach an agreement on the architecture design
- Identify modules and separate them
- Determine input and output interface and document : Follow comment standards
- Implement DB and basic skeleton