Move development runtime to isolated Athena Debian instance

This commit is contained in:
Mikei386
2026-09-28 15:42:53 +02:00
parent 2ad844ed20
commit 6d5671f75b
12 changed files with 95 additions and 65 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ COPY index.html app.js studio.js style.css login.html login.js access-ui.js netw
COPY network/__init__.py network/client.py network/config.py network/rpc.py /app/network/
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 HOME=/tmp \
DECK_BIND_HOST=0.0.0.0 DECK_STATE_DIR=/var/lib/deck \
DECK_REQUIRE_SETUP=1 DECK_LOCAL_HARDWARE=1 DECK_LOCATION=Server \
DECK_REQUIRE_SETUP=1 DECK_LOCAL_HARDWARE=1 DECK_LOCATION=Athena-Debian \
DECK_NETWORK_MODE=disabled
USER 65534:65534
CMD ["python3", "server.py", "--port", "8108"]
+8 -3
View File
@@ -98,6 +98,10 @@ def launch(config):
'-p','127.0.0.1:'+str(config['port'])+':8108',
'--health-cmd', 'python3 -c "import urllib.request,json; assert json.load(urllib.request.urlopen(\'http://127.0.0.1:8108/api/v1/auth/status\',timeout=3))[\'initialized\']"',
'--health-interval','30s','--health-timeout','5s','--health-retries','3']
if config.get('development_setup'):
args[args.index('--health-cmd')+1] = 'python3 -c "import urllib.request; urllib.request.urlopen(\'http://127.0.0.1:8108/api/v1/auth/status\',timeout=3)"'
# Explicit isolated development bootstrap, reachable only through host loopback/SSH.
args += ['-e','DECK_REQUIRE_SETUP=0']
if config['gpu_telemetry']:
args += ['--gpus','all','-e','NVIDIA_DRIVER_CAPABILITIES=utility']
args.append(config['image'])
@@ -111,7 +115,7 @@ def ready(config):
if item and item['State']['Running']:
try:
with urllib.request.urlopen('http://127.0.0.1:'+str(config['port'])+'/api/v1/auth/status',timeout=2) as r:
if json.load(r).get('initialized') is True:
if json.load(r).get('initialized') is True or config.get('development_setup'):
return
except (OSError, ValueError):
pass
@@ -226,9 +230,10 @@ def main():
elif args.stop:
if item:run('docker','stop','--time','15',config['name'])
elif args.start:
if not (args.directory/'state/auth.json').exists():
if not (args.directory/'state/auth.json').exists() and not config.get('development_setup'):
raise RuntimeError('Zugangseinrichtung unvollständig. Siehe INSTALL.md zur Wiederaufnahme.')
os.chown(args.directory/'state/auth.json',65534,65534)
if (args.directory/'state/auth.json').exists():
os.chown(args.directory/'state/auth.json',65534,65534)
if item:run('docker','start',config['name'])
else:launch(config)
ready(config);print('Deck bereit.')
+1 -1
View File
@@ -42,7 +42,7 @@ with patch('getpass.getpass',side_effect=lambda _:next(values)),patch('sys.stdin
probe="""import json,sys,urllib.request
v=json.load(sys.stdin)
req=urllib.request.Request('http://127.0.0.1:8108/api/v1/status',headers={'Authorization':'Bearer '+v['token']})
with urllib.request.urlopen(req,timeout=3) as r:assert json.load(r)['location']=='Server'
with urllib.request.urlopen(req,timeout=3) as r:assert json.load(r)['location']=='Athena-Debian'
"""
for _ in range(20):
try:run('docker','exec','-i',NAME,'python3','-c',probe,data=json.dumps({'token':token}));break