vera / backend /README.md
liujch1998's picture
Chrome extension
c942159
|
raw
history blame
1.59 kB
# 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"
```