Refactor backend and add registry build workflow
Build and publish Docker image / build-and-publish (push) Successful in 2m45s
Build and publish Docker image / build-and-publish (push) Successful in 2m45s
This commit is contained in:
commit
c177d7981d
43 files changed
+18124
No files matched your search
@@ -0,0 +1,58 @@
|
||||
"""Production process startup for HTTP, WebSocket, and background workers."""
|
||||
|
||||
import socket
|
||||
import time
|
||||
from urllib.parse import urlsplit
|
||||
|
||||
from domain_runtime import domain_manager
|
||||
from background_tasks import (
|
||||
|
||||
initialize_sample_data,
|
||||
start_demo_cleanup_scheduler,
|
||||
start_exchange_rate_updater,
|
||||
start_ingress_cleanup_thread,
|
||||
start_status_sync_thread,
|
||||
start_upload_cleanup_scheduler,
|
||||
)
|
||||
from email_service import init_email_service
|
||||
from server_billing import start_monthly_fee_scheduler
|
||||
from websocket_service import start_websocket_server
|
||||
from runtime_config import DATABASE_URL, NODE_IP, PORT, WS_PORT, logger
|
||||
|
||||
|
||||
def run(application) -> None:
|
||||
"""Start runtime workers and serve the Flask application."""
|
||||
start_exchange_rate_updater()
|
||||
init_email_service()
|
||||
initialize_sample_data()
|
||||
start_status_sync_thread()
|
||||
start_upload_cleanup_scheduler()
|
||||
start_ingress_cleanup_thread()
|
||||
start_demo_cleanup_scheduler()
|
||||
start_websocket_server()
|
||||
start_monthly_fee_scheduler()
|
||||
|
||||
logger.info("Monthly billing scheduler enabled")
|
||||
time.sleep(2)
|
||||
try:
|
||||
with socket.create_connection(("localhost", WS_PORT), timeout=2):
|
||||
logger.info("WebSocket server confirmed running on port %s", WS_PORT)
|
||||
except OSError as exc:
|
||||
logger.error("WebSocket server not reachable on port %s: %s", WS_PORT, exc)
|
||||
|
||||
logger.info("HTTP server running on port %s", PORT)
|
||||
logger.info("Kubernetes connection: %s", "connected" if _kubernetes_connected() else "disconnected")
|
||||
logger.info("Database backend: %s", _database_backend())
|
||||
logger.info("Static node IP: %s", NODE_IP)
|
||||
logger.info("Domain system: %s", "enabled" if domain_manager else "disabled")
|
||||
application.run(host="0.0.0.0", port=PORT, debug=False, use_reloader=False)
|
||||
|
||||
|
||||
def _kubernetes_connected() -> bool:
|
||||
from kubernetes_service import k8s_manager
|
||||
return k8s_manager.connected
|
||||
|
||||
|
||||
def _database_backend() -> str:
|
||||
scheme = urlsplit(DATABASE_URL).scheme.lower()
|
||||
return "PostgreSQL" if scheme in {"postgres", "postgresql"} else "SQLite"
|
||||
Reference in new issue
Block a user