Add some u-os app spefic stuff

This commit is contained in:
Albrecht Lohofener
2024-02-07 23:23:07 +01:00
parent d94a105e76
commit b5c10858ae
6 changed files with 81 additions and 7 deletions
-1
View File
@@ -33,7 +33,6 @@ COPY ./web /var/www/
COPY ./openwrt_additional /var/vm/openwrt_additional
RUN chmod +x /run/*.sh
RUN mv /var/www/nginx.conf /etc/nginx/http.d/web.conf
VOLUME /storage
EXPOSE 8006
+5 -5
View File
@@ -2,8 +2,8 @@ version: "3"
services:
qemu:
container_name: openwrt
#image: albrechtloh/qemu-openwrt:openwrt-23.05.1-2
image: "openwrt-docker-arm64"
image: albrechtloh/qemu-openwrt:openwrt-23.05.2-7
#image: "openwrt-docker-arm64"
environment:
DEBUG: "y"
@@ -19,14 +19,14 @@ services:
# USB passthrough
# Format <vendorID>:<productID> like 'lsusb' is given
# Currently only one USB device is supported
#USB_VID_1: "148f" # vendor ID
#USB_PID_1: "7601" # product ID
USB_VID_1: "148f" # vendor ID
USB_PID_1: "7601" # product ID
ports:
# Port 8006 is console tty web VNC
- 8006:8006
# Port 8000 is available only when Docker WAN network is used.
# Use script /root/fw_wan_open_http.sh to open the port
# Use script /usr/bin/fw_wan_open_http.sh to open the port
- 8000:8000
stop_grace_period: 2m
restart: on-failure
+1
View File
@@ -13,6 +13,7 @@ Images can be found a docker hub https://hub.docker.com/r/albrechtloh/qemu-openw
- KVM acceleration
- Web-based viewer for tty console
- Attaches two physical Ethernet interfaces exclusively into the docker container
- USB passthrough e.g. for modem or Wi-Fi
- Automatic config migration when OpenWrt is updated (experimental)
## Usage
+11 -1
View File
@@ -16,11 +16,12 @@ echo
# Docker environment variables
: "${CPU_COUNT:=""}" # Physical LAN interface name
: "${CPU_COUNT:=""}" # Physical LAN interface name
: "${WAN_IF:=""}" # Physical WAN interface name
: "${LAN_IF:=""}" # Physical LAN interface name
: "${USB_VID_1:=""}" # USB vendor ID
: "${USB_PID_1:=""}" # USB product ID
: "${IS_U_OS_APP:=""}" # By default this container is not a u-OS app
: "${DEBUG:="N"}" # Disable debugging
# Helper variables
@@ -51,6 +52,15 @@ if [ ! -d "$STORAGE" ]; then
error "Storage folder ($STORAGE) not found!" && exit 13
fi
# Check u-OS app
if [[ -z "${IS_U_OS_APP}" ]]; then
info "Detected generic container"
cp -f /var/www/nginx.conf.generic /etc/nginx/http.d/web.conf
else
info "Detected u-OS app"
cp -f /var/www/nginx.conf.u-os-app /etc/nginx/http.d/web.conf
fi
# Helper functions
isAlive() {
+64
View File
@@ -0,0 +1,64 @@
server {
listen 80;
listen [::]:80;
listen 8006 default_server;
listen [::]:8006 default_server;
autoindex on;
tcp_nodelay on;
server_tokens off;
absolute_redirect off;
error_log /dev/null;
access_log /dev/null;
include /etc/nginx/mime.types;
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 5;
gzip_min_length 500;
gzip_disable "msie6";
gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/json application/xml application/rss+xml font/truetype font/opentype application/vnd.ms-fontobject image/svg+xml;
add_header Cache-Control "no-cache";
location / {
root /run/shm;
if ( -f /run/shm/index.html) {
break;
}
try_files /index.html @vnc;
}
location @vnc {
root /usr/share/novnc;
index vnc.html;
if ($request_uri = "/") {
return 301 ?resize=scale&autoconnect=true&path=u-os-app-openwrt/websockify;
}
}
location /websockify {
proxy_http_version 1.1;
proxy_set_header Connection 'upgrade';
proxy_set_header Upgrade $http_upgrade;
proxy_buffering off;
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
proxy_pass http://127.0.0.1:5700/;
}
}