From bc0a9e52e3f2325136283ebfafab67361c6e147c Mon Sep 17 00:00:00 2001 From: Daniel McCrystal Date: Sun, 3 Aug 2025 11:46:12 -0400 Subject: [PATCH] simplify --- Makefile | 3 +++ build.log | 8 -------- deploy.py | 18 +++++------------- deploy_self.py | 1 - 4 files changed, 8 insertions(+), 22 deletions(-) delete mode 100644 build.log diff --git a/Makefile b/Makefile index f2582ec..3bcb415 100644 --- a/Makefile +++ b/Makefile @@ -9,3 +9,6 @@ build: start: sudo venv/bin/waitress-serve --host 0.0.0.0 --port $(PORT) listen:app + +deploy_self: + venv/bin/python deploy_self.py \ No newline at end of file diff --git a/build.log b/build.log deleted file mode 100644 index 6783876..0000000 --- a/build.log +++ /dev/null @@ -1,8 +0,0 @@ -starting build from root/: () -fatal: repository './src' does not exist -fatal: not a git repository (or any of the parent directories): .git -fatal: not a git repository (or any of the parent directories): .git -fatal: not a git repository (or any of the parent directories): .git -make: *** No rule to make target 'build'. Stop. -build complete! -Failed to restart deployer-.service: Unit deployer-.service not found. diff --git a/deploy.py b/deploy.py index 5b8e1aa..ee49f3a 100644 --- a/deploy.py +++ b/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, diff --git a/deploy_self.py b/deploy_self.py index 9d988e9..ce379c1 100644 --- a/deploy_self.py +++ b/deploy_self.py @@ -6,6 +6,5 @@ handle_request( user="drm", repo="deployer", branch="main", - commit_hash=sys.argv[1], ) )