Skip to content

Instantly share code, notes, and snippets.

@mfojtik
Created March 11, 2014 18:47
Show Gist options
  • Save mfojtik/9492392 to your computer and use it in GitHub Desktop.
Save mfojtik/9492392 to your computer and use it in GitHub Desktop.
snapshot-restore on stopped application
# rhc app create ruby13 -s mysql-5.5 postgresql-9.2
Application Options
-------------------
Domain: mfojtik
Cartridges: ruby-1.9, mysql-5.5, postgresql-9.2
Gear Size: default
Scaling: yes
Creating application 'ruby13' ... done
MySQL 5.5 database added. Please make note of these credentials:
Root User: admin8rR5NT3
Root Password: lMnmQ9YRvDXW
Database Name: ruby13
Connection URL: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/
You can manage your new MySQL database by also embedding phpmyadmin.
The phpmyadmin username and password will be the same as the MySQL credentials above.
PostgreSQL 9.2 database added. Please make note of these credentials:
Root User: admindqwkugk
Root Password: beZUshwCsQ-2
Database Name: ruby13
Connection URL: postgresql://$OPENSHIFT_POSTGRESQL_DB_HOST:$OPENSHIFT_POSTGRESQL_DB_PORT
Waiting for your DNS name to be available ... done
Your application 'ruby13' is now available.
URL: http://ruby13-mfojtik.dev.rhcloud.com/
SSH to: 531f588eefce2d79a2000001@ruby13-mfojtik.dev.rhcloud.com
Git remote: ssh://531f588eefce2d79a2000001@ruby13-mfojtik.dev.rhcloud.com/~/git/ruby13.git/
Run 'rhc show-app ruby13' for more details about your app.
# rhc app stop -a ruby13
RESULT:
ruby13 stopped
# rhc show-app ruby13 --gears
ID State Cartridges Size SSH URL
------------------------ ------- -------------------- ----- -------------------------------------------------------------------------
531f588eefce2d6ce0000001 stopped mysql-5.5 small 531f588eefce2d6ce0000001@531f588eefce2d6ce0000001-mfojtik.dev.rhcloud.com
531f588eefce2d6ce0000002 stopped postgresql-9.2 small 531f588eefce2d6ce0000002@531f588eefce2d6ce0000002-mfojtik.dev.rhcloud.com
531f588eefce2d79a2000001 stopped haproxy-1.4 ruby-1.9 small 531f588eefce2d79a2000001@ruby13-mfojtik.dev.rhcloud.com
# rhc snapshot save -a ruby13 -f ruby13.tar.gz
Pulling down a snapshot to ruby13.tar.gz...
Saving snapshot for secondary mysql-5.5 gear
Creating and sending tar.gz
Saving snapshot for secondary postgresql-9.2 gear
Creating and sending tar.gz
Creating and sending tar.gz
RESULT:
Success
# rhc show-app ruby13 --gears
ID State Cartridges Size SSH URL
------------------------ ------- -------------------- ----- -------------------------------------------------------------------------
531f588eefce2d6ce0000001 stopped mysql-5.5 small 531f588eefce2d6ce0000001@531f588eefce2d6ce0000001-mfojtik.dev.rhcloud.com
531f588eefce2d6ce0000002 stopped postgresql-9.2 small 531f588eefce2d6ce0000002@531f588eefce2d6ce0000002-mfojtik.dev.rhcloud.com
531f588eefce2d79a2000001 stopped haproxy-1.4 ruby-1.9 small 531f588eefce2d79a2000001@ruby13-mfojtik.dev.rhcloud.com
# rhc snapshot restore -a ruby13 -f ruby13.tar.gz
Restoring from snapshot ruby13.tar.gz...
Removing old git repo: ~/git/ruby13.git/
Removing old data dir: ~/app-root/data/*
Restoring ~/git/ruby13.git and ~/app-root/data
Restoring snapshot for mysql-5.5 gear
Removing old data dir: ~/app-root/data/*
Restoring ~/app-root/data
Old and new names are the same, no need to rename
Restoring snapshot for postgresql-9.2 gear
Removing old data dir: ~/app-root/data/*
Restoring ~/app-root/data
Activation status: success
RESULT:
Success
# rhc show-app ruby13 --gears
ID State Cartridges Size SSH URL
------------------------ ------- -------------------- ----- -------------------------------------------------------------------------
531f588eefce2d6ce0000001 stopped mysql-5.5 small 531f588eefce2d6ce0000001@531f588eefce2d6ce0000001-mfojtik.dev.rhcloud.com
531f588eefce2d6ce0000002 stopped postgresql-9.2 small 531f588eefce2d6ce0000002@531f588eefce2d6ce0000002-mfojtik.dev.rhcloud.com
531f588eefce2d79a2000001 stopped haproxy-1.4 ruby-1.9 small 531f588eefce2d79a2000001@ruby13-mfojtik.dev.rhcloud.com
~/code/rh/origin-server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment