Go-live: live data wiring, auth callback, SEO, legal pages, UI fixes
This commit is contained in:
44
deploy/apply-supabase-functions.py
Normal file
44
deploy/apply-supabase-functions.py
Normal file
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Apply ExposedGays Supabase functions + seed if missing."""
|
||||
import paramiko
|
||||
|
||||
HOST = "10.10.0.11"
|
||||
USER = "localadministrator"
|
||||
PASS = "Bbt9115xty9176!"
|
||||
|
||||
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=120):
|
||||
print("$", cmd[:140])
|
||||
_, o, e = c.exec_command(cmd, timeout=t)
|
||||
code = o.channel.recv_exit_status()
|
||||
out = (o.read() + e.read()).decode(errors="replace")
|
||||
print(out[-3000:])
|
||||
print("exit", code, "\n")
|
||||
return code
|
||||
|
||||
# Pipe functions.sql into postgres
|
||||
with open(r"C:\Users\Local Administrator\exposedgays\supabase\functions.sql", "r", encoding="utf-8") as f:
|
||||
sql = f.read()
|
||||
|
||||
sftp = c.open_sftp()
|
||||
with sftp.file("/tmp/eg_functions.sql", "w") as remote:
|
||||
remote.write(sql)
|
||||
sftp.close()
|
||||
|
||||
run("cat /tmp/eg_functions.sql | docker exec -i supabase-db psql -U postgres -d postgres 2>&1 | tail -20")
|
||||
|
||||
# Ensure privacy columns exist
|
||||
run(
|
||||
"docker exec -i supabase-db psql -U postgres -d postgres -c "
|
||||
"\"ALTER TABLE profiles ADD COLUMN IF NOT EXISTS height_in integer, "
|
||||
"ADD COLUMN IF NOT EXISTS weight_lb integer, "
|
||||
"ADD COLUMN IF NOT EXISTS body_type text, "
|
||||
"ADD COLUMN IF NOT EXISTS community text, "
|
||||
"ADD COLUMN IF NOT EXISTS seeking text;\" 2>&1"
|
||||
)
|
||||
|
||||
c.close()
|
||||
print("Done.")
|
||||
91
deploy/retry-stalled-tasks.py
Normal file
91
deploy/retry-stalled-tasks.py
Normal file
@@ -0,0 +1,91 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Retry stalled Pink Pulse + Supabase tasks with tight timeouts."""
|
||||
import paramiko
|
||||
import sys
|
||||
|
||||
COOLIFY = ("10.10.0.10", "localadministrator", "Bbt9115xty9176!")
|
||||
SUPABASE = ("10.10.0.11", "localadministrator", "Bbt9115xty9176!")
|
||||
MIGRATION_LOCAL = r"C:\Users\Local Administrator\exposedgays\supabase\migration_pulse_analytics.sql"
|
||||
|
||||
|
||||
def run(host, user, password, cmd, timeout=45):
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect(host, username=user, password=password, timeout=15, allow_agent=False, look_for_keys=False)
|
||||
try:
|
||||
print(f"\n=== {host}: {cmd[:120]} ===")
|
||||
_, o, e = c.exec_command(cmd, timeout=timeout)
|
||||
code = o.channel.recv_exit_status()
|
||||
out = (o.read() + e.read()).decode(errors="replace")
|
||||
print(out[:8000] if out else "(no output)")
|
||||
print(f"exit {code}")
|
||||
return code, out
|
||||
finally:
|
||||
c.close()
|
||||
|
||||
|
||||
def scp_file(host, user, password, local_path, remote_path, timeout=60):
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect(host, username=user, password=password, timeout=15, allow_agent=False, look_for_keys=False)
|
||||
try:
|
||||
print(f"\n=== SCP {local_path} -> {host}:{remote_path} ===")
|
||||
sftp = c.open_sftp()
|
||||
sftp.put(local_path, remote_path)
|
||||
sftp.close()
|
||||
print("SCP ok")
|
||||
return 0
|
||||
finally:
|
||||
c.close()
|
||||
|
||||
|
||||
def main():
|
||||
h, u, p = COOLIFY
|
||||
errors = 0
|
||||
|
||||
# 1. Pink Pulse ads dir
|
||||
code, _ = run(h, u, p,
|
||||
"test -d /home/localadministrator/thepinkpulse && "
|
||||
"ls /home/localadministrator/thepinkpulse/src/components/ads/ 2>/dev/null | head -10 || "
|
||||
"echo 'ads dir missing or empty'"
|
||||
)
|
||||
if code != 0:
|
||||
errors += 1
|
||||
|
||||
# 2. Pink Pulse advertising grep
|
||||
code, _ = run(h, u, p,
|
||||
"grep -rn 'advertis\\|Advertise\\|popup' "
|
||||
"/home/localadministrator/thepinkpulse/src/components --include='*.tsx' 2>/dev/null | head -40 || "
|
||||
"echo 'no matches'"
|
||||
)
|
||||
if code != 0:
|
||||
errors += 1
|
||||
|
||||
# 3. ExposedGays health
|
||||
code, _ = run(h, u, p, "curl -sS --max-time 10 https://exposedgays.com/ 2>&1 | head -c 300")
|
||||
if code != 0:
|
||||
errors += 1
|
||||
|
||||
# 4. Supabase migration
|
||||
sh, su, sp = SUPABASE
|
||||
try:
|
||||
scp_file(sh, su, sp, MIGRATION_LOCAL, "/tmp/migration_pulse_analytics.sql")
|
||||
except Exception as ex:
|
||||
print(f"SCP failed: {ex}")
|
||||
errors += 1
|
||||
else:
|
||||
code, out = run(
|
||||
sh, su, sp,
|
||||
"cat /tmp/migration_pulse_analytics.sql | "
|
||||
"docker exec -i supabase-db psql -U postgres -d postgres 2>&1 | tail -40",
|
||||
timeout=90,
|
||||
)
|
||||
if code != 0 and "already exists" not in out.lower():
|
||||
errors += 1
|
||||
|
||||
print(f"\n=== DONE ({errors} issues) ===")
|
||||
sys.exit(1 if errors else 0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user