mirror of https://github.com/docker/docs.git
Cleaner socket support and updated unmount calls
Signed-off-by: French Ben <me+git@frenchben.com>
This commit is contained in:
parent
6c6cefecfc
commit
58e77236bf
|
|
@ -34,6 +34,7 @@
|
||||||
"dockerode": "^2.2.7",
|
"dockerode": "^2.2.7",
|
||||||
"install": "^0.1.8",
|
"install": "^0.1.8",
|
||||||
"jquery": "^2.1.3",
|
"jquery": "^2.1.3",
|
||||||
|
"JSONStream": "^1.0.7",
|
||||||
"mixpanel": "kitematic/mixpanel-node",
|
"mixpanel": "kitematic/mixpanel-node",
|
||||||
"mkdirp": "^0.5.0",
|
"mkdirp": "^0.5.0",
|
||||||
"node-uuid": "^1.4.3",
|
"node-uuid": "^1.4.3",
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,11 @@ class SetupActions {
|
||||||
this.dispatch({removeVM});
|
this.dispatch({removeVM});
|
||||||
setupUtil.retry(removeVM);
|
setupUtil.retry(removeVM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useVbox () {
|
||||||
|
this.dispatch({});
|
||||||
|
setupUtil.useVbox();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default alt.createActions(SetupActions);
|
export default alt.createActions(SetupActions);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
require.main.paths.splice(0, 0, process.env.NODE_PATH);
|
require.main.paths.splice(0, 0, process.env.NODE_PATH);
|
||||||
|
|
||||||
import electron from 'electron';
|
import electron from 'electron';
|
||||||
const remote = electron.remote;
|
const remote = electron.remote;
|
||||||
const Menu = remote.Menu;
|
const Menu = remote.Menu;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ const BrowserWindow = electron.BrowserWindow;
|
||||||
|
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import child_process from 'child_process';
|
import child_process from 'child_process';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ var ContainerHomeFolder = React.createClass({
|
||||||
mounts.forEach(m => {
|
mounts.forEach(m => {
|
||||||
if (m.Destination === destination) {
|
if (m.Destination === destination) {
|
||||||
m.Source = util.windowsToLinuxPath(newSource);
|
m.Source = util.windowsToLinuxPath(newSource);
|
||||||
|
m.Driver = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ var ContainerSettingsVolumes = React.createClass({
|
||||||
|
|
||||||
metrics.track('Choose Directory for Volume');
|
metrics.track('Choose Directory for Volume');
|
||||||
|
|
||||||
var mounts = _.clone(this.props.container.Mounts);
|
let mounts = _.clone(this.props.container.Mounts);
|
||||||
_.each(mounts, m => {
|
_.each(mounts, m => {
|
||||||
if (m.Destination === dockerVol) {
|
if (m.Destination === dockerVol) {
|
||||||
m.Source = util.windowsToLinuxPath(directory);
|
m.Source = util.windowsToLinuxPath(directory);
|
||||||
|
|
@ -36,7 +36,7 @@ var ContainerSettingsVolumes = React.createClass({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var binds = mounts.map(m => {
|
let binds = mounts.map(m => {
|
||||||
return m.Source + ':' + m.Destination;
|
return m.Source + ':' + m.Destination;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -50,7 +50,7 @@ var ContainerSettingsVolumes = React.createClass({
|
||||||
from: 'settings'
|
from: 'settings'
|
||||||
});
|
});
|
||||||
|
|
||||||
var mounts = _.clone(this.props.container.Mounts);
|
let mounts = _.clone(this.props.container.Mounts);
|
||||||
_.each(mounts, m => {
|
_.each(mounts, m => {
|
||||||
if (m.Destination === dockerVol) {
|
if (m.Destination === dockerVol) {
|
||||||
m.Source = null;
|
m.Source = null;
|
||||||
|
|
|
||||||
|
|
@ -106,44 +106,44 @@ var Containers = React.createClass({
|
||||||
metrics.track('Opened Issue Reporter', {
|
metrics.track('Opened Issue Reporter', {
|
||||||
from: 'app'
|
from: 'app'
|
||||||
});
|
});
|
||||||
shell.openExternal('https://github.com/kitematic/kitematic/issues/new');
|
shell.openExternal('https://github.com/docker/kitematic/issues/new');
|
||||||
},
|
},
|
||||||
|
|
||||||
handleMouseEnterDockerTerminal: function () {
|
// handleMouseEnterDockerTerminal: function () {
|
||||||
this.setState({
|
// this.setState({
|
||||||
currentButtonLabel: 'Open terminal to use Docker command line.'
|
// currentButtonLabel: 'Open terminal to use Docker command line.'
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
|
//
|
||||||
handleMouseLeaveDockerTerminal: function () {
|
// handleMouseLeaveDockerTerminal: function () {
|
||||||
this.setState({
|
// this.setState({
|
||||||
currentButtonLabel: ''
|
// currentButtonLabel: ''
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
|
//
|
||||||
handleMouseEnterReportIssue: function () {
|
// handleMouseEnterReportIssue: function () {
|
||||||
this.setState({
|
// this.setState({
|
||||||
currentButtonLabel: 'Report an issue or suggest feedback.'
|
// currentButtonLabel: 'Report an issue or suggest feedback.'
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
|
//
|
||||||
handleMouseLeaveReportIssue: function () {
|
// handleMouseLeaveReportIssue: function () {
|
||||||
this.setState({
|
// this.setState({
|
||||||
currentButtonLabel: ''
|
// currentButtonLabel: ''
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
|
//
|
||||||
handleMouseEnterPreferences: function () {
|
// handleMouseEnterPreferences: function () {
|
||||||
this.setState({
|
// this.setState({
|
||||||
currentButtonLabel: 'Change app preferences.'
|
// currentButtonLabel: 'Change app preferences.'
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
|
//
|
||||||
handleMouseLeavePreferences: function () {
|
// handleMouseLeavePreferences: function () {
|
||||||
this.setState({
|
// this.setState({
|
||||||
currentButtonLabel: ''
|
// currentButtonLabel: ''
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
|
|
||||||
render: function () {
|
render: function () {
|
||||||
var sidebarHeaderClass = 'sidebar-header';
|
var sidebarHeaderClass = 'sidebar-header';
|
||||||
|
|
@ -169,9 +169,9 @@ var Containers = React.createClass({
|
||||||
<ContainerList containers={this.state.sorted} newContainer={this.state.newContainer} />
|
<ContainerList containers={this.state.sorted} newContainer={this.state.newContainer} />
|
||||||
</section>
|
</section>
|
||||||
<section className="sidebar-buttons">
|
<section className="sidebar-buttons">
|
||||||
<span className="btn-sidebar btn-terminal" onClick={this.handleClickDockerTerminal} onMouseEnter={this.handleMouseEnterDockerTerminal} onMouseLeave={this.handleMouseLeaveDockerTerminal}><span className="icon icon-docker-cli"></span><span className="text">DOCKER CLI</span></span>
|
<span className="btn-sidebar btn-terminal" onClick={this.handleClickDockerTerminal} ><span className="icon icon-docker-cli"></span><span className="text">DOCKER CLI</span></span>
|
||||||
<span className="btn-sidebar btn-feedback" onClick={this.handleClickReportIssue} onMouseEnter={this.handleMouseEnterDockerTerminal} onMouseLeave={this.handleMouseLeaveDockerTerminal}><span className="icon icon-feedback"></span></span>
|
<span className="btn-sidebar btn-feedback" onClick={this.handleClickReportIssue} ><span className="icon icon-feedback"></span></span>
|
||||||
<span className="btn-sidebar btn-preferences" onClick={this.handleClickPreferences} onMouseEnter={this.handleMouseEnterDockerTerminal} onMouseLeave={this.handleMouseLeaveDockerTerminal}><span className="icon icon-preferences"></span></span>
|
<span className="btn-sidebar btn-preferences" onClick={this.handleClickPreferences} ><span className="icon icon-preferences"></span></span>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
<Router.RouteHandler pending={this.state.pending} containers={this.state.containers} container={container}/>
|
<Router.RouteHandler pending={this.state.pending} containers={this.state.containers} container={container}/>
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,13 @@ import Router from 'react-router';
|
||||||
import Radial from './Radial.react.js';
|
import Radial from './Radial.react.js';
|
||||||
import RetinaImage from 'react-retina-image';
|
import RetinaImage from 'react-retina-image';
|
||||||
import Header from './Header.react';
|
import Header from './Header.react';
|
||||||
import Util from '../utils/Util';
|
import util from '../utils/Util';
|
||||||
import metrics from '../utils/MetricsUtil';
|
import metrics from '../utils/MetricsUtil';
|
||||||
import setupStore from '../stores/SetupStore';
|
import setupStore from '../stores/SetupStore';
|
||||||
import setupActions from '../actions/SetupActions';
|
import setupActions from '../actions/SetupActions';
|
||||||
import shell from 'shell';
|
import shell from 'shell';
|
||||||
|
|
||||||
|
|
||||||
var Setup = React.createClass({
|
var Setup = React.createClass({
|
||||||
mixins: [Router.Navigation],
|
mixins: [Router.Navigation],
|
||||||
|
|
||||||
|
|
@ -32,6 +33,10 @@ var Setup = React.createClass({
|
||||||
setupActions.retry(false);
|
setupActions.retry(false);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
handleUseVbox: function () {
|
||||||
|
setupActions.useVbox();
|
||||||
|
},
|
||||||
|
|
||||||
handleErrorRemoveRetry: function () {
|
handleErrorRemoveRetry: function () {
|
||||||
console.log('Deleting VM and trying again.' );
|
console.log('Deleting VM and trying again.' );
|
||||||
setupActions.retry(true);
|
setupActions.retry(true);
|
||||||
|
|
@ -63,6 +68,12 @@ var Setup = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
renderProgress: function () {
|
renderProgress: function () {
|
||||||
|
let title = 'Starting Docker VM';
|
||||||
|
let descr = 'To run Docker containers on your computer, Kitematic is starting a Linux virtual machine. This may take a minute...';
|
||||||
|
if (util.isNative()) {
|
||||||
|
title = 'Checking Docker';
|
||||||
|
descr = 'To run Docker containers on your computer, Kitematic is checking the Docker connection.';
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div className="setup">
|
<div className="setup">
|
||||||
<Header hideLogin={true}/>
|
<Header hideLogin={true}/>
|
||||||
|
|
@ -72,8 +83,8 @@ var Setup = React.createClass({
|
||||||
</div>
|
</div>
|
||||||
<div className="desc">
|
<div className="desc">
|
||||||
<div className="content">
|
<div className="content">
|
||||||
<h1>Starting Docker VM</h1>
|
<h1>{title}</h1>
|
||||||
<p>To run Docker containers on your computer, Kitematic is starting a Linux virtual machine. This may take a minute...</p>
|
<p>{descr}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -84,14 +95,18 @@ var Setup = React.createClass({
|
||||||
renderError: function () {
|
renderError: function () {
|
||||||
let deleteVmAndRetry;
|
let deleteVmAndRetry;
|
||||||
|
|
||||||
if (Util.isLinux()) {
|
if (util.isLinux()) {
|
||||||
if (!this.state.started) {
|
if (!this.state.started) {
|
||||||
deleteVmAndRetry = (
|
deleteVmAndRetry = (
|
||||||
<button className="btn btn-action" onClick={this.handleLinuxDockerInstall}>Install Docker</button>
|
<button className="btn btn-action" onClick={this.handleLinuxDockerInstall}>Install Docker</button>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.state.started) {
|
if (util.isNative()) {
|
||||||
|
deleteVmAndRetry = (
|
||||||
|
<button className="btn btn-action" onClick={this.handleUseVbox}>Use VirtualBox</button>
|
||||||
|
);
|
||||||
|
} else if (this.state.started) {
|
||||||
deleteVmAndRetry = (
|
deleteVmAndRetry = (
|
||||||
<button className="btn btn-action" onClick={this.handleErrorRemoveRetry}>Delete VM & Retry Setup</button>
|
<button className="btn btn-action" onClick={this.handleErrorRemoveRetry}>Delete VM & Retry Setup</button>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -158,11 +158,12 @@ var DockerMachine = {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else if (util.isLinux()) {
|
} else if (util.isNative()) {
|
||||||
cmd = cmd || process.env.SHELL;
|
cmd = cmd || process.env.SHELL;
|
||||||
var terminal = util.linuxTerminal();
|
var terminal = util.isLinux() ? util.linuxTerminal() : path.join(process.env.RESOURCES_PATH, 'terminal');
|
||||||
if (terminal)
|
if (terminal) {
|
||||||
util.execFile(terminal.concat([cmd])).then(() => {});
|
util.exec([terminal, cmd]).then(() => {});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
cmd = cmd || process.env.SHELL;
|
cmd = cmd || process.env.SHELL;
|
||||||
this.url(machineName).then(machineUrl => {
|
this.url(machineName).then(machineUrl => {
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,9 @@ import containerServerActions from '../actions/ContainerServerActions';
|
||||||
import rimraf from 'rimraf';
|
import rimraf from 'rimraf';
|
||||||
import stream from 'stream';
|
import stream from 'stream';
|
||||||
import JSONStream from 'JSONStream';
|
import JSONStream from 'JSONStream';
|
||||||
|
import Promise from 'bluebird';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
host: null,
|
host: null,
|
||||||
|
|
@ -20,20 +23,23 @@ export default {
|
||||||
activeContainerName: null,
|
activeContainerName: null,
|
||||||
|
|
||||||
setup (ip, name) {
|
setup (ip, name) {
|
||||||
if (!ip || !name) {
|
if (!ip && !name) {
|
||||||
throw new Error('Falsy ip or name passed to docker client setup');
|
throw new Error('Falsy ip or name passed to docker client setup');
|
||||||
}
|
}
|
||||||
|
this.host = ip;
|
||||||
|
|
||||||
if (util.isLinux()) {
|
if (ip.indexOf('local') !== -1) {
|
||||||
this.host = 'localhost';
|
try {
|
||||||
this.client = new dockerode({socketPath: '/var/run/docker.sock'});
|
this.client = new dockerode({socketPath: '/var/run/docker.sock'});
|
||||||
|
} catch (error) {
|
||||||
|
throw new Error('Cannot connect to the Docker daemon. Is the daemon running?');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
let certDir = path.join(util.home(), '.docker/machine/machines/', name);
|
let certDir = path.join(util.home(), '.docker/machine/machines/', name);
|
||||||
if (!fs.existsSync(certDir)) {
|
if (!fs.existsSync(certDir)) {
|
||||||
throw new Error('Certificate directory does not exist');
|
throw new Error('Certificate directory does not exist');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.host = ip;
|
|
||||||
this.client = new dockerode({
|
this.client = new dockerode({
|
||||||
protocol: 'https',
|
protocol: 'https',
|
||||||
host: ip,
|
host: ip,
|
||||||
|
|
@ -45,6 +51,28 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async version () {
|
||||||
|
let version = null;
|
||||||
|
let maxRetries = 10;
|
||||||
|
let retries = 0;
|
||||||
|
let error_message = "";
|
||||||
|
while (version == null && retries < maxRetries) {
|
||||||
|
this.client.version((error,data) => {
|
||||||
|
if (!error) {
|
||||||
|
version = data.Version;
|
||||||
|
} else {
|
||||||
|
error_message = error;
|
||||||
|
}
|
||||||
|
retries++;
|
||||||
|
});
|
||||||
|
await Promise.delay(1000);
|
||||||
|
}
|
||||||
|
if (version == null) {
|
||||||
|
throw new Error(error_message);
|
||||||
|
}
|
||||||
|
return version;
|
||||||
|
},
|
||||||
|
|
||||||
init () {
|
init () {
|
||||||
this.placeholders = JSON.parse(localStorage.getItem('placeholders')) || {};
|
this.placeholders = JSON.parse(localStorage.getItem('placeholders')) || {};
|
||||||
this.fetchAllContainers();
|
this.fetchAllContainers();
|
||||||
|
|
@ -88,6 +116,7 @@ export default {
|
||||||
container.start((error) => {
|
container.start((error) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
containerServerActions.error({name, error});
|
containerServerActions.error({name, error});
|
||||||
|
console.log('error starting: %o - %o', name, error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
containerServerActions.started({name, error});
|
containerServerActions.started({name, error});
|
||||||
|
|
@ -156,6 +185,7 @@ export default {
|
||||||
fetchAllContainers () {
|
fetchAllContainers () {
|
||||||
this.client.listContainers({all: true}, (err, containers) => {
|
this.client.listContainers({all: true}, (err, containers) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
console.error(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
async.map(containers, (container, callback) => {
|
async.map(containers, (container, callback) => {
|
||||||
|
|
@ -171,6 +201,7 @@ export default {
|
||||||
containers = containers.filter(c => c !== null);
|
containers = containers.filter(c => c !== null);
|
||||||
if (err) {
|
if (err) {
|
||||||
// TODO: add a global error handler for this
|
// TODO: add a global error handler for this
|
||||||
|
console.error(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
containerServerActions.allUpdated({containers: _.indexBy(containers.concat(_.values(this.placeholders)), 'Name')});
|
containerServerActions.allUpdated({containers: _.indexBy(containers.concat(_.values(this.placeholders)), 'Name')});
|
||||||
|
|
@ -367,6 +398,8 @@ export default {
|
||||||
timestamps: 1
|
timestamps: 1
|
||||||
}, (err, logStream) => {
|
}, (err, logStream) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
// socket hang up can be captured
|
||||||
|
console.error(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -393,6 +426,8 @@ export default {
|
||||||
timestamps: 1
|
timestamps: 1
|
||||||
}, (err, logStream) => {
|
}, (err, logStream) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
// Socket hang up also can be found here
|
||||||
|
console.error(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ const precreateCheckExitCode = 3;
|
||||||
|
|
||||||
let _retryPromise = null;
|
let _retryPromise = null;
|
||||||
let _timers = [];
|
let _timers = [];
|
||||||
|
let useNative = util.isNative() ? util.isNative() : true;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
simulateProgress (estimateSeconds) {
|
simulateProgress (estimateSeconds) {
|
||||||
|
|
@ -36,12 +37,21 @@ export default {
|
||||||
_timers = [];
|
_timers = [];
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async useVbox () {
|
||||||
|
metrics.track('Retried Setup with VBox');
|
||||||
|
localStorage.setItem('settings.useNative', false);
|
||||||
|
router.get().transitionTo('loading');
|
||||||
|
setupServerActions.error({ error: { message: null }});
|
||||||
|
_retryPromise.resolve();
|
||||||
|
},
|
||||||
|
|
||||||
retry (removeVM) {
|
retry (removeVM) {
|
||||||
metrics.track('Retried Setup', {
|
metrics.track('Retried Setup', {
|
||||||
removeVM
|
removeVM
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get().transitionTo('loading');
|
router.get().transitionTo('loading');
|
||||||
|
setupServerActions.error({ error: { message: null }});
|
||||||
if (removeVM) {
|
if (removeVM) {
|
||||||
machine.rm().finally(() => {
|
machine.rm().finally(() => {
|
||||||
_retryPromise.resolve();
|
_retryPromise.resolve();
|
||||||
|
|
@ -56,35 +66,50 @@ export default {
|
||||||
return _retryPromise.promise;
|
return _retryPromise.promise;
|
||||||
},
|
},
|
||||||
|
|
||||||
setup() {
|
async setup () {
|
||||||
return util.isLinux() ? this.nativeSetup() : this.nonNativeSetup();
|
|
||||||
},
|
|
||||||
|
|
||||||
async nativeSetup () {
|
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
docker.setup('localhost', machine.name());
|
if (util.isNative()) {
|
||||||
docker.isDockerRunning();
|
localStorage.setItem('setting.useNative', true);
|
||||||
|
let stats = fs.statSync('/var/run/docker.sock');
|
||||||
break;
|
if (stats.isSocket()) {
|
||||||
|
await this.nativeSetup();
|
||||||
|
} else {
|
||||||
|
throw new Error('File found is not a socket');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
await this.nonNativeSetup();
|
||||||
|
}
|
||||||
|
return;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
router.get().transitionTo('setup');
|
|
||||||
metrics.track('Native Setup Failed');
|
metrics.track('Native Setup Failed');
|
||||||
setupServerActions.error({error});
|
setupServerActions.error({error});
|
||||||
|
|
||||||
let message = error.message.split('\n');
|
bugsnag.notify('Native Setup Failed', error.message, {
|
||||||
let lastLine = message.length > 1 ? message[message.length - 2] : 'Docker Machine encountered an error.';
|
'Docker Error': error.message
|
||||||
bugsnag.notify('Native Setup Failed', lastLine, {
|
|
||||||
'Docker Machine Logs': error.message
|
|
||||||
}, 'info');
|
}, 'info');
|
||||||
|
|
||||||
this.clearTimers();
|
this.clearTimers();
|
||||||
await this.pause();
|
await this.pause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async nativeSetup () {
|
||||||
|
while (true) {
|
||||||
|
try {
|
||||||
|
router.get().transitionTo('setup');
|
||||||
|
docker.setup(util.isLinux() ? 'localhost':'docker.local');
|
||||||
|
setupServerActions.started({started: true});
|
||||||
|
this.simulateProgress(20);
|
||||||
|
return docker.version();
|
||||||
|
} catch (error) {
|
||||||
|
throw new Error(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
async nonNativeSetup () {
|
async nonNativeSetup () {
|
||||||
|
console.log('Non-native setup');
|
||||||
let virtualBoxVersion = null;
|
let virtualBoxVersion = null;
|
||||||
let machineVersion = null;
|
let machineVersion = null;
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
@ -127,13 +152,16 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
let state = await machine.status();
|
let state = await machine.status();
|
||||||
if (state !== 'Running') {
|
if (state !== 'Running') {
|
||||||
|
router.get().transitionTo('setup');
|
||||||
|
setupServerActions.started({started: true});
|
||||||
if (state === 'Saved') {
|
if (state === 'Saved') {
|
||||||
router.get().transitionTo('setup');
|
|
||||||
this.simulateProgress(10);
|
this.simulateProgress(10);
|
||||||
} else if (state === 'Stopped') {
|
} else if (state === 'Stopped') {
|
||||||
router.get().transitionTo('setup');
|
|
||||||
this.simulateProgress(25);
|
this.simulateProgress(25);
|
||||||
|
} else {
|
||||||
|
this.simulateProgress(40);
|
||||||
}
|
}
|
||||||
|
|
||||||
await machine.start();
|
await machine.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -151,6 +179,7 @@ export default {
|
||||||
|
|
||||||
if (ip) {
|
if (ip) {
|
||||||
docker.setup(ip, machine.name());
|
docker.setup(ip, machine.name());
|
||||||
|
await docker.version();
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Could not determine IP from docker-machine.');
|
throw new Error('Could not determine IP from docker-machine.');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,18 @@ module.exports = {
|
||||||
isLinux: function () {
|
isLinux: function () {
|
||||||
return process.platform === 'linux';
|
return process.platform === 'linux';
|
||||||
},
|
},
|
||||||
|
isNative: function () {
|
||||||
|
let native = JSON.parse(localStorage.getItem('settings.useNative'));
|
||||||
|
if (native === null) {
|
||||||
|
try {
|
||||||
|
let stats = fs.statSync('/var/run/docker.sock');
|
||||||
|
native = true;
|
||||||
|
} catch(e){
|
||||||
|
native = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return native;
|
||||||
|
},
|
||||||
binsPath: function () {
|
binsPath: function () {
|
||||||
return this.isWindows() ? path.join(this.home(), 'Kitematic-bins') : path.join('/usr/local/bin');
|
return this.isWindows() ? path.join(this.home(), 'Kitematic-bins') : path.join('/usr/local/bin');
|
||||||
},
|
},
|
||||||
|
|
@ -163,9 +175,9 @@ module.exports = {
|
||||||
dialog.showMessageBox({
|
dialog.showMessageBox({
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
buttons: ['OK'],
|
buttons: ['OK'],
|
||||||
message: 'The terminal emulator symbolic link doesn\'t exists. Please read the Wiki at https://github.com/kitematic/kitematic/wiki/Common-Issues-and-Fixes#early-linux-support-from-zedtux.'
|
message: 'The terminal emulator symbolic link doesn\'t exists. Please read the Wiki at https://github.com/docker/kitematic/wiki/Early-Linux-Support.'
|
||||||
});
|
});
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
webPorts: ['80', '8000', '8080', '8888', '3000', '5000', '2368', '9200', '8983']
|
webPorts: ['80', '8000', '8080', '8888', '3000', '5000', '2368', '9200', '8983']
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue