Skip to main content

Mercury Data Migration: Typhon → Hecate

· 3 min read
Max Kaido
Architect

Executive Summary

Migrating all Mercury trading data from typhon (Hetzner/German digital vermaht jurisdiction) to hecate (secure jurisdiction) to preserve valuable trading information while eliminating jurisdiction risk.

Current State Assessment

Source: Typhon (95.216.19.225) - Hetzner (digital vermaht)

  • PostgreSQL Databases (24GB total):
    • mercury-a: 7.0 GB
    • mercury-b: 7.0 GB
    • mercury-h: 7.0 GB
    • mercury-r: 3.0 GB
  • Redis Data: 814 MB (TA cache + job queues)
  • Status: All Mercury variants A,B,H,R running

Destination: Hecate (hecate-eth-almabay)

  • Current State: Clean, no Mercury containers
  • Capacity: Available for full Mercury deployment

Migration Strategy

Phase 1: Data Backup & Preparation (30 min)

  1. Stop Mercury services on typhon (graceful shutdown)
  2. Create PostgreSQL dumps for all variants
  3. Export Redis data (both RDB and AOF if available)
  4. Verify backup integrity

Phase 2: Environment Setup on Hecate (20 min)

  1. Deploy Mercury infrastructure using Tilt + docker-compose variants
  2. Initialize empty databases via docker-compose
  3. Configure networking and ports

Phase 3: Data Restoration (45 min)

  1. Transfer backup files typhon → hecate
  2. Restore PostgreSQL databases for all variants
  3. Restore Redis data
  4. Verify data integrity

Phase 4: Service Startup & Validation (15 min)

  1. Start Mercury services on hecate using Tilt (no Docker for bot/worker)
  2. Validate endpoints and health checks
  3. Verify trading data accessibility
  4. DNS/traffic cutover if needed

Technical Commands

Backup Commands (Typhon)

# PostgreSQL dumps
for variant in a b h r; do
docker exec ton-arcana-postgres-$variant-1 pg_dump -U postgres mercury-$variant > mercury-$variant-backup.sql
done

# Redis backup
docker exec ton-arcana-redis-1 redis-cli SAVE
docker cp ton-arcana-redis-1:/data/dump.rdb mercury-redis-backup.rdb

Transfer Commands

# Secure transfer to hecate
for variant in a b h r; do
scp mercury-$variant-backup.sql dev@hecate-eth-almabay:/tmp/
done
scp mercury-redis-backup.rdb dev@hecate-eth-almabay:/tmp/

Restoration Commands (Hecate)

# Restore PostgreSQL
for variant in a b h r; do
docker exec mercury-postgres-$variant-1 psql -U postgres -d mercury-$variant < /tmp/mercury-$variant-backup.sql
done

# Restore Redis
docker cp /tmp/mercury-redis-backup.rdb mercury-redis-1:/data/dump.rdb
docker restart mercury-redis-1

Risk Mitigation

  1. Data Verification: Checksums for all backup files
  2. Rollback Plan: Keep typhon running until hecate validated
  3. Downtime Window: Coordinate with trading schedules
  4. Monitoring: Health checks throughout migration

Success Criteria

  • All 4 Mercury databases restored (24GB total)
  • Redis cache data preserved (814MB)
  • All Mercury endpoints responding on hecate
  • Trading data queries successful
  • Historical TA data accessible

Timeline

Total Estimated Time: 2 hours Recommended Window: Low trading activity period

Additional Requirements

Mercury-TA (Zephyr) Deployment

  • No data migration required (API-only service)
  • Deploy on hecate using Docker (part of docker-compose variants)
  • Requires Bybit API whitelist → New Amnezia VPN server (ordering in progress)

VNC Access for Amnezia Configuration

  • Current Status: GNOME desktop IS running on hecate (not broken!)
  • Goal: Reliable VNC access from redmax → hecate for Amnezia UI setup
  • Fallback: Alternative remote desktop solutions if VNC fails

VNC Recovery Plan

Safe VNC Setup Strategy

  1. Check existing GNOME session (already confirmed running)
  2. Install lightweight VNC alternative (x11vnc vs tigervnc)
  3. Minimal desktop session for VNC to avoid conflicts
  4. Fallback options: NoMachine, TeamViewer, or Chrome Remote Desktop

VNC Commands (Conservative Approach)

# Option 1: x11vnc (shares existing session)
sudo apt install x11vnc
x11vnc -display :0 -passwd yourpassword -forever -bg

# Option 2: Fresh tigervnc with XFCE fallback
sudo apt install tigervnc-standalone-server xfce4-session
vncserver :2 -geometry 1920x1080 -depth 24

Next Steps

  1. Phase 1: Execute Mercury data backup from typhon
  2. Phase 2: Setup Mercury infrastructure on hecate using Tilt
  3. Phase 3: Restore Mercury data and validate
  4. Phase 4: Setup VNC for Amnezia configuration
  5. Phase 5: Deploy Mercury-TA with VPN whitelist (Docker only)
  6. Phase 6: Decommission typhon services

Deployment Architecture

Hecate Deployment Strategy

  • Mercury Bot/Worker: Deployed via Tilt (no Docker containers)
  • Mercury-TA: Deployed via Docker (docker-compose variants)
  • Infrastructure: PostgreSQL, Redis, Telegram Bot API via Docker
  • Development: Tiltfile in repo root for easy hecate deployment