simplify
This commit is contained in:
3
Makefile
3
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
|
||||
@@ -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.
|
||||
18
deploy.py
18
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,
|
||||
|
||||
@@ -6,6 +6,5 @@ handle_request(
|
||||
user="drm",
|
||||
repo="deployer",
|
||||
branch="main",
|
||||
commit_hash=sys.argv[1],
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user