diff --git a/meteor/client/lib/boot2docker.js b/meteor/client/lib/boot2docker.js index 71f842296a..d8618f30fe 100644 --- a/meteor/client/lib/boot2docker.js +++ b/meteor/client/lib/boot2docker.js @@ -7,7 +7,7 @@ Boot2Docker = {}; Boot2Docker.REQUIRED_IP = '192.168.60.103'; Boot2Docker.command = function () { - return path.join(Util.getBinDir().replace(' ', '\\ '), 'boot2docker-1.2.0') + ' --vm="kitematic-vm"'; + return path.join(Util.getBinDir().replace(' ', '\\ '), 'boot2docker-1.3.0') + ' --vm="kitematic-vm"'; }; Boot2Docker.exec = function (command, callback) { @@ -60,8 +60,12 @@ Boot2Docker.ip = function (callback) { }; Boot2Docker.setIp = function (ifname, ip, callback) { - this.exec('ssh "sudo ifconfig ' + ifname + ' ' + ip + ' netmask 255.255.255.0"', function (err, stdout) { - callback(err); + 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); + }); + }); }); }; @@ -78,10 +82,10 @@ Boot2Docker.start = function (callback) { callback('Cannot start if the boot2docker VM doesn\'t exist'); return; } - self.exec('up -v', function (err, stdout) { + 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 for VM to be started') !== -1 || err.indexOf('..........') !== -1)) { + if (!err || (err.indexOf('Waiting') !== -1 || err.indexOf('Writing') !== -1)) { self.correct(function (err) { if (err) { callback(err); return; } self.injectUtilities(function (err) { @@ -96,7 +100,7 @@ Boot2Docker.start = function (callback) { }; Boot2Docker.correct = function (callback) { - Boot2Docker.setIp('eth2', Boot2Docker.REQUIRED_IP, function(err) { + Boot2Docker.setIp('eth1', Boot2Docker.REQUIRED_IP, function(err) { if (err) { callback(err); return; } VirtualBox.removeDHCP(function (err) { callback(); @@ -239,7 +243,7 @@ Boot2Docker.version = function (callback) { }; Boot2Docker.injectUtilities = function (callback) { - exec('/bin/cat ' + path.join(Util.getBinDir(), 'kite-binaries.tar.gz') + ' | ' + Boot2Docker.command() + ' ssh "tar zx -C /usr/local/bin"', function (err, stdout) { + exec('/bin/cat ' + path.join(Util.getBinDir(), 'kite-binaries.tar.gz') + ' | ' + Boot2Docker.command() + ' ssh "sudo tar zx -C /usr/local/bin && sudo chown -R root.root /usr/local/bin"', function (err, stdout) { callback(err); }); }; diff --git a/meteor/client/lib/docker.js b/meteor/client/lib/docker.js index 2bd3b447f4..a498b2e518 100644 --- a/meteor/client/lib/docker.js +++ b/meteor/client/lib/docker.js @@ -2,15 +2,24 @@ var Dockerode = require('dockerode'); var async = require('async'); var exec = require('exec'); var path = require('path'); +var fs = require('fs'); Docker = {}; -Docker.DOCKER_HOST = '192.168.60.103'; Docker.DEFAULT_IMAGES_FILENAME = 'base-images-0.0.2.tar.gz'; Docker.DEFAULT_IMAGES_CHECKSUM = 'a3517ac21034a1969d9ff15e3c41b1e2f1aa83c67b16a8bd0bc378ffefaf573b'; // Sha256 Checksum +Docker.CERT_DIR = path.join(process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME'], '.boot2docker/certs/kitematic-vm'); +Docker.HOST_IP = '192.168.60.103'; +Docker.HOST_PORT = '2376'; Docker.client = function () { - return new Dockerode({host: Docker.DOCKER_HOST, port: '2375'}); + return new Dockerode({ + host: Docker.HOST_IP, + port: Docker.HOST_PORT, + ca: fs.readFileSync(path.join(Docker.CERT_DIR, 'ca.pem')), + cert: fs.readFileSync(path.join(Docker.CERT_DIR, 'cert.pem')), + key: fs.readFileSync(path.join(Docker.CERT_DIR, 'key.pem')) + }); }; var docker = Docker.client(); diff --git a/meteor/client/lib/installer.js b/meteor/client/lib/installer.js index e5f4041502..5fae2d2c05 100644 --- a/meteor/client/lib/installer.js +++ b/meteor/client/lib/installer.js @@ -38,7 +38,6 @@ Installer.steps = [ progressCallback(progress); }); } else { - // Version 4.3.12 is required. VirtualBox.version(function (err, installedVersion) { if (err) {callback(err); return;} if (Util.compareVersions(installedVersion, VirtualBox.REQUIRED_VERSION) < 0) { @@ -65,7 +64,7 @@ Installer.steps = [ }); } }, - pastMessage: 'VirtualBox installed', + pastMessage: 'VirtualBox Installed', message: 'Downloading & Installing VirtualBox', futureMessage: 'Download & Install VirtualBox if necessary' }, @@ -76,7 +75,7 @@ Installer.steps = [ Boot2Docker.exists(function (err, exists) { if (err) { callback(err); return; } if (!exists) { - var vmFilesPath = path.join(Util.getHomePath(), 'VirtualBox VMs', 'kitematic-vm'); + var vmFilesPath = path.join(Util.getHomePath(), 'VirtualBox\ VMs', 'kitematic-vm'); if (fs.existsSync(vmFilesPath)) { Util.deleteFolder(vmFilesPath); } @@ -92,7 +91,7 @@ Installer.steps = [ callback(err); }); }); - } + } } }); }, @@ -123,7 +122,7 @@ Installer.steps = [ callback(err); }); } else { - Boot2Docker.setIp('eth2', Boot2Docker.REQUIRED_IP, function(err) { + Boot2Docker.setIp('eth1', Boot2Docker.REQUIRED_IP, function(err) { callback(err); }); } diff --git a/meteor/client/lib/virtualbox.js b/meteor/client/lib/virtualbox.js index 85bae6dae9..6c0b6a1c30 100644 --- a/meteor/client/lib/virtualbox.js +++ b/meteor/client/lib/virtualbox.js @@ -4,10 +4,10 @@ var path = require('path'); VirtualBox = {}; -VirtualBox.REQUIRED_VERSION = '4.3.14'; -VirtualBox.INCLUDED_VERSION = '4.3.14'; -VirtualBox.INSTALLER_FILENAME = 'virtualbox-4.3.14.pkg'; -VirtualBox.INSTALLER_CHECKSUM = '486348a5336539728ca20dcd9674cf3d37e5c7f32255d90f1edc7391b54bd5dd'; // Sha256 Checksum +VirtualBox.REQUIRED_VERSION = '4.3.18'; +VirtualBox.INCLUDED_VERSION = '4.3.18'; +VirtualBox.INSTALLER_FILENAME = 'virtualbox-4.3.18.pkg'; +VirtualBox.INSTALLER_CHECKSUM = '5836c94481c460c648b9216386591a2915293ac86b9bb6c57746637796af6af2'; // Sha256 Checksum // Info for the hostonly interface we add to the VM. VirtualBox.HOSTONLY_HOSTIP = '192.168.60.3'; @@ -129,7 +129,7 @@ VirtualBox.addCustomHostAdapter = function (vm, callback) { var self = this; self.hostOnlyAdapter(function (err, ifname) { if (err) { callback(err); return; } - self.exec('modifyvm ' + vm + ' --nic3 hostonly --nictype3 virtio --cableconnected3 on --hostonlyadapter3 ' + ifname, function (err, stdout, stderr) { + self.exec('modifyvm ' + vm + ' --nic2 hostonly --nictype2 virtio --cableconnected2 on --hostonlyadapter2 ' + ifname, function (err, stdout, stderr) { callback(err, ifname); }); }); diff --git a/meteor/client/main.js b/meteor/client/main.js index 33b0a1c216..82206ca081 100755 --- a/meteor/client/main.js +++ b/meteor/client/main.js @@ -124,24 +124,26 @@ var fixDefaultContainers = function (callback) { }; Meteor.setInterval(function () { - Boot2Docker.exists(function (err, exists) { - if (err) { console.log(err); return; } - if (exists) { - Boot2Docker.state(function (err, state) { - if (err) { console.log(err); return; } - Session.set('boot2dockerState', state); - if (state === 'running') { - Boot2Docker.stats(function (err, stats) { - if (err) { console.log(err); return; } - if (stats.state !== 'poweroff' && stats.memory && stats.disk) { - Session.set('boot2dockerMemoryUsage', stats.memory); - Session.set('boot2dockerDiskUsage', stats.disk); - } - }); - } - }); - } - }); + if (!Session.get('installing')) { + Boot2Docker.exists(function (err, exists) { + if (err) { console.log(err); return; } + if (exists) { + Boot2Docker.state(function (err, state) { + if (err) { console.log(err); return; } + Session.set('boot2dockerState', state); + if (state === 'running') { + Boot2Docker.stats(function (err, stats) { + if (err) { console.log(err); return; } + if (stats.state !== 'poweroff' && stats.memory && stats.disk) { + Session.set('boot2dockerMemoryUsage', stats.memory); + Session.set('boot2dockerDiskUsage', stats.disk); + } + }); + } + }); + } + }); + } }, 5000); Meteor.setInterval(function () { diff --git a/package.json b/package.json index 38edfc153f..a9bb0c9d79 100644 --- a/package.json +++ b/package.json @@ -3,16 +3,16 @@ "main": "index.js", "version": "0.2.3", "dependencies": { + "ansi-to-html": "0.2.0", "async": "^0.9.0", "chokidar": "git+https://github.com/usekite/chokidar.git", + "dockerode": "2.0.3", "exec": "^0.1.2", "moment": "2.8.1", + "ncp": "0.6.0", "open": "0.0.5", - "dockerode": "2.0.3", - "tar": "0.1.20", - "ansi-to-html": "0.2.0", "request": "2.42.0", "request-progress": "0.3.1", - "ncp": "0.6.0" + "tar": "0.1.20" } } diff --git a/script/setup.sh b/script/setup.sh index 6808d9023e..6599e4d6d1 100755 --- a/script/setup.sh +++ b/script/setup.sh @@ -11,7 +11,7 @@ mkdir -p cache pushd cache -BOOT2DOCKER_CLI_VERSION=1.2.0 +BOOT2DOCKER_CLI_VERSION=1.3.0 BOOT2DOCKER_CLI_VERSION_FILE=boot2docker-$BOOT2DOCKER_CLI_VERSION BOOT2DOCKER_CLI_FILE=boot2docker @@ -54,7 +54,7 @@ pushd resources if [ ! -f $BOOT2DOCKER_CLI_VERSION_FILE ]; then cecho "-----> Downloading Boot2docker CLI..." $purple - curl -L -o $BOOT2DOCKER_CLI_VERSION_FILE https://s3.amazonaws.com/kite-installer/boot2docker-v$BOOT2DOCKER_CLI_VERSION + curl -L -o $BOOT2DOCKER_CLI_VERSION_FILE https://github.com/boot2docker/boot2docker-cli/releases/download/v${BOOT2DOCKER_CLI_VERSION}/boot2docker-v${BOOT2DOCKER_CLI_VERSION}-darwin-amd64 fi chmod +x $BOOT2DOCKER_CLI_VERSION_FILE