diff --git a/index.js b/index.js index 9fe8b62b3e..ba3a23f38f 100644 --- a/index.js +++ b/index.js @@ -51,7 +51,12 @@ var start = function (callback) { }); var started = false; mongoChild.stdout.setEncoding('utf8'); + mongoChild.stderr.setEncoding('utf8'); + mongoChild.stderr.on('data', function (data) { + console.log(data); + }); mongoChild.stdout.on('data', function (data) { + console.log(data); if (data.indexOf('waiting for connections on port ' + mongoPort)) { if (!started) { started = true; diff --git a/meteor/client/lib/installer.js b/meteor/client/lib/installer.js index 76a3465e0f..459ed06f7b 100644 --- a/meteor/client/lib/installer.js +++ b/meteor/client/lib/installer.js @@ -2,6 +2,12 @@ var async = require('async'); Installer = {}; +Installer.CURRENT_VERSION = '0.0.2'; + +Installer.isUpToDate = function () { + return !!Installs.findOne({version: Installer.CURRENT_VERSION}); +}; + /** * Install steps. A step is a function that accepts a function (err) callback and returns once that step is complete.keys: * - run: Function that runs the installation step and calls the callback with an error if failed. diff --git a/meteor/client/lib/router.js b/meteor/client/lib/router.js index 1ef66ba0dd..6e8168efd6 100755 --- a/meteor/client/lib/router.js +++ b/meteor/client/lib/router.js @@ -48,10 +48,15 @@ Router.map(function () { controller: 'SetupController', action: function () { if (this.ready()) { - var install = Installs.findOne(); - if (!install) { - console.log('No installs detected, running installer again.'); - this.redirect('/setup/intro'); + if (!Installer.isUpToDate()) { + if (!Installs.findOne()) { + console.log('No installs detected, running installer again.'); + this.redirect('/setup/intro'); + } else { + // There's an install but it's lower than the current version, re-run as an 'update'. + Session.set('isUpdating', true); + this.redirect('/setup/intro'); + } } else { this.redirect('/apps'); } diff --git a/meteor/client/main.js b/meteor/client/main.js index 0033c360b4..429201d295 100755 --- a/meteor/client/main.js +++ b/meteor/client/main.js @@ -146,7 +146,7 @@ Meteor.setInterval(function () { }, 5000); Meteor.setInterval(function () { - if (Installs.findOne()) { + if (Installer.isUpToDate()) { resolveWatchers(function () {}); if (!Session.get('boot2dockerOff')) { fixBoot2DockerVM(function (err) { diff --git a/meteor/client/views/dashboard/setup/setup-install.js b/meteor/client/views/dashboard/setup/setup-install.js index cc222f82e2..d5774fbbd7 100644 --- a/meteor/client/views/dashboard/setup/setup-install.js +++ b/meteor/client/views/dashboard/setup/setup-install.js @@ -7,7 +7,7 @@ Template.setup_install.rendered = function() { console.log('Setup failed.'); console.log(err); } else { - Installs.insert({}); + Installs.insert({version: Installer.CURRENT_VERSION}); Router.go('dashboard_apps'); } }); diff --git a/meteor/client/views/dashboard/setup/setup-layout.html b/meteor/client/views/dashboard/setup/setup-layout.html index 12c0f8682b..ce3765beb4 100644 --- a/meteor/client/views/dashboard/setup/setup-layout.html +++ b/meteor/client/views/dashboard/setup/setup-layout.html @@ -1,8 +1,13 @@ diff --git a/meteor/client/views/dashboard/setup/setup-layout.js b/meteor/client/views/dashboard/setup/setup-layout.js new file mode 100644 index 0000000000..2d99b3bc4b --- /dev/null +++ b/meteor/client/views/dashboard/setup/setup-layout.js @@ -0,0 +1,11 @@ +Template.setup_layout.rendered = function () { + Meteor.setInterval(function () { + $('.header .icons a').tooltip(); + }, 1000); +}; + +Template.setup_layout.helpers({ + isUpdating: function () { + return Session.get('isUpdating'); + } +}); diff --git a/meteor/collections/apps.js b/meteor/collections/apps.js index ba40c9b2e9..85cf5c5266 100755 --- a/meteor/collections/apps.js +++ b/meteor/collections/apps.js @@ -60,7 +60,7 @@ Apps.helpers({ return Images.findOne(this.imageId); }, hostUrl: function () { - return this.name + '.dev'; + return this.name + '.kite'; }, ports: function () { var app = this; @@ -78,7 +78,7 @@ Apps.helpers({ var app = this; var image = Images.findOne(app.imageId); if (image && image.meta.app && image.meta.app.webPort) { - return 'http://' + app.name + '.dev:' + image.meta.app.webPort; + return 'http://' + app.name + '.kite:' + image.meta.app.webPort; } else if (image && image.meta.app && image.meta.app.webPort === false) { return null; } else { @@ -93,14 +93,14 @@ Apps.helpers({ } }); if (pickedPort) { - return 'http://' + app.name + '.dev:' + pickedPort; + return 'http://' + app.name + '.kite:' + pickedPort; } else { if (keys.length > 0) { // Picks the first port that's not SSH for (var i = 0; i < keys.length; i++) { var port = parseInt(keys[i].split('/')[0], 10); if (port !== 22) { - return 'http://' + app.name + '.dev:' + port; + return 'http://' + app.name + '.kite:' + port; } } return null; diff --git a/meteor/collections/installs.js b/meteor/collections/installs.js index 6f0a492ce7..314b538050 100644 --- a/meteor/collections/installs.js +++ b/meteor/collections/installs.js @@ -1,7 +1,26 @@ Installs = new Meteor.Collection('installs'); schemaInstalls = new SimpleSchema({ - + createdAt: { + type: Date, + autoValue: function() { + var now = new Date(); + if (this.isInsert) { + return now; + } else if (this.isUpsert) { + return {$setOnInsert: now}; + } else { + this.unset(); + } + }, + denyUpdate: true, + label: 'Time of install created' + }, + version: { + type: String, + label: 'Installed version', + optional: true + } }); Installs.allow({ @@ -16,4 +35,4 @@ Installs.allow({ } }); -Installs.attachSchema(schemaInstalls); +Installs.attachSchema(schemaInstalls); \ No newline at end of file diff --git a/resources/kite-dns/dnsmasq.tmpl b/resources/kite-dns/dnsmasq.tmpl index 546fda7910..0355b257cc 100644 --- a/resources/kite-dns/dnsmasq.tmpl +++ b/resources/kite-dns/dnsmasq.tmpl @@ -1,6 +1,6 @@ user=root {{ range $index, $value := $ }} {{ with $address := index $value.Addresses 0 }} -address=/{{$value.Name}}.dev/{{$address.IP}} +address=/{{$value.Name}}.kite/{{$address.IP}} {{ end }} {{ end }} diff --git a/script/setup.sh b/script/setup.sh index c40c686e78..217e096da2 100755 --- a/script/setup.sh +++ b/script/setup.sh @@ -15,6 +15,7 @@ pushd cache if [ ! -f $BASE_IMAGE_VERSION_FILE ]; then cecho "-----> Downloading Kitematic base images..." $purple curl -L --progress-bar -o $BASE_IMAGE_VERSION_FILE https://s3.amazonaws.com/kite-installer/$BASE_IMAGE_VERSION_FILE + cp $BASE_IMAGE_VERSION_FILE ../resources/$BASE_IMAGE_FILE fi if [ ! -f $BOOT2DOCKER_CLI_VERSION_FILE ]; then @@ -60,11 +61,6 @@ if [ ! -f $COCOASUDO_FILE ]; then chmod +x $COCOASUDO_FILE fi - -if [ ! -f $BASE_IMAGE_FILE ]; then - cp ../cache/$BASE_IMAGE_VERSION_FILE $BASE_IMAGE_FILE -fi - cp ../cache/$BOOT2DOCKER_CLI_VERSION_FILE $BOOT2DOCKER_CLI_FILE chmod +x $BOOT2DOCKER_CLI_FILE diff --git a/script/versions.sh b/script/versions.sh index f1f7853a2f..e46149f22c 100644 --- a/script/versions.sh +++ b/script/versions.sh @@ -1,4 +1,4 @@ -BASE_IMAGE_VERSION=0.0.1 +BASE_IMAGE_VERSION=0.0.2 BASE_IMAGE_VERSION_FILE=base-images-$BASE_IMAGE_VERSION.tar.gz BASE_IMAGE_FILE=base-images.tar.gz