mirror of
https://github.com/ComputerScienceHouse/proxstar.git
synced 2025-02-12 13:01:51 +00:00
Chown `targets`, Add run and kill scripts Lol Joe figured it out * Dude it works holy shit We need to fix some logistical bugs, probably, and also like remove dead code lol * Open VNC session on the node that the VM belongs Figured out why I couldn't open a session on anything but 01. It was because I was making the API call on proxmox01-nrh. So that's where the session opened. I hope that by doing this, it will balance the load (what little there is) from VNC sessions. * Update websockify-related tasks * Remove SSH key from build * Add option to specify VNC port. Should be 443 for OKD, probably 8081 for development. This hosts a smattering of fixes, acutally uses gunicorn properly(?), launches websockify correctly, and introduces MORE DEAD CODE! TODO: Fix the scheduling system * Make things not crash as much :) * Remove obviously dead code There's still some code in here that may require more careful extraction, testing, and review, so I'm saving that for another PR. * Fix Joe's complaints * Replace hardcoded URL
37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
import os
|
|
import subprocess
|
|
|
|
from flask import Flask
|
|
app = Flask(__name__)
|
|
if os.path.exists(os.path.join(app.config.get('ROOT_DIR', os.getcwd()), "config_local.py")):
|
|
config = os.path.join(app.config.get('ROOT_DIR', os.getcwd()), "config_local.py")
|
|
else:
|
|
config = os.path.join(app.config.get('ROOT_DIR', os.getcwd()), "config.py")
|
|
app.config.from_pyfile(config)
|
|
|
|
timeout = app.config['TIMEOUT']
|
|
|
|
|
|
def start_websockify(websockify_path, target_file):
|
|
result = subprocess.run(['pgrep', 'websockify'], stdout=subprocess.PIPE)
|
|
if not result.stdout:
|
|
print("Websockify is stopped. Starting websockify.")
|
|
subprocess.call(
|
|
[
|
|
websockify_path,
|
|
'8081',
|
|
'--token-plugin',
|
|
'TokenFile',
|
|
'--token-source',
|
|
target_file,
|
|
'-D',
|
|
],
|
|
stdout=subprocess.PIPE,
|
|
)
|
|
else:
|
|
print("Websockify started.")
|
|
|
|
|
|
def on_starting(server):
|
|
print("Booting Websockify server in daemon mode...")
|
|
start_websockify(app.config['WEBSOCKIFY_PATH'], app.config['WEBSOCKIFY_TARGET_FILE'])
|