Initial commit
This commit is contained in:
commit
f45881dc88
161 files changed
+21597
No files matched your search
@@ -0,0 +1,18 @@
|
||||
import pexpect, time
|
||||
|
||||
c = pexpect.spawn('ssh -q -o StrictHostKeyChecking=no root@210.16.161.214', encoding='utf-8', timeout=30)
|
||||
c.expect('password:')
|
||||
c.sendline('XHR521yhf')
|
||||
c.expect('[$#]')
|
||||
|
||||
c.sendline('tail -30 /tmp/deploy_velobase.log 2>/dev/null')
|
||||
c.expect('[$#]')
|
||||
print('=== LOG ===')
|
||||
print(c.before.strip()[-2000:])
|
||||
|
||||
c.sendline('ps aux | grep deploy_velobase | grep -v grep || echo DONE')
|
||||
c.expect('[$#]')
|
||||
print('=== STATUS ===')
|
||||
print(c.before.strip()[-300:])
|
||||
|
||||
c.sendline('exit')
|
||||
@@ -0,0 +1,13 @@
|
||||
import pexpect
|
||||
|
||||
c = pexpect.spawn('ssh -q -o StrictHostKeyChecking=no root@210.16.161.214', encoding='utf-8', timeout=30)
|
||||
c.expect('password:')
|
||||
c.sendline('XHR521yhf')
|
||||
c.expect('[$#]')
|
||||
|
||||
c.sendline("docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}' | grep velob")
|
||||
c.expect('[$#]')
|
||||
print('CONTAINERS:')
|
||||
print(c.before.strip()[-600:])
|
||||
|
||||
c.sendline('exit')
|
||||
@@ -0,0 +1,12 @@
|
||||
import pexpect
|
||||
|
||||
c = pexpect.spawn('ssh -q -o StrictHostKeyChecking=no root@210.16.161.214', encoding='utf-8', timeout=30)
|
||||
c.expect('password:')
|
||||
c.sendline('XHR521yhf')
|
||||
c.expect('[$#]')
|
||||
|
||||
c.sendline('echo "=== PNPM ===" && tail -5 /tmp/pnpm_install.log 2>/dev/null && echo "=== PG ===" && tail -5 /tmp/pg_pull.log 2>/dev/null && echo "=== PS ===" && ps aux | grep -E "pnpm|docker pull" | grep -v grep || echo DONE')
|
||||
c.expect('[$#]')
|
||||
print('STATUS:', c.before.strip()[-1500:])
|
||||
|
||||
c.sendline('exit')
|
||||
@@ -0,0 +1,12 @@
|
||||
import pexpect, time
|
||||
|
||||
c = pexpect.spawn('ssh -q -o StrictHostKeyChecking=no root@210.16.161.214', encoding='utf-8', timeout=30)
|
||||
c.expect('password:')
|
||||
c.sendline('XHR521yhf')
|
||||
c.expect('[$#]')
|
||||
|
||||
c.sendline('echo "=== PNPM ===" && tail -3 /tmp/pnpm_install.log 2>/dev/null && echo "=== PG ===" && docker images postgres:16 --format "{{.Size}}" 2>/dev/null || echo STILL_PULLING && echo "=== PS ===" && ps aux | grep -E "pnpm|docker pull" | grep -v grep | awk "{print \$2,\$11}" || echo DONE')
|
||||
c.expect('[$#]')
|
||||
print(c.before.strip()[-1000:])
|
||||
|
||||
c.sendline('exit')
|
||||
@@ -0,0 +1,22 @@
|
||||
import pexpect
|
||||
|
||||
c = pexpect.spawn('ssh -q -o StrictHostKeyChecking=no root@210.16.161.214', encoding='utf-8', timeout=120)
|
||||
c.expect('password:')
|
||||
c.sendline('XHR521yhf')
|
||||
c.expect('[$#]')
|
||||
|
||||
cd = 'cd /www/wwwroot/velobase-harness && '
|
||||
|
||||
# Push DB schema
|
||||
c.sendline(cd + 'pnpm db:push 2>&1 | tail -20')
|
||||
c.expect('[$#]', timeout=60)
|
||||
print('=== DB PUSH ===')
|
||||
print(c.before.strip()[-1000:])
|
||||
|
||||
# Seed DB
|
||||
c.sendline(cd + 'pnpm db:seed 2>&1 | tail -20')
|
||||
c.expect('[$#]', timeout=60)
|
||||
print('=== DB SEED ===')
|
||||
print(c.before.strip()[-1000:])
|
||||
|
||||
c.sendline('exit')
|
||||
@@ -0,0 +1,26 @@
|
||||
import pexpect
|
||||
|
||||
c = pexpect.spawn('ssh -q -o StrictHostKeyChecking=no root@210.16.161.214', encoding='utf-8', timeout=60)
|
||||
c.expect('password:')
|
||||
c.sendline('XHR521yhf')
|
||||
c.expect('[$#]')
|
||||
|
||||
# Check what ports postgres is listening on inside container
|
||||
c.sendline('docker logs velobase-harness-postgres-1 2>&1 | grep -i "listening\\|ready\\|port" | tail -5')
|
||||
c.expect('[$#]')
|
||||
print('=== PG LOGS ===')
|
||||
print(c.before.strip()[-500:])
|
||||
|
||||
# Check if postgres is accessible from host via localhost:5433
|
||||
c.sendline('ss -tlnp | grep 5433')
|
||||
c.expect('[$#]')
|
||||
print('=== PORT 5433 ===')
|
||||
print(c.before.strip()[-300:])
|
||||
|
||||
# Check docker compose port mapping
|
||||
c.sendline('docker port velobase-harness-postgres-1')
|
||||
c.expect('[$#]')
|
||||
print('=== PORT MAP ===')
|
||||
print(c.before.strip()[-300:])
|
||||
|
||||
c.sendline('exit')
|
||||
@@ -0,0 +1,22 @@
|
||||
import pexpect, time
|
||||
|
||||
c = pexpect.spawn('ssh -q -o StrictHostKeyChecking=no root@210.16.161.214', encoding='utf-8', timeout=30)
|
||||
c.expect('password:')
|
||||
c.sendline('XHR521yhf')
|
||||
c.expect('[$#]')
|
||||
|
||||
c.sendline('ps aux | grep deploy_velobase | grep -v grep || echo SCRIPT_DONE')
|
||||
c.expect('[$#]')
|
||||
alive = c.before.strip()
|
||||
print('=== ALIVE ===')
|
||||
print(alive[-300:])
|
||||
|
||||
if 'SCRIPT_DONE' in alive:
|
||||
c.sendline('tail -30 /tmp/deploy_velobase.log 2>/dev/null')
|
||||
c.expect('[$#]')
|
||||
print('=== LOG ===')
|
||||
print(c.before.strip()[-2000:])
|
||||
else:
|
||||
print('Script still running...')
|
||||
|
||||
c.sendline('exit')
|
||||
@@ -0,0 +1,30 @@
|
||||
import pexpect, time
|
||||
|
||||
c = pexpect.spawn('ssh -q -o StrictHostKeyChecking=no root@210.16.161.214', encoding='utf-8', timeout=30)
|
||||
c.expect('password:')
|
||||
c.sendline('XHR521yhf')
|
||||
c.expect('[$#]')
|
||||
|
||||
# Kill old script if still running
|
||||
c.sendline('pkill -f deploy_velobase 2>/dev/null; echo KILLED')
|
||||
c.expect('[$#]')
|
||||
print('CLEANUP:', c.before.strip()[-200:])
|
||||
|
||||
# Start pnpm install in background (this takes time too)
|
||||
c.sendline('cd /www/wwwroot/velobase-harness && nohup pnpm install --frozen-lockfile > /tmp/pnpm_install.log 2>&1 & echo PNPM_PID=$!')
|
||||
c.expect('[$#]')
|
||||
print('PNPM:', c.before.strip()[-200:])
|
||||
|
||||
# Start docker pull in background
|
||||
c.sendline('nohup docker pull postgres:16 > /tmp/pg_pull.log 2>&1 & echo PG_PULL_PID=$!')
|
||||
c.expect('[$#]')
|
||||
print('PG_PULL:', c.before.strip()[-200:])
|
||||
|
||||
time.sleep(5)
|
||||
|
||||
# Check both
|
||||
c.sendline('tail -5 /tmp/pnpm_install.log 2>/dev/null; echo "==="; tail -3 /tmp/pg_pull.log 2>/dev/null')
|
||||
c.expect('[$#]')
|
||||
print('PROGRESS:', c.before.strip()[-1000:])
|
||||
|
||||
c.sendline('exit')
|
||||
@@ -0,0 +1,20 @@
|
||||
import pexpect
|
||||
|
||||
c = pexpect.spawn('ssh -q -o StrictHostKeyChecking=no root@210.16.161.214', encoding='utf-8', timeout=60)
|
||||
c.expect('password:')
|
||||
c.sendline('XHR521yhf')
|
||||
c.expect('[$#]')
|
||||
|
||||
# Start DB containers
|
||||
c.sendline('cd /www/wwwroot/velobase-harness && docker compose up -d postgres redis 2>&1')
|
||||
c.expect('[$#]', timeout=30)
|
||||
print('=== DOCKER UP ===')
|
||||
print(c.before.strip()[-800:])
|
||||
|
||||
# Check containers
|
||||
c.sendline('docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}" | grep velobase')
|
||||
c.expect('[$#]')
|
||||
print('=== CONTAINERS ===')
|
||||
print(c.before.strip()[-600:])
|
||||
|
||||
c.sendline('exit')
|
||||
@@ -0,0 +1,20 @@
|
||||
import pexpect, base64, time
|
||||
|
||||
with open('/tmp/deploy_script.sh', 'rb') as f:
|
||||
b64 = base64.b64encode(f.read()).decode()
|
||||
|
||||
c = pexpect.spawn('ssh -q -o StrictHostKeyChecking=no root@210.16.161.214', encoding='utf-8', timeout=60)
|
||||
c.expect('password:')
|
||||
c.sendline('XHR521yhf')
|
||||
c.expect('[$#]')
|
||||
|
||||
c.sendline(f'echo {b64} | base64 -d > /tmp/deploy_velobase.sh && chmod +x /tmp/deploy_velobase.sh && nohup bash /tmp/deploy_velobase.sh > /tmp/deploy_velobase.log 2>&1 & echo LAUNCHED=$!')
|
||||
c.expect('[$#]')
|
||||
print('LAUNCH:', c.before.strip()[-300:])
|
||||
|
||||
time.sleep(3)
|
||||
c.sendline('tail -10 /tmp/deploy_velobase.log')
|
||||
c.expect('[$#]')
|
||||
print('LOG:', c.before.strip()[-500:])
|
||||
|
||||
c.sendline('exit')
|
||||
Reference in new issue
Block a user