mirror of https://github.com/docker/docs.git
Adding update process
This commit is contained in:
parent
21f4ca0565
commit
dc1cb0caec
5
index.js
5
index.js
|
@ -51,7 +51,12 @@ var start = function (callback) {
|
||||||
});
|
});
|
||||||
var started = false;
|
var started = false;
|
||||||
mongoChild.stdout.setEncoding('utf8');
|
mongoChild.stdout.setEncoding('utf8');
|
||||||
|
mongoChild.stderr.setEncoding('utf8');
|
||||||
|
mongoChild.stderr.on('data', function (data) {
|
||||||
|
console.log(data);
|
||||||
|
});
|
||||||
mongoChild.stdout.on('data', function (data) {
|
mongoChild.stdout.on('data', function (data) {
|
||||||
|
console.log(data);
|
||||||
if (data.indexOf('waiting for connections on port ' + mongoPort)) {
|
if (data.indexOf('waiting for connections on port ' + mongoPort)) {
|
||||||
if (!started) {
|
if (!started) {
|
||||||
started = true;
|
started = true;
|
||||||
|
|
|
@ -2,6 +2,12 @@ var async = require('async');
|
||||||
|
|
||||||
Installer = {};
|
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:
|
* 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.
|
* - run: Function that runs the installation step and calls the callback with an error if failed.
|
||||||
|
|
|
@ -48,10 +48,15 @@ Router.map(function () {
|
||||||
controller: 'SetupController',
|
controller: 'SetupController',
|
||||||
action: function () {
|
action: function () {
|
||||||
if (this.ready()) {
|
if (this.ready()) {
|
||||||
var install = Installs.findOne();
|
if (!Installer.isUpToDate()) {
|
||||||
if (!install) {
|
if (!Installs.findOne()) {
|
||||||
console.log('No installs detected, running installer again.');
|
console.log('No installs detected, running installer again.');
|
||||||
this.redirect('/setup/intro');
|
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 {
|
} else {
|
||||||
this.redirect('/apps');
|
this.redirect('/apps');
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,7 +146,7 @@ Meteor.setInterval(function () {
|
||||||
}, 5000);
|
}, 5000);
|
||||||
|
|
||||||
Meteor.setInterval(function () {
|
Meteor.setInterval(function () {
|
||||||
if (Installs.findOne()) {
|
if (Installer.isUpToDate()) {
|
||||||
resolveWatchers(function () {});
|
resolveWatchers(function () {});
|
||||||
if (!Session.get('boot2dockerOff')) {
|
if (!Session.get('boot2dockerOff')) {
|
||||||
fixBoot2DockerVM(function (err) {
|
fixBoot2DockerVM(function (err) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ Template.setup_install.rendered = function() {
|
||||||
console.log('Setup failed.');
|
console.log('Setup failed.');
|
||||||
console.log(err);
|
console.log(err);
|
||||||
} else {
|
} else {
|
||||||
Installs.insert({});
|
Installs.insert({version: Installer.CURRENT_VERSION});
|
||||||
Router.go('dashboard_apps');
|
Router.go('dashboard_apps');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
<template name="setup_layout">
|
<template name="setup_layout">
|
||||||
{{setTitle}}
|
{{setTitle}}
|
||||||
<div class="setup content text-center">
|
<div class="setup content text-center">
|
||||||
|
{{#if isUpdating}}
|
||||||
|
<h2>Welcome Back</h2>
|
||||||
|
<p>Kitematic needs to update itself to continue.</p>
|
||||||
|
{{else}}
|
||||||
<h2>Welcome to Kitematic</h2>
|
<h2>Welcome to Kitematic</h2>
|
||||||
<p>This will set up everything needed to run Kitematic on your Mac.</p>
|
<p>This will set up everything needed to run Kitematic on your Mac.</p>
|
||||||
|
{{/if}}
|
||||||
{{> yield}}
|
{{> yield}}
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -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');
|
||||||
|
}
|
||||||
|
});
|
|
@ -60,7 +60,7 @@ Apps.helpers({
|
||||||
return Images.findOne(this.imageId);
|
return Images.findOne(this.imageId);
|
||||||
},
|
},
|
||||||
hostUrl: function () {
|
hostUrl: function () {
|
||||||
return this.name + '.dev';
|
return this.name + '.kite';
|
||||||
},
|
},
|
||||||
ports: function () {
|
ports: function () {
|
||||||
var app = this;
|
var app = this;
|
||||||
|
@ -78,7 +78,7 @@ Apps.helpers({
|
||||||
var app = this;
|
var app = this;
|
||||||
var image = Images.findOne(app.imageId);
|
var image = Images.findOne(app.imageId);
|
||||||
if (image && image.meta.app && image.meta.app.webPort) {
|
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) {
|
} else if (image && image.meta.app && image.meta.app.webPort === false) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
|
@ -93,14 +93,14 @@ Apps.helpers({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (pickedPort) {
|
if (pickedPort) {
|
||||||
return 'http://' + app.name + '.dev:' + pickedPort;
|
return 'http://' + app.name + '.kite:' + pickedPort;
|
||||||
} else {
|
} else {
|
||||||
if (keys.length > 0) {
|
if (keys.length > 0) {
|
||||||
// Picks the first port that's not SSH
|
// Picks the first port that's not SSH
|
||||||
for (var i = 0; i < keys.length; i++) {
|
for (var i = 0; i < keys.length; i++) {
|
||||||
var port = parseInt(keys[i].split('/')[0], 10);
|
var port = parseInt(keys[i].split('/')[0], 10);
|
||||||
if (port !== 22) {
|
if (port !== 22) {
|
||||||
return 'http://' + app.name + '.dev:' + port;
|
return 'http://' + app.name + '.kite:' + port;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -1,7 +1,26 @@
|
||||||
Installs = new Meteor.Collection('installs');
|
Installs = new Meteor.Collection('installs');
|
||||||
|
|
||||||
schemaInstalls = new SimpleSchema({
|
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({
|
Installs.allow({
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
user=root
|
user=root
|
||||||
{{ range $index, $value := $ }}
|
{{ range $index, $value := $ }}
|
||||||
{{ with $address := index $value.Addresses 0 }}
|
{{ with $address := index $value.Addresses 0 }}
|
||||||
address=/{{$value.Name}}.dev/{{$address.IP}}
|
address=/{{$value.Name}}.kite/{{$address.IP}}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -15,6 +15,7 @@ pushd cache
|
||||||
if [ ! -f $BASE_IMAGE_VERSION_FILE ]; then
|
if [ ! -f $BASE_IMAGE_VERSION_FILE ]; then
|
||||||
cecho "-----> Downloading Kitematic base images..." $purple
|
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
|
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
|
fi
|
||||||
|
|
||||||
if [ ! -f $BOOT2DOCKER_CLI_VERSION_FILE ]; then
|
if [ ! -f $BOOT2DOCKER_CLI_VERSION_FILE ]; then
|
||||||
|
@ -60,11 +61,6 @@ if [ ! -f $COCOASUDO_FILE ]; then
|
||||||
chmod +x $COCOASUDO_FILE
|
chmod +x $COCOASUDO_FILE
|
||||||
fi
|
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
|
cp ../cache/$BOOT2DOCKER_CLI_VERSION_FILE $BOOT2DOCKER_CLI_FILE
|
||||||
chmod +x $BOOT2DOCKER_CLI_FILE
|
chmod +x $BOOT2DOCKER_CLI_FILE
|
||||||
|
|
||||||
|
|
|
@ -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_VERSION_FILE=base-images-$BASE_IMAGE_VERSION.tar.gz
|
||||||
BASE_IMAGE_FILE=base-images.tar.gz
|
BASE_IMAGE_FILE=base-images.tar.gz
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue