From 162332d8eeb94a133040b9e079b2f52cf9549bca Mon Sep 17 00:00:00 2001 From: Albrecht Lohofener Date: Sun, 18 Feb 2024 22:49:50 +0100 Subject: [PATCH] Move nginx to supervisord --- Dockerfile | 4 ++-- src/entry.sh | 8 -------- src/reset.sh | 2 +- supervisord.conf | 20 +++++++++++++++++--- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index d15652e..0caf8be 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,8 +27,8 @@ RUN apk add --no-cache \ && 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 - + && sed -i 's/^worker_processes.*/worker_processes 1;daemon off;/' /etc/nginx/nginx.conf + # Get OpenWrt images RUN mkdir /var/vm \ && if [ "$OPENWRT_VERSION" = "master" ] ; then \ diff --git a/src/entry.sh b/src/entry.sh index 72b1549..1c114b7 100755 --- a/src/entry.sh +++ b/src/entry.sh @@ -70,14 +70,6 @@ else echo "rootfs-${OPENWRT_VERSION}.img" > /storage/current_version fi -# Enable VNC -info "Activating web VNC ..." -[ ! -f "$INFO" ] && error "File $INFO not found?!" -rm -f "$INFO" -[ ! -f "$PAGE" ] && error "File $PAGE not found?!" -rm -f "$PAGE" - - # Check KVM info "Checking for KVM ..." KVM_ERR="" diff --git a/src/reset.sh b/src/reset.sh index 2b999b5..e7ddf03 100644 --- a/src/reset.sh +++ b/src/reset.sh @@ -61,7 +61,7 @@ fi # Start webserver cp -r /var/www/* /run/shm -nginx -e stderr +supervisorctl start nginx # ******* script-server handeling ******* # Ugly hack to enable iframe usage diff --git a/supervisord.conf b/supervisord.conf index 14d13c5..4411922 100644 --- a/supervisord.conf +++ b/supervisord.conf @@ -3,12 +3,26 @@ nodaemon=true logfile=/dev/null logfile_maxbytes=0 -[program:entry] +[supervisorctl] +serverurl=unix:///var/run/supervisord.sock + +[unix_http_server] +file = /var/run/supervisord.sock + +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface + +[program:init] command=/run/entry.sh process_name=%(program_name)s -directory=/run autostart=true +autorestart=false stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 \ No newline at end of file +stderr_logfile_maxbytes=0 + +[program:nginx] +command=nginx +process_name=%(program_name)s +autostart=false