merge start options into hostconfig

This commit is contained in:
Girish Ramakrishnan
2015-10-19 21:35:02 -07:00
parent 15aa4ecc5d
commit fb56795cbd

View File

@@ -762,23 +762,22 @@ function setupRedis(app, options, callback) {
'/tmp': {}, '/tmp': {},
'/run': {} '/run': {}
}, },
VolumesFrom: [] VolumesFrom: [],
}; HostConfig: {
Binds: [
var startOptions = { redisVarsFile + ':/etc/redis/redis_vars.sh:ro',
Binds: [ redisDataDir + ':/var/lib/redis:rw'
redisVarsFile + ':/etc/redis/redis_vars.sh:ro', ],
redisDataDir + ':/var/lib/redis:rw' Memory: 1024 * 1024 * 75, // 100mb
], MemorySwap: 1024 * 1024 * 75 * 2, // 150mb
Memory: 1024 * 1024 * 75, // 100mb PortBindings: {
MemorySwap: 1024 * 1024 * 75 * 2, // 150mb '6379/tcp': [{ HostPort: '0', HostIp: '127.0.0.1' }]
PortBindings: { },
'6379/tcp': [{ HostPort: '0', HostIp: '127.0.0.1' }] ReadonlyRootfs: true,
}, RestartPolicy: {
ReadonlyRootfs: true, 'Name': 'always',
RestartPolicy: { 'MaximumRetryCount': 0
'Name': 'always', }
'MaximumRetryCount': 0
} }
}; };
@@ -794,7 +793,7 @@ function setupRedis(app, options, callback) {
docker.createContainer(createOptions, function (error) { docker.createContainer(createOptions, function (error) {
if (error && error.statusCode !== 409) return callback(error); // if not already created if (error && error.statusCode !== 409) return callback(error); // if not already created
redisContainer.start(startOptions, function (error) { redisContainer.start(function (error) {
if (error && error.statusCode !== 304) return callback(error); // if not already running if (error && error.statusCode !== 304) return callback(error); // if not already running
appdb.setAddonConfig(app.id, 'redis', env, function (error) { appdb.setAddonConfig(app.id, 'redis', env, function (error) {