The contents of this repo allow for an easy migration of Redis service instances using a custom Docker Image and Push2Cloud Workflow.
Note: this workflow creates service instances that might incur additional cost.
git clone https://github.com/push2cloud/migrate-redis.git
cd migrate-redis
vi deploymentConfig.json # Edit target to fit your deployment
npm install # install push2cloud dependencies
DEBUG=* ./node_modules/.bin/p2c exec ./workflow/migrate.js
The workflow performs the following steps for you:
- Create all the required Push2Cloud data structures
- Create new service instances (same plan is used)
- Create migration apps, configure via environment variables
- Stops all applications in configured space
- Starts migration apps and waits for completion/failure
- Stops and deletes migration apps
- Renames old service instances to ${name}-old
- Renames new serivce instances to their proper name
- Starts all apps again
By default, the migration will always use a service called redis
. If the service is called differently, you can configure the names via environment variables:
OLD_SERVICE_TYPE_NAME=redis-2 NEW_SERVICE_TYPE_NAME=redis-2 DEBUG=* ./node_modules/.bin/p2c exec ./workflow/migrate.js
The migration application is a custom Docker image that runs migrate.sh
on startup. The docker container must be configured via the two environment variables fromService
and toSerivice
(names of the CF service instances). migrate.sh
performs a complete data migration between the configured services using redis-dump and the redis-cli
This workflow is meant to be used as a base for your own custom migration workflows. You probably want to fine tune start/stop behaviour to your liking. Open an Issue if you have questions on how to achieve certain things.