summaryrefslogtreecommitdiff
path: root/os/platforms/common
diff options
context:
space:
mode:
Diffstat (limited to 'os/platforms/common')
-rw-r--r--os/platforms/common/Dockerfile.part51
-rw-r--r--os/platforms/common/customizepkg.nginx1
-rw-r--r--os/platforms/common/motd17
-rw-r--r--os/platforms/common/sysctl.conf3
4 files changed, 72 insertions, 0 deletions
diff --git a/os/platforms/common/Dockerfile.part b/os/platforms/common/Dockerfile.part
new file mode 100644
index 00000000..e4308647
--- /dev/null
+++ b/os/platforms/common/Dockerfile.part
@@ -0,0 +1,51 @@
+RUN pkg-install \
+ nginx-mainline \
+ apache-tools \
+ raspberrypi-firmware \
+ v4l-utils \
+ python \
+ python-raspberry-gpio \
+ customizepkg
+RUN systemctl enable nginx
+
+COPY stages/pikvm-common/customizepkg.nginx /etc/customizepkg.d/nginx-mainline-mod-ndk
+COPY stages/pikvm-common/customizepkg.nginx /etc/customizepkg.d/nginx-mainline-mod-lua
+RUN env MAKEPKGOPTS="--skipchecksums --skippgpcheck" pkg-install nginx-mainline-mod-lua
+
+ARG USTREAMER_VERSION
+ENV USTREAMER_VERSION $USTREAMER_VERSION
+RUN echo $USTREAMER_VERSION
+RUN pkg-install ustreamer
+
+ARG KVMD_VERSION
+ENV KVMD_VERSION $KVMD_VERSION
+RUN echo $KVMD_VERSION
+RUN pkg-install kvmd
+RUN systemctl enable kvmd
+
+COPY stages/pikvm-common/sysctl.conf /etc/sysctl.d/99-pikvm.conf
+COPY stages/pikvm-common/motd /etc/
+
+RUN sed -i -e "s/console=ttyAMA0\,115200//g" /boot/cmdline.txt \
+ && sed -i -e "s/kgdboc=ttyAMA0\,115200//g" /boot/cmdline.txt
+RUN systemctl mask [email protected]
+
+RUN rm -rf /etc/nginx/* \
+ && cp /usr/share/kvmd/configs/nginx/* /etc/nginx/ \
+ && sed -i -e "s/^#PROD//g" /etc/nginx/nginx.conf
+
+ARG WEBUI_ADMIN_PASSWD
+ENV WEBUI_ADMIN_PASSWD $WEBUI_ADMIN_PASSWD
+RUN echo "$WEBUI_ADMIN_PASSWD" | htpasswd -ci /etc/nginx/htpasswd admin
+
+ARG NEW_HTTPS_CERT
+ENV NEW_HTTPS_CERT $NEW_HTTPS_CERT
+RUN echo $NEW_HTTPS_CERT
+RUN mkdir /etc/nginx/ssl \
+ && cd /etc/nginx/ssl \
+ && openssl req -new -x509 -nodes -newkey rsa:4096 -keyout server.key -out server.crt -days 3650 \
+ -subj "/C=RU/ST=Moscow/L=Moscow/O=Pi-KVM/OU=Pi-KVM/CN=localhost" \
+ && chmod 400 server.key \
+ && chmod 444 server.crt \
+ && chmod 750 /etc/nginx/ssl \
+ && chown -R root:http /etc/nginx/ssl
diff --git a/os/platforms/common/customizepkg.nginx b/os/platforms/common/customizepkg.nginx
new file mode 100644
index 00000000..5e7db5a4
--- /dev/null
+++ b/os/platforms/common/customizepkg.nginx
@@ -0,0 +1 @@
+replace#global#_nginxver=.*#_nginxver=`pacman -Q nginx-mainline | grep -Po "\\d+\\.\\d+\\.\\d+"`
diff --git a/os/platforms/common/motd b/os/platforms/common/motd
new file mode 100644
index 00000000..5b157c58
--- /dev/null
+++ b/os/platforms/common/motd
@@ -0,0 +1,17 @@
+ _____ _ _ ____ ____ __
+ | __ (_) | |/ /\ \ / / \/ |
+ | |__) | __ | ' / \ \ / /| \ / |
+ | ___/ | (__) | < \ \/ / | |\/| |
+ | | | | | . \ \ / | | | |
+ |_| |_| |_|\_\ \/ |_| |_|
+
+ Welcome to Pi-KVM - Open Source IP-KVM based on Raspberry Pi
+
+ Website: https://github.com/pi-kvm
+ ____________________________________________________________________________
+
+ The root filesystem of Pi-KVM is mounted in read-only mode by default.
+ Use command "rw" to remount it in the RW-mode and "ro" to switch it back.
+
+ To change Web UI password use command "htpasswd /etc/nginx/htpasswd admin".
+
diff --git a/os/platforms/common/sysctl.conf b/os/platforms/common/sysctl.conf
new file mode 100644
index 00000000..71db0efc
--- /dev/null
+++ b/os/platforms/common/sysctl.conf
@@ -0,0 +1,3 @@
+# https://github.com/raspberrypi/linux/issues/1753
+vm.dirty_background_bytes = 5
+vm.dirty_writeback_centisecs = 25