Fix updater timeouts and default to amd64 publishes

This commit is contained in:
cyph3rasi
2026-03-07 23:32:58 -08:00
parent 35a495fc10
commit 11b0ebb34a
3 changed files with 17 additions and 12 deletions
+11 -11
View File
@@ -18,7 +18,7 @@ LOG_FILE = os.environ.get("HOST_UPDATER_LOG_FILE", "/opt/synapsis/updater.log")
UPDATE_SCRIPT = os.environ.get("HOST_UPDATER_SCRIPT", "/opt/synapsis/update-local.sh") UPDATE_SCRIPT = os.environ.get("HOST_UPDATER_SCRIPT", "/opt/synapsis/update-local.sh")
INSTALL_DIR = os.environ.get("INSTALL_DIR", "/opt/synapsis") INSTALL_DIR = os.environ.get("INSTALL_DIR", "/opt/synapsis")
status_lock = threading.Lock() status_lock = threading.RLock()
current_process = None current_process = None
@@ -72,14 +72,14 @@ def watch_process(process):
exit_code = process.wait() exit_code = process.wait()
with status_lock: with status_lock:
current_process = None current_process = None
update_status( update_status(
status="success" if exit_code == 0 else "error", status="success" if exit_code == 0 else "error",
message="Synapsis update completed." if exit_code == 0 else "Synapsis update failed.", message="Synapsis update completed." if exit_code == 0 else "Synapsis update failed.",
lastFinishedAt=now_iso(), lastFinishedAt=now_iso(),
lastExitCode=exit_code, lastExitCode=exit_code,
lastError=None if exit_code == 0 else f"Updater exited with code {exit_code}", lastError=None if exit_code == 0 else f"Updater exited with code {exit_code}",
pid=None, pid=None,
) )
def start_update_process(): def start_update_process():
@@ -104,8 +104,8 @@ def start_update_process():
update_status(pid=current_process.pid) update_status(pid=current_process.pid)
thread = threading.Thread(target=watch_process, args=(current_process,), daemon=True) thread = threading.Thread(target=watch_process, args=(current_process,), daemon=True)
thread.start() thread.start()
class ThreadedUnixServer(socketserver.ThreadingMixIn, socketserver.UnixStreamServer): class ThreadedUnixServer(socketserver.ThreadingMixIn, socketserver.UnixStreamServer):
+1 -1
View File
@@ -5,7 +5,7 @@ set -eu
IMAGE_REPO="${IMAGE_REPO:-ghcr.io/gnosyslabs/synapsis}" IMAGE_REPO="${IMAGE_REPO:-ghcr.io/gnosyslabs/synapsis}"
PACKAGE_API="${PACKAGE_API:-/orgs/GnosysLabs/packages/container/synapsis/versions?per_page=100}" PACKAGE_API="${PACKAGE_API:-/orgs/GnosysLabs/packages/container/synapsis/versions?per_page=100}"
BUILDER="${BUILDER:-colima}" BUILDER="${BUILDER:-colima}"
PLATFORMS="${PLATFORMS:-linux/amd64,linux/arm64}" PLATFORMS="${PLATFORMS:-linux/amd64}"
DATE_PREFIX="${DATE_PREFIX:-$(date -u +%Y.%m.%d)}" DATE_PREFIX="${DATE_PREFIX:-$(date -u +%Y.%m.%d)}"
SOURCE_REPO="${SOURCE_REPO:-https://github.com/GnosysLabs/Synapsis}" SOURCE_REPO="${SOURCE_REPO:-https://github.com/GnosysLabs/Synapsis}"
PRUNE_BUILD_CACHE="${PRUNE_BUILD_CACHE:-1}" PRUNE_BUILD_CACHE="${PRUNE_BUILD_CACHE:-1}"
+5
View File
@@ -1,6 +1,7 @@
import http from 'http'; import http from 'http';
const DEFAULT_SOCKET_PATH = '/var/run/synapsis-updater/updater.sock'; const DEFAULT_SOCKET_PATH = '/var/run/synapsis-updater/updater.sock';
const REQUEST_TIMEOUT_MS = 4000;
export interface HostUpdaterStatus { export interface HostUpdaterStatus {
available: boolean; available: boolean;
@@ -69,6 +70,10 @@ function requestUpdater<T>(method: 'GET' | 'POST', path: string, body?: unknown)
} }
); );
request.setTimeout(REQUEST_TIMEOUT_MS, () => {
request.destroy(new Error('Host updater request timed out'));
});
request.on('error', (error) => { request.on('error', (error) => {
reject(error); reject(error);
}); });