Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Stand-alone Disagg app is completed


Sprint 29

Auth0FlaskPortal + Disagg app integrated

-----------

Overall architecture

Image RemovedImage Added



Server layout

Info

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;
    }
}

...