Socket
Socket
Sign inDemoInstall

kourou

Package Overview
Dependencies
215
Maintainers
2
Versions
53
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.26.1 to 0.26.2

lib/support/docker/checkPrerequisites.d.ts

19

lib/commands/app/doctor.js

@@ -10,2 +10,3 @@ "use strict";

const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
const checkPrerequisites_1 = require("../../support/docker/checkPrerequisites");
class AppDoctor extends common_1.Kommand {

@@ -173,17 +174,7 @@ constructor() {

this.log("Docker checks");
try {
const docov = await (0, execute_1.execute)("docker-compose", "-v");
const matches = docov.stdout.match(/[^0-9.]*([0-9.]*).*/);
if (matches === null || matches.length === 0) {
this.logKo("Docker Version cannot be found");
}
else {
this.logOk(`Docker Compose Version: ${matches[1]}`);
}
const result = await (0, checkPrerequisites_1.checkPrerequisites)(this);
if (!result) {
suggestions.push("Install Docker and the Compose plugin");
}
catch (error) {
this.logKo("Docker Compose cannot be found");
suggestions.push("Install Docker Compose with 'npm run install:docker'");
}
this.log(`----------------- DoKtor finish his job ! -----------------`);
this.log(`----------------- DoKtor finished its job ! -----------------`);
this.log(`He suggest you to check the following points:`);

@@ -190,0 +181,0 @@ for (const suggestion of suggestions) {

@@ -10,3 +10,2 @@ import { Kommand } from "../../common";

runSafe(): Promise<void>;
checkPrerequisites(): Promise<boolean>;
}

@@ -8,7 +8,6 @@ "use strict";

const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
const listr_1 = (0, tslib_1.__importDefault)(require("listr"));
const node_emoji_1 = (0, tslib_1.__importDefault)(require("node-emoji"));
const common_1 = require("../../common");
const execute_1 = require("../../support/execute");
const MIN_DOCO_VERSION = "1.12.0";
const checkPrerequisites_1 = require("../../support/docker/checkPrerequisites");
const kuzzleServicesFile = `

@@ -35,3 +34,3 @@ version: '3'

const successfullCheck = this.flags.check
? await this.checkPrerequisites()
? await (0, checkPrerequisites_1.checkPrerequisites)(this)
: true;

@@ -44,11 +43,11 @@ if (this.flags.check && successfullCheck) {

}
this.log(chalk_1.default.grey(`\nWriting docker-compose file to ${docoFilename}...\n`));
this.log(chalk_1.default.grey(`\nWriting the Docker Compose file to ${docoFilename}...\n`));
(0, fs_1.writeFileSync)(docoFilename, kuzzleServicesFile);
// clean up
await (0, execute_1.execute)("docker-compose", "-f", docoFilename, "down");
await (0, execute_1.execute)("docker", "compose", "-f", docoFilename, "down");
try {
await (0, execute_1.execute)("docker-compose", "-f", docoFilename, "up", "-d");
await (0, execute_1.execute)("docker", "compose", "-f", docoFilename, "up", "-d");
this.logOk("Elasticsearch and Redis are booting in the background right now.");
this.log(chalk_1.default.grey("\nTo watch the logs, run"));
this.log(chalk_1.default.blue.bold(` docker-compose -f ${docoFilename} logs -f\n`));
this.log(chalk_1.default.blue.bold(` docker compose -f ${docoFilename} logs -f\n`));
this.log(` Elasticsearch port: ${chalk_1.default.bold("9200")}`);

@@ -60,45 +59,5 @@ this.log(` Redis port: ${chalk_1.default.bold("6379")}`);

this.log(chalk_1.default.grey("If you want to investigate the problem, try running"));
this.log(chalk_1.default.grey(` docker-compose -f ${docoFilename} up\n`));
this.log(chalk_1.default.grey(` docker compose -f ${docoFilename} up\n`));
}
}
async checkPrerequisites() {
this.log(chalk_1.default.grey("Checking prerequisites..."));
const checks = new listr_1.default([
{
title: `docker-compose exists and the version is at least ${MIN_DOCO_VERSION}`,
task: async () => {
try {
const docov = await (0, execute_1.execute)("docker-compose", "-v");
const matches = docov.stdout.match(/[^0-9.]*([0-9.]*).*/);
if (matches === null) {
throw new Error("Unable to read docker-compose verson. This is weird.");
}
const docoVersion = matches.length > 0 ? matches[1] : null;
if (docoVersion === null) {
throw new Error("Unable to read docker-compose version. This is weird.");
}
try {
if (docoVersion < MIN_DOCO_VERSION) {
throw new Error(`The detected version of docker-compose (${docoVersion}) is not recent enough (${MIN_DOCO_VERSION})`);
}
}
catch (error) {
throw new Error(error);
}
}
catch (error) {
throw new Error("No docker-compose found. Are you sure docker-compose is installed?");
}
},
},
]);
try {
await checks.run();
return true;
}
catch (error) {
this.logKo(error.message);
return false;
}
}
}

@@ -105,0 +64,0 @@ exports.default = AppStartServices;

@@ -53,3 +53,4 @@ "use strict";

});
const instanceKill = (0, child_process_1.spawn)("docker-compose", [
const instanceKill = (0, child_process_1.spawn)("docker", [
"compose",
"-f",

@@ -56,0 +57,0 @@ docoFilename,

@@ -12,3 +12,2 @@ import { flags } from "@oclif/command";

runSafe(): Promise<void>;
checkPrerequisites(): Promise<boolean>;
private generateDocoFile;

@@ -15,0 +14,0 @@ private isPortAvailable;

@@ -11,8 +11,8 @@ "use strict";

const cli_ux_1 = (0, tslib_1.__importDefault)(require("cli-ux"));
const listr_1 = (0, tslib_1.__importDefault)(require("listr"));
const node_emoji_1 = (0, tslib_1.__importDefault)(require("node-emoji"));
const common_1 = require("../../common");
const execute_1 = require("../../support/execute");
const checkPrerequisites_1 = require("../../support/docker/checkPrerequisites");
const MIN_MAX_MAP_COUNT = 262144;
const MIN_DOCO_VERSION = "1.12.0";
const MIN_DOCO_VERSION = "2.0.0";
const kuzzleStackV1 = (increment) => `

@@ -93,3 +93,3 @@ version: '3'

const successfullCheck = this.flags.check
? await this.checkPrerequisites()
? await (0, checkPrerequisites_1.checkPrerequisites)(this)
: true;

@@ -102,7 +102,8 @@ if (this.flags.check && successfullCheck) {

}
this.log(chalk_1.default.grey(`\nWriting docker-compose file to ${docoFilename}...`));
this.log(chalk_1.default.grey(`\nWriting docker compose file to ${docoFilename}...`));
(0, fs_1.writeFileSync)(docoFilename, this.generateDocoFile(this.flags.version, portIndex));
// clean up
await (0, execute_1.execute)("docker-compose", "-f", docoFilename, "-p", `stack-${portIndex}`, "down");
const doco = (0, child_process_1.spawn)("docker-compose", [
await (0, execute_1.execute)("docker", "compose", "-f", docoFilename, "-p", `stack-${portIndex}`, "down");
const doco = (0, child_process_1.spawn)("docker", [
"compose",
"-f",

@@ -123,3 +124,3 @@ docoFilename,

this.log(chalk_1.default.grey("To watch the logs, run"));
this.log(chalk_1.default.grey(` docker-compose -f ${docoFilename} -p stack-${portIndex} logs -f\n`));
this.log(chalk_1.default.grey(` docker compose -f ${docoFilename} -p stack-${portIndex} logs -f\n`));
this.log(` Kuzzle port: ${7512 + portIndex}`);

@@ -131,67 +132,9 @@ this.log(` MQTT port: ${1883 + portIndex}`);

else {
cli_ux_1.default.action.stop(chalk_1.default.red(` Something went wrong: docker-compose exited with ${docoCode}`));
cli_ux_1.default.action.stop(chalk_1.default.red(` Something went wrong: docker compose exited with ${docoCode}`));
this.log(chalk_1.default.grey("If you want to investigate the problem, try running"));
this.log(chalk_1.default.grey(` docker-compose -f ${docoFilename} -p stack-${portIndex} up\n`));
throw new Error("docker-compose exited witn non-zero status");
this.log(chalk_1.default.grey(` docker compose -f ${docoFilename} -p stack-${portIndex} up\n`));
throw new Error("docker compose exited with a non-zero status");
}
});
}
async checkPrerequisites() {
this.log(chalk_1.default.grey("Checking prerequisites..."));
const checks = new listr_1.default([
{
title: `docker-compose exists and the version is at least ${MIN_DOCO_VERSION}`,
task: async () => {
try {
const docov = await (0, execute_1.execute)("docker-compose", "-v");
const matches = docov.stdout.match(/[^0-9.]*([0-9.]*).*/);
if (matches === null) {
throw new Error("Unable to read docker-compose verson. This is weird.");
}
const docoVersion = matches.length > 0 ? matches[1] : null;
if (docoVersion === null) {
throw new Error("Unable to read docker-compose version. This is weird.");
}
try {
if (docoVersion < MIN_DOCO_VERSION) {
throw new Error(`The detected version of docker-compose (${docoVersion}) is not recent enough (${MIN_DOCO_VERSION})`);
}
}
catch (error) {
throw new Error(error);
}
}
catch (error) {
throw new Error("No docker-compose found. Are you sure docker-compose is installed?");
}
},
},
{
title: `vm.max_map_count is greater than ${MIN_MAX_MAP_COUNT}`,
task: async () => {
try {
const sysctl = await (0, execute_1.execute)("/sbin/sysctl", "-n", "vm.max_map_count");
if (sysctl.exitCode !== 0) {
throw new Error("Something went wrong checking vm.max_map_count");
}
const value = parseInt(sysctl.stdout, 10);
if (value < MIN_MAX_MAP_COUNT) {
throw new Error(`vm.max_map_count must be at least ${MIN_MAX_MAP_COUNT} (found ${value})`);
}
}
catch (error) {
throw new Error(`Something went wrong checking vm.max_map_count: ${error.message}`);
}
},
},
]);
try {
await checks.run();
return true;
}
catch (error) {
this.logKo(error.message);
return false;
}
}
generateDocoFile(kuzzleMajor, portIndex) {

@@ -198,0 +141,0 @@ if (kuzzleMajor === "1") {

{
"name": "kourou",
"description": "The CLI that helps you manage your Kuzzle instances",
"version": "0.26.1",
"version": "0.26.2",
"author": "The Kuzzle Team <support@kuzzle.io>",

@@ -6,0 +6,0 @@ "bin": {

@@ -30,3 +30,3 @@ # kourou

$ kourou (-v|--version|version)
kourou/0.26.1 darwin-arm64 node-v18.17.1
kourou/0.26.2 darwin-arm64 node-v18.17.1
$ kourou --help [COMMAND]

@@ -33,0 +33,0 @@ USAGE

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc