summaryrefslogtreecommitdiff
path: root/kvmd
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2018-07-08 22:02:44 +0000
committerDevaev Maxim <[email protected]>2018-07-08 22:02:44 +0000
commit5efc812f425461262d133379ad86200833ab3f01 (patch)
tree7a1f6835c53d1f0ba418ad316539560737600022 /kvmd
parent67860c2e8de4b28f33ab32c461fc61fec3cc23c7 (diff)
nginx inside testenv
Diffstat (limited to 'kvmd')
-rw-r--r--kvmd/Makefile3
-rw-r--r--kvmd/testenv/nginx.conf76
2 files changed, 78 insertions, 1 deletions
diff --git a/kvmd/Makefile b/kvmd/Makefile
index d9e6d8fb..0f23dfb3 100644
--- a/kvmd/Makefile
+++ b/kvmd/Makefile
@@ -2,7 +2,8 @@ TESTENV_IMAGE ?= kvmd-testenv
TESTENV_VIDEO ?= /dev/video0
TESTENV_LOOP ?= /dev/loop7
TESTENV_CMD ?= /bin/bash -c " \
- ln -s $(TESTENV_VIDEO) /dev/kvmd-streamer \
+ nginx -c /testenv/nginx.conf \
+ && ln -s $(TESTENV_VIDEO) /dev/kvmd-streamer \
&& (losetup -d /dev/kvmd-msd || true) \
&& losetup /dev/kvmd-msd /root/loop.img \
&& python -m kvmd -c testenv/kvmd.yaml \
diff --git a/kvmd/testenv/nginx.conf b/kvmd/testenv/nginx.conf
new file mode 100644
index 00000000..459feeb5
--- /dev/null
+++ b/kvmd/testenv/nginx.conf
@@ -0,0 +1,76 @@
+user http;
+worker_processes 4;
+
+# error_log /tmp/nginx.error.log;
+error_log /dev/null crit;
+
+events {
+ worker_connections 64;
+ use epoll;
+}
+
+http {
+ include /etc/nginx/mime.types;
+ default_type application/octet-stream;
+ charset utf-8;
+
+ sendfile on;
+ keepalive_timeout 10;
+ # gzip on;
+
+ upstream kvmd {
+ server localhost:8081 fail_timeout=0s max_fails=0;
+ }
+
+ upstream mjpg_streamer {
+ server localhost:8082 fail_timeout=0s max_fails=0;
+ }
+
+ server {
+ # access_log /tmp/nginx.access.log;
+ access_log off;
+
+ listen 8080;
+ server_name localhost;
+
+ client_body_temp_path /tmp/nginx.client_body_temp;
+ fastcgi_temp_path /tmp/nginx.fastcgi_temp;
+ proxy_temp_path /tmp/nginx.proxy_temp;
+ scgi_temp_path /tmp/nginx.scgi_temp;
+ uwsgi_temp_path /tmp/nginx.uwsgi_temp;
+
+ location / {
+ root /web;
+ index index.html;
+ }
+
+ location /kvmd/ws {
+ rewrite /kvmd/ws /ws break;
+ proxy_pass http://kvmd;
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection "upgrade";
+ proxy_connect_timeout 7d;
+ proxy_send_timeout 7d;
+ proxy_read_timeout 7d;
+ }
+
+ location /kvmd/msd/write {
+ rewrite /kvmd/msd/write /msd/write break;
+ proxy_pass http://kvmd;
+ limit_rate 6250k;
+ limit_rate_after 50k;
+ client_max_body_size 0;
+ proxy_request_buffering off;
+ }
+
+ location /kvmd {
+ rewrite /kvmd/?(.*) /$1 break;
+ proxy_pass http://kvmd;
+ }
+
+ location /streamer {
+ rewrite /streamer/?(.*) /$1 break;
+ proxy_pass http://mjpg_streamer;
+ }
+ }
+}