Compare commits

..

3 Commits

Author SHA1 Message Date
Michael Pilosov
18f5915b8f updates! 2024-05-31 14:30:09 -06:00
Michael Pilosov
921c1980ad cache-bust 2024-05-31 12:48:20 -06:00
Michael Pilosov
c617323375 proxy-specific changes 2024-05-31 12:48:10 -06:00
5 changed files with 18 additions and 14 deletions

View File

@ -9,6 +9,9 @@ from flask import Flask, Response, render_template, request, send_from_directory
from prefect.deployments import run_deployment
PORT = 9021
PROTO = "https"
BARE = True
app = Flask(__name__)
logging.basicConfig(level=logging.DEBUG)
@ -22,20 +25,20 @@ def get_host():
host = os.environ.get("LIGHTNING_CLOUDSPACE_HOST")
if host is None:
default_host = os.environ.get("HOST_NAME", "0.0.0.0")
return f"{default_host}:{PORT}"
return f"{default_host}:{PORT}" if not BARE else f"{default_host}"
else:
return f"{PORT}-{host}"
return f"{PORT}-{host}" if not BARE else f"{host}"
@app.route("/iframe")
@app.route("/iframe/")
@app.route("/iframe/<path:subpath>")
def home(subpath="images/animations/"):
def home(subpath="images/animations/", proto=PROTO):
host = get_host()
initial_url = f"http://{host}/{subpath}"
api_url = f"http://{host}/api"
initial_url = f"{proto}://{host}/{subpath}"
api_url = f"{proto}://{host}/api"
return render_template(
"index.html", initial_url=initial_url, host=f"http://{host}", api_url=api_url
"index.html", initial_url=initial_url, host=f"{proto}://{host}", api_url=api_url
)
@ -70,10 +73,10 @@ def custom_static(filename):
@app.route("/", methods=["GET"])
@app.route("/<path:url>", methods=["GET"])
def proxy(url=""):
def proxy(url="", proto=PROTO):
original_base_url = "https://services.swpc.noaa.gov"
host = get_host()
proxy_base_url = f"http://{host}/"
proxy_base_url = f"{proto}://{host}/"
target_url = f"{original_base_url}/{url}"
logging.debug(f"Fetching URL: {target_url}")

View File

@ -174,8 +174,8 @@
formattedPath += '-';
}
// Append '.mp4' to the formatted path
let videoPath = `${formattedPath}latest.mp4`;
// Append '.mp4' to the formatted path + cache bust
let videoPath = `${formattedPath}latest.mp4` + "?t=" + Date.now();
let videoPlayer = document.getElementById('video-player');
let videoSource = document.getElementById('video-source');

View File

@ -1,5 +1,5 @@
run: build
docker run --rm -ti --name noaa -e HOST_NAME=localhost -p 9021:9021 -p 4200:4200 noaa
docker run --rm -ti --name noaa -e LIGHTNING_CLOUDSPACE_HOST=noaa.clfx.cc -p 9021:9021 -p 4200:4200 noaa
build:
docker build -t noaa .

View File

@ -10,5 +10,5 @@ PREFECT_API_SERVICES_SCHEDULER_INSERT_BATCH_SIZE = 500
PREFECT_API_SERVICES_SCHEDULER_LOOP_SECONDS = 60
PREFECT_API_SERVICES_SCHEDULER_MIN_RUNS = 3
PREFECT_API_SERVICES_SCHEDULER_MAX_RUNS = 100
PREFECT_API_SERVICES_SCHEDULER_MIN_SCHEDULED_TIME = '0:30:00'
PREFECT_API_SERVICES_SCHEDULER_MAX_SCHEDULED_TIME = '0 days, 8:00:00'
PREFECT_API_SERVICES_SCHEDULER_MIN_SCHEDULED_TIME = '00:30:00'
PREFECT_API_SERVICES_SCHEDULER_MAX_SCHEDULED_TIME = '08:00:00'

View File

@ -1,4 +1,5 @@
prefect==2.17.1
#prefect==2.17.1
prefect==3.0.0rc1
Flask==3.0.3
gunicorn==22.0.0
gevent==24.2.1