diff --git a/setup/INFRA_VERSION b/setup/INFRA_VERSION index 61bd6bcf9..487d57402 100644 --- a/setup/INFRA_VERSION +++ b/setup/INFRA_VERSION @@ -3,7 +3,7 @@ # If you change the infra version, be sure to put a warning # in the change log -INFRA_VERSION=15 +INFRA_VERSION=16 # WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING # These constants are used in the installer script as well @@ -11,7 +11,7 @@ BASE_IMAGE=cloudron/base:0.6.0 MYSQL_IMAGE=cloudron/mysql:0.6.0 POSTGRESQL_IMAGE=cloudron/postgresql:0.6.0 MONGODB_IMAGE=cloudron/mongodb:0.6.0 -REDIS_IMAGE=cloudron/redis:0.6.0 # if you change this, fix src/addons.js as well +REDIS_IMAGE=cloudron/redis:0.6.1 # if you change this, fix src/addons.js as well MAIL_IMAGE=cloudron/mail:0.6.0 GRAPHITE_IMAGE=cloudron/graphite:0.6.0 diff --git a/src/addons.js b/src/addons.js index b356d430e..81a804358 100644 --- a/src/addons.js +++ b/src/addons.js @@ -89,7 +89,7 @@ var KNOWN_ADDONS = { redis: { setup: setupRedis, teardown: teardownRedis, - backup: NOOP, // no backup because we store redis as part of app's volume + backup: backupRedis, restore: setupRedis // same thing }, localstorage: { @@ -755,7 +755,7 @@ function setupRedis(app, options, callback) { name: 'redis-' + app.id, Hostname: config.appFqdn(app.location), Tty: true, - Image: 'cloudron/redis:0.6.0', // if you change this, fix setup/INFRA_VERSION as well + Image: 'cloudron/redis:0.6.1', // if you change this, fix setup/INFRA_VERSION as well Cmd: null, Volumes: { '/tmp': {}, @@ -837,3 +837,19 @@ function teardownRedis(app, options, callback) { }); }); } + +function backupRedis(app, options, callback) { + debugApp(app, 'Backing up redis'); + + callback = once(callback); // ChildProcess exit may or may not be called after error + + var cp = spawn('/usr/bin/docker', [ 'exec', 'redis-' + app.id, '/addons/redis/service.sh', 'backup' ]); + cp.on('error', callback); + cp.on('exit', function (code, signal) { + debugApp(app, 'backupRedis: done. code:%s signal:%s', code, signal); + if (!callback.called) callback(code ? 'backupRedis failed with status ' + code : null); + }); + + cp.stdout.pipe(process.stdout); + cp.stderr.pipe(process.stderr); +}