Fix Map.tsx types, auth flow, Docker legacy-peer-deps
This commit is contained in:
68
deploy/fix-coolify-git.py
Normal file
68
deploy/fix-coolify-git.py
Normal file
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env python3
|
||||
import paramiko
|
||||
|
||||
HOST = "10.10.0.10"
|
||||
USER = "localadministrator"
|
||||
PASS = "Bbt9115xty9176!"
|
||||
APP = "ira4bw4nhbvm87o7s3fgqu6v"
|
||||
GITEA_TOKEN = "5c323b8ea677d78b201341f6833d57156a607008"
|
||||
GIT_PUBLIC = "https://gitea.onsethost.com/localadministrator/exposedgays.git"
|
||||
GIT_AUTH = f"https://{USER}:{GITEA_TOKEN}@gitea.onsethost.com/localadministrator/exposedgays.git"
|
||||
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect(HOST, username=USER, password=PASS, timeout=20, allow_agent=False, look_for_keys=False)
|
||||
|
||||
|
||||
def run(cmd, t=300):
|
||||
print("$", cmd[:150])
|
||||
_, o, e = c.exec_command(cmd, timeout=t)
|
||||
code = o.channel.recv_exit_status()
|
||||
out = (o.read() + e.read()).decode(errors="replace")
|
||||
print(out[-12000:])
|
||||
print("exit", code, "\n")
|
||||
return code, out
|
||||
|
||||
|
||||
# Make repo public so COOLIFY_02 can ls-remote without credentials
|
||||
run(
|
||||
f"curl -sS -X PATCH 'https://gitea.onsethost.com/api/v1/repos/localadministrator/exposedgays' "
|
||||
f"-H 'Authorization: token {GITEA_TOKEN}' "
|
||||
f"-H 'Content-Type: application/json' "
|
||||
f"-d '{{\"private\":false}}'"
|
||||
)
|
||||
|
||||
# Also set git_repository to auth URL as fallback
|
||||
run(
|
||||
f"docker exec coolify-db psql -U coolify -d coolify -c "
|
||||
f"\"UPDATE applications SET "
|
||||
f"git_repository='{GIT_AUTH}', "
|
||||
f"git_full_url='{GIT_AUTH}', "
|
||||
f"destination_id=0, server_id=0 "
|
||||
f"WHERE uuid='{APP}';\""
|
||||
)
|
||||
|
||||
run(
|
||||
"TOKEN=$(cat /home/localadministrator/.coolify-token | tail -1); "
|
||||
f"curl -sS -X POST 'http://127.0.0.1:8000/api/v1/deploy?uuid={APP}&force_rebuild=true' "
|
||||
'-H "Authorization: Bearer $TOKEN"'
|
||||
)
|
||||
|
||||
for i in range(120):
|
||||
_, out = run("docker exec coolify php artisan queue:work --queue=high,default --once --timeout=900 2>&1", t=920)
|
||||
if "ApplicationDeploymentJob" in out:
|
||||
if "DONE" in out:
|
||||
print("=== DEPLOY SUCCESS ===")
|
||||
break
|
||||
if "FAIL" in out:
|
||||
print("=== DEPLOY FAIL ===")
|
||||
|
||||
run(
|
||||
"docker exec coolify-db psql -U coolify -d coolify -c "
|
||||
"\"SELECT id,status,left(logs,2000) FROM application_deployment_queues "
|
||||
"WHERE application_id='31' ORDER BY id DESC LIMIT 1;\""
|
||||
)
|
||||
|
||||
run("docker ps --format '{{.Names}} {{.Status}}' | grep ira4 || true")
|
||||
|
||||
c.close()
|
||||
Reference in New Issue
Block a user