fix: remove AI service host port 8000 binding (conflicts with Coolify)

This commit is contained in:
ShootTracker Deploy
2026-04-30 23:39:45 +02:00
parent ed9bb6f94f
commit 846cf1482b
2 changed files with 68 additions and 2 deletions
+64
View File
@@ -0,0 +1,64 @@
import subprocess
import time
import urllib.request
import json
from pathlib import Path
REPO_DIR = Path.home() / "Documents/Claude/Projects/Applications VPS/shoottracker"
GITEA_REMOTE = "http://git.domench.fr/gael/shoottracker.git"
COOLIFY_URL = "http://100.94.204.91:8000"
COOLIFY_TOKEN = "2|DGjBZs90ORHr3BsUmJtnxaxC9kc4DdhERhIIaKtWf32da689"
APP_UUID = "lo2xt81gs0zhq3w64ilcy0n6"
def run(cmd, cwd=None):
r = subprocess.run(cmd, shell=True, cwd=cwd, capture_output=True, text=True, encoding="utf-8", errors="replace")
print(f"$ {cmd}")
if r.stdout.strip(): print(r.stdout.strip())
if r.stderr.strip(): print(r.stderr.strip())
return r.returncode
def api(method, path, data=None):
url = f"{COOLIFY_URL}/api/v1{path}"
body = json.dumps(data).encode() if data else None
req = urllib.request.Request(url, data=body, method=method,
headers={"Authorization": f"Bearer {COOLIFY_TOKEN}", "Content-Type": "application/json"})
try:
with urllib.request.urlopen(req, timeout=15) as r:
return json.loads(r.read())
except Exception as e:
print(f"API error: {e}")
return None
# 1. Git commit & push
print("=== Git commit & push ===")
run("git add -A", cwd=str(REPO_DIR))
rc = run('git commit -m "fix: remove AI service host port 8000 binding (conflicts with Coolify)"', cwd=str(REPO_DIR))
if rc != 0:
print("(Nothing to commit or commit failed, trying push anyway)")
rc = run(f"git push {GITEA_REMOTE} main", cwd=str(REPO_DIR))
if rc != 0:
print("Push failed, aborting.")
exit(1)
print("\n=== Triggering Coolify deploy ===")
result = api("GET", f"/deploy?uuid={APP_UUID}&force=true")
print(f"Deploy response: {result}")
# 2. Poll status every 10s, up to 15 min
print("\n=== Polling deployment status ===")
for i in range(90):
time.sleep(10)
app = api("GET", f"/applications/{APP_UUID}")
if not app:
print(f"[{(i+1)*10}s] no response")
continue
status = app.get("status", "?")
print(f"[{(i+1)*10}s] status={status}")
if status == "running":
print("SUCCESS - containers are running!")
break
if status in ("stopped", "exited", "error"):
print(f"FAILED with status: {status}")
break
else:
print("Timed out after 15 min")