This commit is contained in:
2025-08-03 11:46:12 -04:00
parent 2e734ddea9
commit bc0a9e52e3
4 changed files with 8 additions and 22 deletions

View File

@@ -10,7 +10,7 @@ class DeployerRequest:
user: str
repo: str
branch: str
commit_hash: str
commit_hash: str = ""
DEPLOYERDIR = "/home/drm/live"
@@ -43,22 +43,14 @@ def handle_request(rq: DeployerRequest):
domain_dir = f"{DEPLOYERDIR}/{domain}"
logs_dir = f"{domain_dir}/logs/{deployment_id}"
os.makedirs(logs_dir, exist_ok=True)
build_log = f"{logs_dir}/build.log"
subprocess.Popen(
[
"tmux",
"new-session",
"-L", # pass environment variables
"-d", # detach
"-s", # name
f"{domain}-build-{deployment_id}",
f"'sudo ./deploy.sh > {build_log} 2>&1'",
],
shell=True,
["./deploy.sh"],
user="root",
stdout=open(build_log, "w"),
stderr=open(build_log, "a"),
shell=True,
env=dict(
os.environ,
DOMAIN=domain,