simplify
This commit is contained in:
18
deploy.py
18
deploy.py
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user