Migrating from Self-Hosted Keycloak
Migrate your existing Keycloak deployment to Skycloak with minimal downtime and zero data loss. This comprehensive guide walks you through migrating your users, configurations, themes, and extensions from self-hosted Keycloak to our fully managed platform.
Overview
Skycloak’s migration process helps you:
- Transfer all user data including passwords and sessions
- Preserve configurations for realms, clients, and roles
- Migrate custom themes and branding
- Move extensions and custom providers
- Maintain domain names with zero downtime
- Validate data integrity throughout the process
Why Migrate to Skycloak?
Eliminate Operational Overhead:
- No more server management
- Automatic updates and patches
- Built-in backup and recovery
- 24/7 monitoring and support
Reduce Costs:
- No infrastructure expenses
- Reduced DevOps requirements
- Predictable monthly pricing
- Included enterprise features
Improve Reliability:
- 99.9% uptime SLA
- Multi-region availability
- Automatic scaling
- DDoS protection included
Prerequisites
Before starting your migration:
Requirements Checklist
- Skycloak account with Developer plan or higher
- Admin access to your source Keycloak instance
- Database export capabilities (PostgreSQL, MySQL, or H2)
- Keycloak version 12.0 or higher (older versions need upgrade first)
- Database type PostgreSQL, MySQL, or MariaDB
- Backup of your current Keycloak data
- Maintenance window scheduled (typically 2-4 hours)
Pre-Migration Assessment
Evaluate your current deployment:
-
Check Keycloak version:
${KEYCLOAK_HOME}/bin/kc.sh version -
Assess database size:
SELECT pg_database_size('keycloak') / 1024 / 1024 as size_mb; -
Count users and realms:
SELECT COUNT(*) FROM user_entity; SELECT COUNT(*) FROM realm; -
List custom providers:
ls ${KEYCLOAK_HOME}/providers/
Migration Methods
Method 1: Database Export/Import (Recommended)
Best for: Complete migration with all data preserved
Method 2: Realm Export
Best for: Testing or partial migrations without user passwords
Step 1: Prepare Your Data
Export from Source Keycloak
Database Export (Recommended)
For PostgreSQL:
# Export complete database
pg_dump -h localhost -U keycloak -d keycloak \
--no-owner --no-privileges \
-f keycloak-backup.sql
# Compress for upload
gzip keycloak-backup.sqlFor MySQL/MariaDB:
# Export with required flags
mysqldump -u keycloak -p keycloak \
--single-transaction \
--skip-lock-tables \
--skip-add-drop-table \
--complete-insert \
--no-create-db \
--skip-extended-insert \
> keycloak-backup.sql
# Compress for upload (Required)
zip keycloak-backup.zip keycloak-backup.sqlRealm Export Alternative
If database export isn’t possible:
# Export specific realm
${KEYCLOAK_HOME}/bin/kc.sh export \
--file=realm-export.json \
--realm=your-realm
# Export all realms
${KEYCLOAK_HOME}/bin/kc.sh export \
--file=all-realms.jsonPrepare Theme Files
Package your custom themes:
# Navigate to themes directory
cd ${KEYCLOAK_HOME}/themes
# Create archive of custom themes
tar -czf custom-themes.tar.gz \
my-theme-1/ my-theme-2/Package Extensions
Collect custom providers and SPIs:
# Create extensions archive
cd ${KEYCLOAK_HOME}
tar -czf extensions.tar.gz \
providers/*.jar \
deployments/*.jarStep 2: Start Migration Wizard
Access the Migration Tool
- Navigate to Migration in your Skycloak dashboard
- Click “Start New Migration”
- Select your target cluster or create a new one
Step 3: Upload Database
Database Upload Process
- Select your database file
- Choose source database type (PostgreSQL, MySQL, H2)
- Specify source Keycloak version
- Begin upload
Upload Validation
After upload, the system validates:
- Database schema compatibility
- Data integrity checks
- User count verification
- Realm structure validation
Step 4: Configure Domain (Optional)
Domain Migration Options
Maintain your existing domain with zero downtime:
- Keep existing domain (recommended)
- Use Skycloak subdomain temporarily
- Configure custom domain later
Zero-Downtime Migration
For seamless transition:
- Set up Skycloak cluster with temporary domain
- Import and verify all data
- Test thoroughly with temporary domain
- Update DNS to point to Skycloak
- Monitor during DNS propagation
Step 5: Migrate Themes (Optional)
Theme Migration
Upload and configure your custom themes:
- Upload theme package
- Select themes to migrate
- Map to applications
Theme Compatibility
The migration tool:
- Checks theme compatibility with Keycloak version
- Identifies missing dependencies
- Suggests theme updates if needed
- Preserves theme customizations
Step 6: Migrate Extensions (Optional)
Extension Compatibility
Upload custom providers and extensions:
Step 7: Review and Confirm
Pre-Migration Summary
Review all migration settings before proceeding:
Step 8: Migration Execution
Live Migration Progress
Monitor the migration in real-time:
Migration Stages
- Database Schema Creation (5 minutes)
- Realm Import (10 minutes)
- User Data Import (varies by size)
- Role and Group Import (5 minutes)
- Client Configuration (10 minutes)
- Theme Deployment (5 minutes)
- Extension Installation (10 minutes)
- Validation and Testing (15 minutes)
Step 9: Validation
Automatic Validation
The system automatically validates:
- User count matches source
- All realms imported correctly
- Clients are functional
- Roles and permissions preserved
- Theme rendering correct
Manual Testing Checklist
Test critical functions:
- Admin can login to Keycloak console
- Users can authenticate successfully
- Password validation works
- SSO flow functions correctly
- Custom themes display properly
- Extensions operate as expected
- API authentication works
Step 10: Go Live
DNS Cutover
For domain migration:
-
Update DNS records:
Type: CNAME Host: auth.yourcompany.com Target: your-cluster.skycloak.io TTL: 300 (5 minutes for testing) -
Monitor DNS propagation:
- Use tools like whatsmydns.net
- Test from multiple locations
- Monitor authentication logs
-
Verify SSL certificates:
- Automatic SSL provisioning
- Certificate validation
- HTTPS enforcement
Post-Migration Tasks
Immediate Actions
- Monitor closely for 24-48 hours
- Check performance metrics
- Review error logs
- Gather user feedback
- Update documentation
Optimization Opportunities
After successful migration:
- Enable Skycloak-exclusive features
- Optimize realm configurations
- Implement enhanced security
- Set up automated backups
- Review analytics in the Insights dashboard
Rollback Plan
If Issues Occur
Have a rollback strategy ready:
- Keep source Keycloak running (read-only mode)
- Document rollback DNS settings
- Test rollback procedure before migration
- Have support contact ready
Rollback Steps
If needed:
- Revert DNS to original server
- Restore source Keycloak to active
- Investigate issues with Skycloak support
- Plan remediation before retry
Troubleshooting
Common Migration Issues
Large database timeout:
- Split export into smaller chunks
- Use realm-by-realm migration
- Contact support for assisted migration
Theme compatibility errors:
- Update theme to latest Keycloak version
- Use Theme Library for rebuilding
- Temporarily use default theme
Extension incompatibility:
- Check for updated versions
- Contact extension vendor
- Consider Skycloak alternatives
User authentication failures:
- Verify password encoding settings
- Check realm security settings
- Review client configurations
Migration Best Practices
Planning
- Schedule during low traffic
- Communicate with users in advance
- Have rollback plan ready
- Test in staging first if possible
- Document everything
Execution
- Take fresh backup before starting
- Monitor source system during migration
- Have support channel open
- Test incrementally after each stage
- Keep stakeholders informed
Post-Migration
- Monitor for 48 hours minimum
- Collect performance baseline
- Update disaster recovery plans
- Document new procedures
- Train team on Skycloak
Cost Considerations
Migration Costs
- One-time migration: Free with Developer+ plans
- Assisted migration: Available for Enterprise
- Data transfer: No ingress charges
- Temporary dual-running: Plan accordingly
Ongoing Savings
Calculate your ROI:
- Eliminated infrastructure costs
- Reduced DevOps time
- Lower security overhead
- Included feature value
Security During Migration
Data Protection
- All transfers use TLS 1.3
- Data encrypted at rest
- Temporary files auto-deleted
- Audit log of all operations
- Compliance maintained throughout
Access Control
- Migration requires admin rights
- Temporary credentials auto-expire
- All actions logged
- IP restrictions available
Support Options
Self-Service Migration
- Comprehensive documentation
- In-app guided wizard
- Email support at [email protected]
Assisted Migration (Enterprise)
- Dedicated migration specialist
- Custom migration planning
- Hands-on assistance
- Post-migration optimization
- 24/7 support during migration
Success Stories
Case Study Highlights
TechCorp: Migrated 50,000 users with zero downtime StartupXYZ: Reduced auth costs by 60% Enterprise Inc: Completed migration in 2 hours
Related Resources
- Getting Started - New to Skycloak?
- User Management - Managing migrated users
- Identity Providers - Configure SSO
- Theme Library - Manage migrated themes
- Monitoring - Track post-migration performance
Next Steps
After successful migration:
- Explore Skycloak features not available in self-hosted
- Optimize configurations for managed environment
- Review analytics in the Insights dashboard
- Plan disaster recovery procedures
- Schedule team training on Skycloak platform
Need Help?
- Documentation: docs.skycloak.io
- Support Portal: support.skycloak.io
- Email: [email protected]
- Enterprise Hotline: +1-555-SKYCLOAK