diff --git a/.gitignore b/.gitignore index 1d5320c..620f75e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ venv/* test* logs/* token -Caddyfile \ No newline at end of file +Caddyfile +.DS_Store \ No newline at end of file diff --git a/deploy.py b/deploy.py index 257cb24..4a47201 100644 --- a/deploy.py +++ b/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, diff --git a/deploy.sh b/deploy.sh index 9e6bef5..56b9843 100755 --- a/deploy.sh +++ b/deploy.sh @@ -38,6 +38,9 @@ status: log: \tjournalctl -u deployer-$DOMAIN +buildlog: +\ttmux a -r -t $DOMAIN-build-$DEPLOYMENT_ID + stop: \tsystemctl stop deployer-$DOMAIN " > Makefile