Skip to content

Instantly share code, notes, and snippets.

@fjuma

fjuma/upgrade.md Secret

Last active January 4, 2016 19:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fjuma/499827d650465a1a8f5a to your computer and use it in GitHub Desktop.
Save fjuma/499827d650465a1a8f5a to your computer and use it in GitHub Desktop.
Upgrading the OpenShift AeroGear Push Server Cartridge via a Snapshot/Restore Approach

Upgrading the OpenShift AeroGear Push Server Cartridge

Snapshot/restore approach

The overall idea is to take a snapshot of the database (and other configuration) for an older existing cartridge instance, delete this old instance, and then create a new instance based on the latest cartridge version and restore the new instance's database (and other configuration) to the state in the snapshot. The new instance must have the same name as the old instance.

The necessary snapshot/restore action hooks have been implemented and can be found [here] (https://github.com/fjuma/openshift-origin-cartridge-aerogear-push/tree/upgrade).

Trying out the upgrade process

If you'd like to help test this process, the following steps can be used to try upgrading from an AeroGear Push Server 0.9.0 cartridge instance. There's one important caveat though: because an 0.9.0 instance won't have the necessary snapshot hook, you'll need to manually perform some commands to save the necessary data (step 3 below). If we include these snapshot/restore action hooks in the 0.10.0 cartridge release, users will be able to make use of these hooks for future upgrades, e.g., for upgrading from 0.10.0 to 0.11.0.

  1. Create an 0.9.0 cartridge instance:
rhc create-app --no-git mypush "https://cartreflect-claytondev.rhcloud.com/reflect?github=aerogear/openshift-origin-cartridge-aerogear-push&commit=44a1a2eb4f4f72fc7abc80aee78fbe74c802d9ce" mysql-5.1
  1. Log into the admin console, set your new password, create push applications, create variants, and send some push notifications.

  2. ssh into your instance and perform these commands (this step manually captures needed data):

echo "$OPENSHIFT_AEROGEAR_PUSH_TOKEN_KEY" > $OPENSHIFT_DATA_DIR/aerogear_push_token_key
cp $OPENSHIFT_AEROGEAR_PUSH_DIR/standalone/configuration/standalone.xml $OPENSHIFT_DATA_DIR/standalone.snapshot.xml
  1. Create a snapshot of the 0.9.0 instance: rhc snapshot save mypush

  2. Delete the 0.9.0 instance: rhc app delete mypush
    Note: If the --nogit option wasn't provided in step 1, you'll also need to delete the local mypush directory on your machine.

  3. Create a new cartridge instance (this uses my fork of the 0.10.x cartridge branch that contains the snapshot/restore action hooks):

rhc create-app --no-git mypush "https://cartreflect-claytondev.rhcloud.com/reflect?github=fjuma/openshift-origin-cartridge-aerogear-push&commit=9f8941ca095e07e36d0ee20e29f69f249c865390" mysql-5.1
  1. Restore the instance: rhc snapshot restore mypush -f /PATH/TO/mypush.tar.gz

  2. If you're using Firefox, you'll need to restart it to avoid an issue with caching.

  3. You should now be able to log into the admin console with the same password you previously set, see existing push applications and variants, and send push notifications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment