mirror of
https://github.com/AlbrechtL/openwrt-docker.git
synced 2026-10-18 16:01:38 +00:00
Exchange OliveTin by script-server
This commit is contained in:
+9
-4
@@ -13,17 +13,21 @@ RUN apk add --no-cache \
|
||||
qemu-hw-usb-redirect \
|
||||
nginx \
|
||||
netcat-openbsd \
|
||||
python3 \
|
||||
py3-pip \
|
||||
py3-virtualenv \
|
||||
&& mkdir -p /usr/share/novnc \
|
||||
&& wget https://github.com/novnc/noVNC/archive/refs/tags/v${NOVNC_VERSION}.tar.gz -O /tmp/novnc.tar.gz -q \
|
||||
&& tar -xf /tmp/novnc.tar.gz -C /tmp/ \
|
||||
&& cd /tmp/noVNC-${NOVNC_VERSION}\
|
||||
&& mv app core vendor package.json *.html /usr/share/novnc \
|
||||
&& wget https://github.com/OliveTin/OliveTin/releases/latest/download/OliveTin_linux_arm64.apk \
|
||||
&& apk add --allow-untrusted OliveTin_linux_arm64.apk \
|
||||
&& wget https://github.com/bugy/script-server/releases/download/1.18.0/script-server.zip \
|
||||
&& unzip -o script-server.zip -d /usr/share/script-server \
|
||||
&& python3 -m venv /var/lib/script-server-env \
|
||||
&& source /var/lib/script-server-env/bin/activate \
|
||||
&& pip install -r /usr/share/script-server/requirements.txt \
|
||||
&& sed -i 's/^worker_processes.*/worker_processes 1;/' /etc/nginx/nginx.conf
|
||||
|
||||
# export OPENWRT_VERSION=`date '+%Y%M%W'`_$OPENWRT_VERSION \
|
||||
|
||||
# Get OpenWrt images
|
||||
RUN mkdir /var/vm \
|
||||
&& if [ "$OPENWRT_VERSION" = "master" ] ; then \
|
||||
@@ -42,6 +46,7 @@ ENV OPENWRT_VERSION=${OPENWRT_VERSION}
|
||||
COPY ./src /run/
|
||||
COPY ./web /var/www/
|
||||
COPY ./openwrt_additional /var/vm/openwrt_additional
|
||||
COPY ./script-server /var/script-server
|
||||
|
||||
RUN chmod +x /run/*.sh
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"title": "Openwrt control",
|
||||
"port": "5000",
|
||||
|
||||
"access": {
|
||||
"allowed_users": "*",
|
||||
"admin_users": "*"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "Apply factory reset",
|
||||
"description": "Hard factory reset of Openwrt",
|
||||
"script_path": "/run/qemu_qmp.sh -f"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "Reset OpenWRT",
|
||||
"description": "Hard reset of Openwrt VM",
|
||||
"script_path": "/run/qemu_qmp.sh -r"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
echo "Hello sample script"
|
||||
|
||||
+13
-3
@@ -168,8 +168,18 @@ cp -r /var/www/* /run/shm
|
||||
html "Starting $APP for Docker..."
|
||||
nginx -e stderr
|
||||
|
||||
# Start OliveTin
|
||||
cp -f /var/www/olivetin_config.yaml /etc/OliveTin/config.yaml
|
||||
OliveTin 2> /var/log/olivetin.log &
|
||||
# ******* script-server handeling *******
|
||||
|
||||
# Ugly hack to enable iframe usage
|
||||
sed -i "s/'X-Frame-Options', 'DENY'/ \
|
||||
'X-Frame-Options', 'ALLOWALL'/g" \
|
||||
/usr/share/script-server/src/web/server.py
|
||||
|
||||
# Usage of default logging.json'
|
||||
cp -f /usr/share/script-server/conf/logging.json /var/script-server/logging.json
|
||||
|
||||
# Start script-server
|
||||
/var/lib/script-server-env/bin/python \
|
||||
/usr/share/script-server/launcher.py -d /var/script-server > /var/log/script-server.log &
|
||||
|
||||
return 0
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ div {
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
html, body, div, iframe { height: 100%; }
|
||||
html, body, div, iframe { height: 99%; }
|
||||
|
||||
iframe {
|
||||
display:inline-block;
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
|
||||
<body>
|
||||
<div>
|
||||
<iframe src="/olivetin" width="29%"></iframe>
|
||||
<iframe src="/script-server" width="27%"></iframe>
|
||||
<iframe src="/novnc" width="70%"></iframe>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
+11
-8
@@ -53,14 +53,17 @@ server {
|
||||
proxy_pass http://127.0.0.1:5700/;
|
||||
}
|
||||
|
||||
location /olivetin/ {
|
||||
proxy_pass http://localhost:1337/;
|
||||
proxy_redirect http://localhost:1337/ http://localhost/OliveTin/;
|
||||
}
|
||||
|
||||
location /websocket {
|
||||
proxy_set_header Upgrade "websocket";
|
||||
location /script-server/ {
|
||||
proxy_pass_header Server;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass http://127.0.0.1:5000/;
|
||||
|
||||
# needed for websockets
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_pass http://localhost:1337/websocket;
|
||||
proxy_set_header Origin http://$proxy_host;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
# There is a built-in micro proxy that will host the webui and REST API all on
|
||||
# one port (this is called the "Single HTTP Frontend") and means you just need
|
||||
# one open port in the container/firewalls/etc.
|
||||
#
|
||||
# Listen on all addresses available, port 1337
|
||||
listenAddressSingleHTTPFrontend: 0.0.0.0:1337
|
||||
|
||||
# Choose from INFO (default), WARN and DEBUG
|
||||
logLevel: "INFO"
|
||||
|
||||
# Actions (buttons) to show up on the WebUI:
|
||||
actions:
|
||||
- title: Restart Openwrt
|
||||
shell: /run/qemu_qmp.sh -r
|
||||
icon: restart
|
||||
|
||||
- title: Factory reset
|
||||
shell: /run/qemu_qmp.sh -f
|
||||
icon: "⚙"
|
||||
Reference in New Issue
Block a user