File size: 1,594 Bytes
c942159
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Vera backend

[http://qa.cs.washington.edu:8372/](http://qa.cs.washington.edu:8372/)

This demo runs on port 8372, so make sure this port is whitelisted in UFW:
```
sudo ufw allow 8372
sudo ufw status
```
Also, make sure port 80 and 443 are whitelisted.

This demo requires HTTPS, so make sure HTTPS is enabled on this server.
This is what I did:
1. Follwing <https://blog.miguelgrinberg.com/post/running-your-flask-application-over-https>
1. Make sure nginx is running: `sudo service nginx status`
1. Add the following lines to `/etc/nginx/nginx.conf`
```
    server {
        listen 80; 
        server_name qa.cs.washington.edu;
        location ~ /.well-known {
            root /home/gary/cd-pi-demo/backend;
        }   
        location / { 
            return 301 https://$host$request_uri;
        }   
    }   
```
1. Use certbot to create a certificate: `sudo certbot certonly --webroot -w /home/gary/cd-pi-demo/backend/ -d qa.cs.washington.edu`
1. Add the following lines to `/etc/nginx/nginx.conf`
```
    server {
        listen 443 ssl http2;
        server_name qa.cs.washington.edu;
        ssl_certificate /etc/letsencrypt/live/qa.cs.washington.edu/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/qa.cs.washington.edu/privkey.pem;
        # ... 
    }   
```

Then, run the following command to spin up the demo:
```
CUDA_VISIBLE_DEVICES=1 sudo ~/anaconda3/envs/default/bin/python run.py
```

To test the demo, run this command in bash:
```
curl https://qa.cs.washington.edu:8372 -X POST -d '{"statement": "Hello."}' -H "content-type: application/json"
```