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