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;
|
return;
|
||||||
}
|
}
|
||||||
this._client = new dockerode({
|
this._client = new dockerode({
|
||||||
host: '192.168.59.103',
|
host: host,
|
||||||
port: 2376,
|
port: 2376,
|
||||||
ca: fs.readFileSync(path.join(certDir, 'ca.pem')),
|
ca: fs.readFileSync(path.join(certDir, 'ca.pem')),
|
||||||
cert: fs.readFileSync(path.join(certDir, 'cert.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);
|
React.render(<Handler/>, document.body);
|
||||||
});
|
});
|
||||||
SetupStore.run(function (err) {
|
SetupStore.run(function (err) {
|
||||||
router.transitionTo('setup');
|
if (err) {
|
||||||
|
bugsnag.notify(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
boot2docker.ip(function (err, ip) {
|
boot2docker.ip(function (err, ip) {
|
||||||
if (err) console.log(err);
|
if (err) console.log(err);
|
||||||
docker.setHost(ip);
|
docker.setHost(ip);
|
||||||
|
@ -52,14 +55,14 @@ if (!window.location.hash.length || window.location.hash === '#/') {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
router.run(function (Handler) {
|
||||||
|
React.render(<Handler/>, document.body);
|
||||||
|
});
|
||||||
boot2docker.ip(function (err, ip) {
|
boot2docker.ip(function (err, ip) {
|
||||||
if (err) console.log(err);
|
if (err) console.log(err);
|
||||||
docker.setHost(ip);
|
docker.setHost(ip);
|
||||||
ContainerStore.init(function (err) {
|
ContainerStore.init(function (err) {
|
||||||
if (err) console.log(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 () {
|
componentWillMount: function () {
|
||||||
SetupStore.on(SetupStore.PROGRESS_EVENT, this.update);
|
SetupStore.on(SetupStore.PROGRESS_EVENT, this.update);
|
||||||
SetupStore.on(SetupStore.STEP_EVENT, this.update);
|
SetupStore.on(SetupStore.STEP_EVENT, this.update);
|
||||||
|
SetupStore.on(SetupStore.ERROR_EVENT, this.update);
|
||||||
},
|
},
|
||||||
componentDidMount: function () {
|
componentDidMount: function () {
|
||||||
|
this.update();
|
||||||
},
|
},
|
||||||
update: function () {
|
update: function () {
|
||||||
this.setState({
|
this.setState({
|
||||||
progress: SetupStore.stepProgress(),
|
progress: SetupStore.stepProgress(),
|
||||||
step: SetupStore.stepName()
|
step: SetupStore.stepName(),
|
||||||
|
error: SetupStore.error()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
renderDownloadingVirtualboxStep: function () {
|
renderDownloadingVirtualboxStep: function () {
|
||||||
|
|
|
@ -10,8 +10,8 @@ var setupUtil = require('./SetupUtil');
|
||||||
var packagejson = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8'));
|
var packagejson = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8'));
|
||||||
|
|
||||||
var _currentStep = null;
|
var _currentStep = null;
|
||||||
var _error = null;
|
|
||||||
var _progress = 0;
|
var _progress = 0;
|
||||||
|
var _error = error;
|
||||||
|
|
||||||
var SetupStore = assign(EventEmitter.prototype, {
|
var SetupStore = assign(EventEmitter.prototype, {
|
||||||
PROGRESS_EVENT: 'setup_progress',
|
PROGRESS_EVENT: 'setup_progress',
|
||||||
|
@ -170,6 +170,9 @@ var SetupStore = assign(EventEmitter.prototype, {
|
||||||
stepProgress: function () {
|
stepProgress: function () {
|
||||||
return _progress;
|
return _progress;
|
||||||
},
|
},
|
||||||
|
error: function () {
|
||||||
|
return _error;
|
||||||
|
},
|
||||||
run: function (callback) {
|
run: function (callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var steps = [this.downloadVirtualboxStep, this.installVirtualboxStep, this.cleanupKitematicStep, this.initBoot2DockerStep, this.startBoot2DockerStep];
|
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);
|
self.emit(self.PROGRESS_EVENT, progress);
|
||||||
});
|
});
|
||||||
}, function (err) {
|
}, function (err) {
|
||||||
|
_error = err;
|
||||||
if (err) {
|
if (err) {
|
||||||
self.emit(self.ERROR_EVENT, _error);
|
self.emit(self.ERROR_EVENT);
|
||||||
callback(err);
|
callback(err);
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback();
|
||||||
|
|
Loading…
Reference in New Issue