Files
btc-trading/MIGRATION_CHECKLIST.md

2.8 KiB

Quick Migration Checklist

Pre-Migration (Current Location)

  • Review PROJECT_CONTEXT.md
  • Ensure all Dockerfiles don't have apt-get commands
  • Note any custom modifications made
  • Export any existing data (if needed):
    docker exec btc_timescale pg_dump -U btc_bot btc_data > backup.sql
    

Copy Files

Copy entire btc_bot/ folder to new location:

# Option 1: Direct copy
cp -r btc_bot /new/location/

# Option 2: Tar archive
tar -czvf btc_bot_backup.tar.gz btc_bot/
# Copy to new location
tar -xzvf btc_bot_backup.tar.gz -C /new/location/

# Option 3: rsync
rsync -avz --progress btc_bot/ user@new-host:/path/to/btc_bot/

Post-Migration (New Location)

  • Run migration helper: ./scripts/migrate.sh
  • Verify .env file exists and has correct password
  • Check file permissions: ls -la scripts/*.sh
  • Review docker/timescaledb.conf for any local adjustments
  • Update config/data_config.yaml if paths changed

Deploy

  • Run: ./scripts/deploy.sh
  • Check container status: docker-compose ps
  • Test health endpoint: curl http://localhost:8000/api/v1/health
  • Open dashboard: http://your-ip:8000/dashboard
  • Verify database: docker exec btc_timescale psql -U btc_bot -d btc_data -c "SELECT version();"

Verification

  • WebSocket connecting (check logs)
  • Candles appearing in database
  • Dashboard loading
  • API responding
  • No errors in logs

Optional: Import Old Data

If you exported data from old location:

docker exec -i btc_timescale psql -U btc_bot -d btc_data < backup.sql

Troubleshooting Migration Issues

Permission Denied on Scripts

chmod +x scripts/*.sh

Docker Build Fails

cd docker
docker-compose down
docker system prune -f
docker-compose build --no-cache

Database Connection Failed

# Check if .env has correct DB_PASSWORD
cat .env | grep DB_PASSWORD

# Verify database is running
docker-compose ps

# Check database logs
docker-compose logs timescaledb

Port Already in Use

# Check what's using port 5432 or 8000
sudo netstat -tulpn | grep 5432
sudo netstat -tulpn | grep 8000

# Change ports in docker-compose.yml if needed

Post-Migration Cleanup (Old Location)

After confirming new location works:

# Old location - stop and remove containers
cd docker
docker-compose down -v  # -v removes volumes (WARNING: deletes data!)

# Or just stop without deleting data
docker-compose down

Notes

  • Database data: Will be fresh (empty) in new location unless you export/import
  • Logs: Start fresh in new location
  • Configuration: .env file needs to be recreated in new location
  • Backups: Update backup scripts to point to new path

Remember: The project is now portable and ready for deployment anywhere with Docker support!