Improve deployment script
This commit is contained in:
parent
0a05a0eb92
commit
a96ed753b2
|
@ -10,7 +10,7 @@ import sys
|
|||
import tempfile
|
||||
import time
|
||||
|
||||
result = subprocess.run(["pgrep", "-x", "riju-install"], stdout=subprocess.PIPE)
|
||||
result = subprocess.run(["pgrep", "-x", "riju-deploy"], stdout=subprocess.PIPE)
|
||||
assert result.returncode in {0, 1}
|
||||
for pid in result.stdout.decode().splitlines():
|
||||
print(f"Found existing process {pid}, trying to kill ...", file=sys.stderr)
|
||||
|
@ -38,14 +38,4 @@ with tempfile.TemporaryDirectory() as tmpdir:
|
|||
check=True,
|
||||
)
|
||||
os.chdir("riju")
|
||||
subprocess.run(["make", "image-prod"], check=True)
|
||||
subprocess.run(["scripts/install-scripts.bash"], check=True)
|
||||
subprocess.run(["docker", "system", "prune", "-f"], check=True)
|
||||
existing_containers = subprocess.run(
|
||||
["docker", "ps", "-q"], check=True, stdout=subprocess.PIPE
|
||||
).output.splitlines()
|
||||
if existing_containers:
|
||||
subprocess.run(["docker", "kill", *existing_containers], check=True)
|
||||
subprocess.run(["systemctl", "restart", "riju"], check=True)
|
||||
|
||||
print("==> Successfully deployed Riju! <==", file=sys.stderr)
|
||||
subprocess.run(["scripts/deploy-phase2.py"])
|
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import errno
|
||||
import os
|
||||
import re
|
||||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
|
||||
subprocess.run(["make", "image-prod"], check=True)
|
||||
subprocess.run(["docker", "system", "prune", "-f"], check=True)
|
||||
existing_containers = subprocess.run(
|
||||
["docker", "ps", "-q"], check=True, stdout=subprocess.PIPE
|
||||
).output.splitlines()
|
||||
subprocess.run(["scripts/install-scripts.bash"], check=True)
|
||||
if existing_containers:
|
||||
subprocess.run(["docker", "kill", *existing_containers], check=True)
|
||||
subprocess.run(["systemctl", "restart", "riju"], check=True)
|
||||
|
||||
print("==> Successfully deployed Riju! <==", file=sys.stderr)
|
|
@ -6,6 +6,6 @@ set -o pipefail
|
|||
cp scripts/riju.service /etc/systemd/system/riju.service
|
||||
cp scripts/certbot-pre.bash /etc/letsencrypt/renewal-hooks/pre/riju
|
||||
cp scripts/certbot-post.bash /etc/letsencrypt/renewal-hooks/post/riju
|
||||
cp scripts/install.py /usr/bin/riju-install
|
||||
cp scripts/deploy-phase1.py /usr/bin/riju-deploy
|
||||
|
||||
systemctl daemon-reload
|
||||
|
|
Loading…
Reference in New Issue