From c5b54f7dbb5fdb6b39e0db3a7c550166398f50b1 Mon Sep 17 00:00:00 2001 From: Jeff Morgan Date: Sun, 19 Oct 2014 19:37:37 -0700 Subject: [PATCH] Moved additional eth2 network to instead replace eth1, bumped Boot2Docker dependency to 1.3 --- meteor/client/lib/boot2docker.js | 12 ++++-------- meteor/client/lib/docker.js | 2 ++ meteor/client/lib/installer.js | 8 +++++++- meteor/client/main.js | 18 +----------------- 4 files changed, 14 insertions(+), 26 deletions(-) diff --git a/meteor/client/lib/boot2docker.js b/meteor/client/lib/boot2docker.js index 67a42f0dab..19966da9b5 100644 --- a/meteor/client/lib/boot2docker.js +++ b/meteor/client/lib/boot2docker.js @@ -61,10 +61,8 @@ Boot2Docker.ip = function (callback) { Boot2Docker.setIp = function (ifname, ip, callback) { Boot2Docker.exec('ssh "sudo ifconfig ' + ifname + ' ' + ip + ' netmask 255.255.255.0"', function (err, stdout) { - Boot2Docker.exec('ssh "sudo awk \'{print $0 \",192.168.60.103\"}\' /var/lib/boot2docker/tls/hostnames > temp && sudo mv temp /var/lib/boot2docker/tls/hostnames && sudo chown root.root /var/lib/boot2docker/tls', function (err, stdout) { - Boot2Docker.exec('ssh "sudo /usr/local/etc/init.d/docker restart"', function (err, stdout) { - callback(err); - }); + Boot2Docker.exec('ssh "sudo rm -rf /var/lib/boot2docker/tls/* && sudo /etc/init.d/docker restart"', function (err, stdout) { + callback(err); }); }); }; @@ -83,11 +81,9 @@ Boot2Docker.start = function (callback) { return; } self.exec('start', function (err, stdout) { - // Sometimes boot2docker returns an error code even though it's working / waiting, so treat that as - // Success as well - if (!err || (err.indexOf('Waiting') !== -1 || err.indexOf('Writing') !== -1)) { + // Sometimes boot2docker returns an error code even though it's working / waiting, so treat that as success as well + if (!err || (err.indexOf('Waiting') !== -1 || err.indexOf('Writing') !== -1 || err.indexOf('Generating a server cert') !== -1)) { self.correct(function (err) { - if (err) { callback(err); return; } self.injectUtilities(function (err) { callback(err); }); diff --git a/meteor/client/lib/docker.js b/meteor/client/lib/docker.js index 44945c296e..dcc2133b25 100644 --- a/meteor/client/lib/docker.js +++ b/meteor/client/lib/docker.js @@ -14,6 +14,7 @@ Docker.HOST_PORT = '2376'; Docker.client = function () { return new Dockerode({ + protocol: 'https', host: Docker.HOST_IP, port: Docker.HOST_PORT, ca: fs.readFileSync(path.join(Docker.CERT_DIR, 'ca.pem')), @@ -353,6 +354,7 @@ Docker.reloadDefaultContainers = function (callback) { async.until(function () { return ready; }, function (callback) { + docker = Docker.client(); docker.listContainers(function (err) { if (!err) { ready = true; diff --git a/meteor/client/lib/installer.js b/meteor/client/lib/installer.js index 5fae2d2c05..3bff06d94a 100644 --- a/meteor/client/lib/installer.js +++ b/meteor/client/lib/installer.js @@ -119,7 +119,13 @@ Installer.steps = [ if (state !== 'running') { console.log('starting'); Boot2Docker.start(function (err) { - callback(err); + if (err) { + callback(err); + return; + } + Boot2Docker.setIp('eth1', Boot2Docker.REQUIRED_IP, function(err) { + callback(err); + }); }); } else { Boot2Docker.setIp('eth1', Boot2Docker.REQUIRED_IP, function(err) { diff --git a/meteor/client/main.js b/meteor/client/main.js index 09ffc5483b..4f04f15b31 100755 --- a/meteor/client/main.js +++ b/meteor/client/main.js @@ -157,24 +157,8 @@ Meteor.setInterval(function () { Meteor.setInterval(function () { if (!Session.get('installing')) { Sync.resolveWatchers(function () {}); - if (!Session.get('boot2dockerOff')) { - fixBoot2DockerVM(function (err) { - if (err) { console.log(err); return; } - AppUtil.recover(); - fixDefaultImages(function (err) { - if (err) { console.log(err); return; } - fixDefaultContainers(function (err) { - if (err) { console.log(err); } - }); - }); - }); - } - } -}, 5000); - -Meteor.setInterval(function () { - if (!Session.get('installing')) { ImageUtil.sync(); AppUtil.sync(); + AppUtil.recover(); } }, 5000);