This commit is contained in:
2025-01-08 22:59:47 -05:00
parent a6f681d251
commit 35877c2762
2 changed files with 9 additions and 2 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
**/__pycache__/* **/__pycache__/*
venv/* venv/*
production/* production/*
test*

View File

@@ -1,6 +1,7 @@
from dataclasses import dataclass from dataclasses import dataclass
import subprocess import subprocess
import os import os
from time import time
@dataclass @dataclass
class DeployerRequest: class DeployerRequest:
@@ -12,8 +13,13 @@ class DeployerRequest:
DEPLOYERDIR = "/home/drm/live" DEPLOYERDIR = "/home/drm/live"
def handle_request(rq: DeployerRequest): def handle_request(rq: DeployerRequest):
log_folder = f"./logs/{rq.repo}/{rq.branch}"
os.makedirs(log_folder, exist_ok=True)
log_file = f"{log_folder}/{int(time())}.log"
subprocess.Popen( subprocess.Popen(
["sudo", "-E", "./deploy.sh"], f"sudo -E ./deploy.sh > {log_file} >2 {log_file}",
shell=True,
env=dict( env=dict(
os.environ, os.environ,
DEPLOYERDIR=DEPLOYERDIR, DEPLOYERDIR=DEPLOYERDIR,