Back to Agile Task Board 1.
2.
3.
Exports local data
Transfers archive via SCP
Runs import on remote server
Cleanup options Update
Restart services:
Verify the migration:
- Test login functionality
- Check that todos are displayed
- Verify uploaded images work
- Test creating new todosSetup SSL (if not done):
Always backup before importing
Test migrations on staging first
Verify exports by checking manifest.json
Clean up export files after migration
Document environment-specific configurations
Documentation
ADMIN MIGRATION
Admin Data Migration Guide
This guide explains how to migrate your complete ReactGoLogin data between environments (local to dev, dev to production, etc.).
Overview
The migration scripts provide a complete solution for:
- Full database export/import (all tables, all users)
- Uploaded files/images migration
- Configuration management
- One-command migration to remote servers
Scripts
1. export-all.sh - Export Everything
Exports your complete application data into a single archive.
bash
./scripts/export-all.shWhat it exports:
- Complete MySQL database (all databases, not just reactgologin)
- All uploaded files from
/uploadsdirectory - Configuration metadata (sanitized)
- Manifest file with export details
- Creates archive at
~/exports/reactgologin_export_TIMESTAMP.tar.gz - Shows summary of exported data
2. import-all.sh - Import Everything
Imports a previously exported archive into the current environment.
bash
./scripts/import-all.sh reactgologin_export_20241223_143022.tar.gzWhat it does:
- Validates the import archive
- Creates backup of current data (optional)
- Imports complete database
- Restores all uploaded files
- Restarts services
- Pre-import validation
- Automatic backup before import
- Rollback capability
3. migrate-to-server.sh - One-Command Migration
Automates the entire migration process to a remote server.
bash
./scripts/migrate-to-server.sh user@server:/path/to/app
# Example:
./scripts/migrate-to-server.sh root@5.75.186.52:/var/www/reactgologinProcess:
Usage Examples
Local to Dev Server Migration
bash
# Option 1: Manual steps
./scripts/export-all.sh
scp ~/exports/reactgologin_export_*.tar.gz user@dev-server:/tmp/
ssh user@dev-server
cd /var/www/reactgologin
./scripts/import-all.sh /tmp/reactgologin_export_*.tar.gz
# Option 2: Automated
./scripts/migrate-to-server.sh user@dev-server:/var/www/reactgologin
Dev to Production Migration
bash
# On dev server
./scripts/export-all.sh
# Transfer to production
scp ~/exports/reactgologin_export_*.tar.gz user@prod-server:/tmp/
# On production server
cd /var/www/reactgologin
./scripts/import-all.sh /tmp/reactgologin_export_*.tar.gz
Archive Structure
shell
reactgologin_export_TIMESTAMP.tar.gz
├── manifest.json # Export metadata
├── database/
│ └── full_dump.sql # Complete MySQL dump
├── uploads/ # All uploaded files
│ └── ...
└── config/
└── environment.json # Configuration info
Post-Migration Steps
After importing data, you must:
.env file with environment-specific values:bash
API_URL=http://your-server-ip/query
DB_PASSWORD=your-production-password
JWT_SECRET=your-production-secret
bash
docker-compose -f docker-compose.prod.yml restart
bash
./scripts/setup-ssl.sh
Security Considerations
- Passwords: Database root password is used for full export
- Sensitive Data: JWT secrets and API keys are NOT included in exports
- File Permissions: Import script sets appropriate permissions
- Cleanup: Always delete export files after migration
Troubleshooting
Export Issues
- Permission denied: Run with sudo or ensure Docker permissions
- No space: Check disk space before export
- Empty export: Verify services are running
Import Issues
- Database errors: Ensure MySQL service is running
- Permission errors: Check file ownership after import
- Missing data: Verify export was complete
Migration Issues
- SSH errors: Ensure SSH key access to remote server
- Path errors: Verify remote path exists
- Script not found: Scripts are copied automatically if missing
Best Practices
Limitations
- Requires root MySQL access for full database export
- Large databases may take time to export/import
- Network speed affects migration time
- Some environment-specific configs need manual update