logging
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
**/__pycache__/*
|
||||
venv/*
|
||||
production/*
|
||||
test*
|
||||
@@ -1,6 +1,7 @@
|
||||
from dataclasses import dataclass
|
||||
import subprocess
|
||||
import os
|
||||
from time import time
|
||||
|
||||
@dataclass
|
||||
class DeployerRequest:
|
||||
@@ -12,8 +13,13 @@ class DeployerRequest:
|
||||
DEPLOYERDIR = "/home/drm/live"
|
||||
|
||||
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(
|
||||
["sudo", "-E", "./deploy.sh"],
|
||||
f"sudo -E ./deploy.sh > {log_file} >2 {log_file}",
|
||||
shell=True,
|
||||
env=dict(
|
||||
os.environ,
|
||||
DEPLOYERDIR=DEPLOYERDIR,
|
||||
|
||||
Reference in New Issue
Block a user