build logs via tmux

This commit is contained in:
2025-08-02 00:34:31 -04:00
parent 0ec669f99e
commit fb7117b292
3 changed files with 15 additions and 5 deletions

1
.gitignore vendored
View File

@@ -4,3 +4,4 @@ test*
logs/* logs/*
token token
Caddyfile Caddyfile
.DS_Store

View File

@@ -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,

View File

@@ -38,6 +38,9 @@ status:
log: log:
\tjournalctl -u deployer-$DOMAIN \tjournalctl -u deployer-$DOMAIN
buildlog:
\ttmux a -r -t $DOMAIN-build-$DEPLOYMENT_ID
stop: stop:
\tsystemctl stop deployer-$DOMAIN \tsystemctl stop deployer-$DOMAIN
" > Makefile " > Makefile