build logs via tmux
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,3 +4,4 @@ test*
|
||||
logs/*
|
||||
token
|
||||
Caddyfile
|
||||
.DS_Store
|
||||
14
deploy.py
14
deploy.py
@@ -3,7 +3,6 @@ from dataclasses import dataclass
|
||||
import subprocess
|
||||
import os
|
||||
from time import time
|
||||
from textwrap import dedent
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -47,10 +46,17 @@ def handle_request(rq: DeployerRequest):
|
||||
build_log = f"{logs_dir}/build.log"
|
||||
|
||||
subprocess.Popen(
|
||||
["./deploy.sh"],
|
||||
[
|
||||
"tmux",
|
||||
"new-session",
|
||||
"-d",
|
||||
"-s",
|
||||
f"{domain}-build-{deployment_id}",
|
||||
"sh",
|
||||
"-c",
|
||||
f"/path/to/build.sh > {build_log} 2>&1",
|
||||
],
|
||||
user="root",
|
||||
stdout=open(build_log, "w"),
|
||||
stderr=open(build_log, "a"),
|
||||
shell=True,
|
||||
env=dict(
|
||||
os.environ,
|
||||
|
||||
Reference in New Issue
Block a user