Spaces:
Sleeping
Sleeping
Add post-execution cleanup to run.sh, add static route
Browse files- nginx.conf +15 -0
- run.sh +9 -1
- static/index.html +1 -0
nginx.conf
CHANGED
@@ -32,4 +32,19 @@ server {
|
|
32 |
proxy_read_timeout 86400;
|
33 |
proxy_redirect off;
|
34 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
}
|
|
|
32 |
proxy_read_timeout 86400;
|
33 |
proxy_redirect off;
|
34 |
}
|
35 |
+
|
36 |
+
location /static {
|
37 |
+
# Serve backend http server from port 8000
|
38 |
+
rewrite ^/static/?(.*)$ /$1 break; # strip the /static/
|
39 |
+
proxy_pass http://localhost:8000;
|
40 |
+
proxy_http_version 1.1;
|
41 |
+
proxy_set_header Upgrade $http_upgrade;
|
42 |
+
proxy_set_header Connection 'upgrade';
|
43 |
+
proxy_set_header Host $host;
|
44 |
+
proxy_set_header X-Real-IP $remote_addr;
|
45 |
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
46 |
+
proxy_cache_bypass $http_upgrade;
|
47 |
+
proxy_read_timeout 86400;
|
48 |
+
proxy_redirect off;
|
49 |
+
}
|
50 |
}
|
run.sh
CHANGED
@@ -4,4 +4,12 @@
|
|
4 |
service nginx start
|
5 |
|
6 |
# start the processes
|
7 |
-
python
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
service nginx start
|
5 |
|
6 |
# start the processes
|
7 |
+
python -m http.server --directory ./static --bind 0.0.0.0 8000 & echo $! > http_server.pid
|
8 |
+
python api.py & echo $!> api.pid
|
9 |
+
python app.py # blocking
|
10 |
+
|
11 |
+
# when unblocked, kill other processes and clean up
|
12 |
+
pkill -F http_server.pid
|
13 |
+
pkill -F api.pid
|
14 |
+
rm http_server.pid
|
15 |
+
rm api.pid
|
static/index.html
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
hello
|