Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/dashmate/src/commands/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class SetupCommand extends BaseCommand {
* @param {ConfigFile} configFile
* @param {setupLocalPresetTask} setupLocalPresetTask
* @param {setupRegularPresetTask} setupRegularPresetTask
* @param {DockerCompose} dockerCompose
* @return {Promise<void>}
*/
async runWithDependencies(
Expand All @@ -40,12 +41,17 @@ class SetupCommand extends BaseCommand {
configFile,
setupLocalPresetTask,
setupRegularPresetTask,
dockerCompose,
) {
if (nodeCount !== null && (nodeCount < 3)) {
throw new Error('node-count flag should be not less than 3');
}

const tasks = new Listr([
{
title: 'System requirements',
task: async () => dockerCompose.throwErrorIfNotInstalled(),
},
{
title: 'Configuration preset',
task: async (ctx, task) => {
Expand Down
12 changes: 7 additions & 5 deletions packages/dashmate/src/docker/DockerCompose.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ class DockerCompose {
}

/**
* @private
* @return {Promise<void>}
*/
async throwErrorIfNotInstalled() {
Expand All @@ -361,9 +360,12 @@ class DockerCompose {

this.isDockerSetupVerified = true;

const dockerComposeInstallLink = 'https://docs.docker.com/compose/install/';
const dockerInstallLink = 'https://docs.docker.com/engine/install/';

// Check docker
if (!hasbin.sync('docker')) {
throw new Error('Docker is not installed');
throw new Error(`Docker is not installed. Please follow instructions ${dockerInstallLink}`);
}

const dockerVersion = await new Promise((resolve, reject) => {
Expand All @@ -377,7 +379,7 @@ class DockerCompose {
});

if (semver.lt(dockerVersion.trim(), DockerCompose.DOCKER_MIN_VERSION)) {
throw new Error(`Update Docker to version ${DockerCompose.DOCKER_MIN_VERSION} or higher`);
throw new Error(`Update Docker to version ${DockerCompose.DOCKER_MIN_VERSION} or higher. Please follow instructions ${dockerInstallLink}`);
}

let version;
Expand All @@ -386,11 +388,11 @@ class DockerCompose {
try {
({ out: version } = await dockerCompose.version());
} catch (e) {
throw new Error('Docker Compose V2 is not available in your system');
throw new Error(`Docker Compose V2 is not available in your system. Please follow instructions ${dockerComposeInstallLink}`);
}

if (semver.lt(version.trim(), DockerCompose.DOCKER_COMPOSE_MIN_VERSION)) {
throw new Error(`Update Docker Compose to version ${DockerCompose.DOCKER_COMPOSE_MIN_VERSION} or higher`);
throw new Error(`Update Docker Compose to version ${DockerCompose.DOCKER_COMPOSE_MIN_VERSION} or higher. Please follow instructions ${dockerComposeInstallLink}`);
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/dashmate/src/oclif/errors/MuteOneLineError.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class MuteOneLineError extends AbstractError {
constructor(error) {
super('SIGINT');

if (settings.debug || (error.message && error.message.trimEnd().includes('\n'))) {
if (settings.debug) {
this.name = error.name;
this.message = error.message;
this.stack = error.stack;
Expand Down