summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-10-16 14:10:15 +0300
committerDevaev Maxim <[email protected]>2020-10-16 14:10:15 +0300
commit923320da5f87d6081824641468b3777d7f1e811f (patch)
treec241034fb38a3c124cd0946883bb0c26bb8b01d6
parent9860ed0871a8ae00018c9e99340d904815e70a25 (diff)
PR #15: https for local run
-rw-r--r--.dockerignore1
-rw-r--r--.gitignore1
-rw-r--r--Makefile19
-rw-r--r--testenv/nginx.append.conf8
4 files changed, 27 insertions, 2 deletions
diff --git a/.dockerignore b/.dockerignore
index 1860f9f4..7cacc371 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -7,6 +7,7 @@
/testenv/run/
/testenv/.tox/
/testenv/.mypy_cache/
+/testenv/.ssl/
/.git/
/v*.tar.gz
/*.pkg.tar.xz
diff --git a/.gitignore b/.gitignore
index b81260db..2ed535c9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,7 @@
/testenv/.coverage
/testenv/run/*.sock
/testenv/run/*.pid
+/testenv/.ssl/
/v*.tar.gz
/*.pkg.tar.xz
/*.pkg.tar.zst
diff --git a/Makefile b/Makefile
index b9cf0326..fe608795 100644
--- a/Makefile
+++ b/Makefile
@@ -78,7 +78,18 @@ $(TESTENV_GPIO):
test -c $(TESTENV_GPIO)
-run: testenv $(TESTENV_GPIO)
+run: testenv testenv-ssl $(TESTENV_GPIO)
+ test -d testenv/.ssl || docker run --rm \
+ --volume `pwd`:/src:ro \
+ --volume `pwd`/testenv:/src/testenv:rw \
+ -t $(TESTENV_IMAGE) bash -c " \
+ groupadd kvmd-nginx \
+ && /src/scripts/kvmd-gencert --do-the-thing \
+ && chown -R root:root /etc/kvmd/nginx/ssl \
+ && chmod 664 /etc/kvmd/nginx/ssl/* \
+ && chmod 775 /etc/kvmd/nginx/ssl \
+ && mv /etc/kvmd/nginx/ssl /src/testenv/.ssl \
+ "
- docker run --rm --name kvmd \
--cap-add SYS_ADMIN \
--volume `pwd`/testenv/run:/run/kvmd:rw \
@@ -95,11 +106,15 @@ run: testenv $(TESTENV_GPIO)
--env KVMD_PROCFS_PREFIX=/fake_procfs \
$(if $(TESTENV_RELAY),--device $(TESTENV_RELAY):$(TESTENV_RELAY),) \
--publish 8080:80/tcp \
+ --publish 4430:443/tcp \
-it $(TESTENV_IMAGE) /bin/bash -c " \
mount -t debugfs none /sys/kernel/debug \
&& test -d /sys/kernel/debug/gpio-mockup/`basename $(TESTENV_GPIO)`/ \
&& (socat PTY,link=$(TESTENV_HID) PTY,link=/dev/ttyS11 &) \
&& cp -r /usr/share/kvmd/configs.default/nginx/* /etc/kvmd/nginx \
+ && sed -i '$$ s/.$$//' /etc/kvmd/nginx/nginx.conf \
+ && cat testenv/nginx.append.conf >> /etc/kvmd/nginx/nginx.conf \
+ && cp -a /testenv/.ssl /etc/kvmd/nginx/ssl \
&& cp /usr/share/kvmd/configs.default/kvmd/*.yaml /etc/kvmd \
&& cp /usr/share/kvmd/configs.default/kvmd/*passwd /etc/kvmd \
&& cp /usr/share/kvmd/configs.default/kvmd/main/$(if $(P),$(P),$(DEFAULT_PLATFORM)).yaml /etc/kvmd/main.yaml \
@@ -216,7 +231,7 @@ clean:
clean-all: testenv clean
- docker run --rm \
--volume `pwd`:/src \
- -it $(TESTENV_IMAGE) bash -c "cd src && rm -rf testenv/{.tox,.mypy_cache,.coverage}"
+ -it $(TESTENV_IMAGE) bash -c "cd src && rm -rf testenv/{.ssl,.tox,.mypy_cache,.coverage}"
.PHONY: testenv
diff --git a/testenv/nginx.append.conf b/testenv/nginx.append.conf
new file mode 100644
index 00000000..04a33b6c
--- /dev/null
+++ b/testenv/nginx.append.conf
@@ -0,0 +1,8 @@
+ server {
+ listen 443 ssl http2;
+ server_name localhost;
+ include /etc/kvmd/nginx/ssl.conf;
+ include /etc/kvmd/nginx/kvmd.ctx-server.conf;
+ include /usr/share/kvmd/extras/*/nginx.ctx-server.conf;
+ }
+}