mirror of https://github.com/docker/docs.git
Fixing installer & mongodb startup bug.
This commit is contained in:
parent
548d8f33ba
commit
6a6f21fa51
42
index.js
42
index.js
|
@ -41,10 +41,15 @@ var start = function (callback) {
|
||||||
// One for meteor, one for mongo
|
// One for meteor, one for mongo
|
||||||
freeport(function (err, webPort) {
|
freeport(function (err, webPort) {
|
||||||
freeport(function(err, mongoPort) {
|
freeport(function(err, mongoPort) {
|
||||||
child_process.exec('kill $(ps aux -e | grep \'PURPOSE=KITEMATIC\' | awk \'{print $2}\')', function (error, stdout, stderr) {
|
console.log('MongoDB: ' + mongoPort);
|
||||||
|
console.log('webPort: ' + webPort);
|
||||||
|
child_process.exec('kill $(ps aux -e | grep PURPOSE=KITEMATIC | awk \'{print $2}\')', function (error, stdout, stderr) {
|
||||||
|
console.log(error);
|
||||||
|
console.log(stdout);
|
||||||
|
console.log(stderr);
|
||||||
var mongoChild = child_process.spawn(path.join(process.cwd(), 'resources', 'mongod'), ['--bind_ip', '127.0.0.1', '--dbpath', dataPath, '--port', mongoPort, '--unixSocketPrefix', dataPath], {
|
var mongoChild = child_process.spawn(path.join(process.cwd(), 'resources', 'mongod'), ['--bind_ip', '127.0.0.1', '--dbpath', dataPath, '--port', mongoPort, '--unixSocketPrefix', dataPath], {
|
||||||
env: {
|
env: {
|
||||||
DB_PURPOSE: 'KITEMATIC'
|
PURPOSE: 'KITEMATIC'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var started = false;
|
var started = false;
|
||||||
|
@ -70,17 +75,6 @@ var start = function (callback) {
|
||||||
env: user_env
|
env: user_env
|
||||||
});
|
});
|
||||||
|
|
||||||
var cleanUpChildren = function () {
|
|
||||||
console.log('Cleaning up children.')
|
|
||||||
mongoChild.kill();
|
|
||||||
nodeChild.kill();
|
|
||||||
};
|
|
||||||
|
|
||||||
process.on('exit', cleanUpChildren);
|
|
||||||
process.on('uncaughtException', cleanUpChildren);
|
|
||||||
process.on('SIGINT', cleanUpChildren);
|
|
||||||
process.on('SIGTERM', cleanUpChildren);
|
|
||||||
|
|
||||||
var opened = false;
|
var opened = false;
|
||||||
nodeChild.stdout.setEncoding('utf8');
|
nodeChild.stdout.setEncoding('utf8');
|
||||||
nodeChild.stdout.on('data', function (data) {
|
nodeChild.stdout.on('data', function (data) {
|
||||||
|
@ -91,7 +85,7 @@ var start = function (callback) {
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
callback(rootURL);
|
callback(rootURL, nodeChild, mongoChild);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -102,7 +96,19 @@ var start = function (callback) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
start(function (url) {
|
start(function (url, nodeChild, mongoChild) {
|
||||||
|
var cleanUpChildren = function () {
|
||||||
|
console.log('Cleaning up children.')
|
||||||
|
mongoChild.kill();
|
||||||
|
nodeChild.kill();
|
||||||
|
};
|
||||||
|
if (nodeChild && mongoChild) {
|
||||||
|
process.on('exit', cleanUpChildren);
|
||||||
|
process.on('uncaughtException', cleanUpChildren);
|
||||||
|
process.on('SIGINT', cleanUpChildren);
|
||||||
|
process.on('SIGTERM', cleanUpChildren);
|
||||||
|
}
|
||||||
|
|
||||||
var gui = require('nw.gui');
|
var gui = require('nw.gui');
|
||||||
var mainWindow = gui.Window.get();
|
var mainWindow = gui.Window.get();
|
||||||
gui.App.on('reopen', function () {
|
gui.App.on('reopen', function () {
|
||||||
|
@ -117,7 +123,11 @@ start(function (url) {
|
||||||
mainWindow.on('close', function (type) {
|
mainWindow.on('close', function (type) {
|
||||||
this.hide();
|
this.hide();
|
||||||
if (type === 'quit') {
|
if (type === 'quit') {
|
||||||
this.close(false);
|
console.log('here');
|
||||||
|
if (nodeChild && mongoChild) {
|
||||||
|
cleanUpChildren();
|
||||||
|
}
|
||||||
|
this.close(true);
|
||||||
}
|
}
|
||||||
console.log('Window Closed.');
|
console.log('Window Closed.');
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<img src="/step_pending.png">
|
<img src="/step_pending.png">
|
||||||
</span>
|
</span>
|
||||||
<div class="media-body">
|
<div class="media-body">
|
||||||
{{this.imperativeMessage}}
|
{{this.futureMessage}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if $lt this.index currentInstallStep}}
|
{{#if $lt this.index currentInstallStep}}
|
||||||
|
@ -31,6 +31,10 @@
|
||||||
{{this.message}}
|
{{this.message}}
|
||||||
{{#if $eq this.index failedStep}}
|
{{#if $eq this.index failedStep}}
|
||||||
<p>{{failedError}}</p>
|
<p>{{failedError}}</p>
|
||||||
|
{{else}}
|
||||||
|
{{#if this.subMessage}}
|
||||||
|
<p>{{this.subMessage}}</p>
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -24,7 +24,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
pastMessage: 'VirtualBox installed',
|
pastMessage: 'VirtualBox installed',
|
||||||
message: 'Installing VirtualBox',
|
message: 'Installing VirtualBox',
|
||||||
imperativeMessage: 'Install VirtualBox if necessary'
|
futureMessage: 'Install VirtualBox if necessary'
|
||||||
},
|
},
|
||||||
|
|
||||||
// Set up the routing.
|
// Set up the routing.
|
||||||
|
@ -36,7 +36,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
pastMessage: 'Container routing set up (root required).',
|
pastMessage: 'Container routing set up (root required).',
|
||||||
message: 'Setting up container routing (root required).',
|
message: 'Setting up container routing (root required).',
|
||||||
imperativeMessage: 'Set up container routing to VM (root required).'
|
futureMessage: 'Set up container routing to VM (root required).'
|
||||||
},
|
},
|
||||||
|
|
||||||
// Set up the VM for running Kitematic apps
|
// Set up the VM for running Kitematic apps
|
||||||
|
@ -63,7 +63,7 @@ var steps = [
|
||||||
},
|
},
|
||||||
pastMessage: 'Set up the Kitematic VM',
|
pastMessage: 'Set up the Kitematic VM',
|
||||||
message: 'Setting up the Kitematic VM...',
|
message: 'Setting up the Kitematic VM...',
|
||||||
imperativeMessage: 'Set up the Kitematic VM'
|
futureMessage: 'Set up the Kitematic VM'
|
||||||
},
|
},
|
||||||
|
|
||||||
// Start the Kitematic VM
|
// Start the Kitematic VM
|
||||||
|
@ -74,8 +74,9 @@ var steps = [
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
pastMessage: 'Started the Kitematic VM',
|
pastMessage: 'Started the Kitematic VM',
|
||||||
message: 'Starting the Kitematic VM...',
|
message: 'Starting the Kitematic VM',
|
||||||
imperativeMessage: 'Start the Kitematic VM'
|
subMessage: '(This may take a few minutes)',
|
||||||
|
futureMessage: 'Start the Kitematic VM',
|
||||||
},
|
},
|
||||||
|
|
||||||
// Set up the default Kitematic images
|
// Set up the default Kitematic images
|
||||||
|
@ -87,7 +88,8 @@ var steps = [
|
||||||
},
|
},
|
||||||
pastMessage: 'Started the Kitematic VM',
|
pastMessage: 'Started the Kitematic VM',
|
||||||
message: 'Setting up the default Kitematic images...',
|
message: 'Setting up the default Kitematic images...',
|
||||||
imperativeMessage: 'Set up the default Kitematic images'
|
subMessage: '(This may take a few minutes)',
|
||||||
|
futureMessage: 'Set up the default Kitematic images',
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue