mirror of https://github.com/docker/docs.git
dynamic Docker host
This commit is contained in:
parent
923468f482
commit
f7aa4c32fc
|
@ -12,7 +12,7 @@ var Docker = {
|
|||
return;
|
||||
}
|
||||
this._client = new dockerode({
|
||||
host: '192.168.59.103',
|
||||
host: host,
|
||||
port: 2376,
|
||||
ca: fs.readFileSync(path.join(certDir, 'ca.pem')),
|
||||
cert: fs.readFileSync(path.join(certDir, 'cert.pem')),
|
||||
|
|
11
src/Main.js
11
src/Main.js
|
@ -42,7 +42,10 @@ if (!window.location.hash.length || window.location.hash === '#/') {
|
|||
React.render(<Handler/>, document.body);
|
||||
});
|
||||
SetupStore.run(function (err) {
|
||||
router.transitionTo('setup');
|
||||
if (err) {
|
||||
bugsnag.notify(err);
|
||||
return;
|
||||
}
|
||||
boot2docker.ip(function (err, ip) {
|
||||
if (err) console.log(err);
|
||||
docker.setHost(ip);
|
||||
|
@ -52,14 +55,14 @@ if (!window.location.hash.length || window.location.hash === '#/') {
|
|||
});
|
||||
});
|
||||
} else {
|
||||
router.run(function (Handler) {
|
||||
React.render(<Handler/>, document.body);
|
||||
});
|
||||
boot2docker.ip(function (err, ip) {
|
||||
if (err) console.log(err);
|
||||
docker.setHost(ip);
|
||||
ContainerStore.init(function (err) {
|
||||
if (err) console.log(err);
|
||||
router.run(function (Handler) {
|
||||
React.render(<Handler/>, document.body);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -20,13 +20,16 @@ var Setup = React.createClass({
|
|||
componentWillMount: function () {
|
||||
SetupStore.on(SetupStore.PROGRESS_EVENT, this.update);
|
||||
SetupStore.on(SetupStore.STEP_EVENT, this.update);
|
||||
SetupStore.on(SetupStore.ERROR_EVENT, this.update);
|
||||
},
|
||||
componentDidMount: function () {
|
||||
this.update();
|
||||
},
|
||||
update: function () {
|
||||
this.setState({
|
||||
progress: SetupStore.stepProgress(),
|
||||
step: SetupStore.stepName()
|
||||
step: SetupStore.stepName(),
|
||||
error: SetupStore.error()
|
||||
});
|
||||
},
|
||||
renderDownloadingVirtualboxStep: function () {
|
||||
|
|
|
@ -10,8 +10,8 @@ var setupUtil = require('./SetupUtil');
|
|||
var packagejson = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8'));
|
||||
|
||||
var _currentStep = null;
|
||||
var _error = null;
|
||||
var _progress = 0;
|
||||
var _error = error;
|
||||
|
||||
var SetupStore = assign(EventEmitter.prototype, {
|
||||
PROGRESS_EVENT: 'setup_progress',
|
||||
|
@ -170,6 +170,9 @@ var SetupStore = assign(EventEmitter.prototype, {
|
|||
stepProgress: function () {
|
||||
return _progress;
|
||||
},
|
||||
error: function () {
|
||||
return _error;
|
||||
},
|
||||
run: function (callback) {
|
||||
var self = this;
|
||||
var steps = [this.downloadVirtualboxStep, this.installVirtualboxStep, this.cleanupKitematicStep, this.initBoot2DockerStep, this.startBoot2DockerStep];
|
||||
|
@ -189,8 +192,9 @@ var SetupStore = assign(EventEmitter.prototype, {
|
|||
self.emit(self.PROGRESS_EVENT, progress);
|
||||
});
|
||||
}, function (err) {
|
||||
_error = err;
|
||||
if (err) {
|
||||
self.emit(self.ERROR_EVENT, _error);
|
||||
self.emit(self.ERROR_EVENT);
|
||||
callback(err);
|
||||
} else {
|
||||
callback();
|
||||
|
|
Loading…
Reference in New Issue