refactor: remove ACCEPT_EULA option from nebula serve due to qlikcore engine deprecation (#724)

This commit is contained in:
Li Kang
2021-12-06 10:00:06 +01:00
committed by GitHub
parent 6fe584cff8
commit 7c43dd09dc
10 changed files with 1 additions and 124 deletions

View File

@@ -83,9 +83,7 @@ jobs:
steps:
- checkout
- restore_cache: *restore_yarn_cache
- run:
name: Install dependencies
command: yarn install --frozen-lockfile --cache-folder ~/.cache/yarn

View File

@@ -35,7 +35,6 @@ Options:
--enigma.host [string] [default: "localhost"]
--enigma.port [number] [default: 9076]
--webIntegrationId [string]
--ACCEPT_EULA [boolean] [default: false]
--fixturePath Path to a folder that will be used as basis when locating
fixtures [string] [default: "test/component"]
-h, --help Show help [boolean]

View File

@@ -1,13 +0,0 @@
version: '3.1'
services:
engine:
image: qlikcore/engine:${ENGINE_VERSION:-12.972.0}
# restart: always
command: |
-S AcceptEULA=${ACCEPT_EULA:-no}
-S DocumentDirectory=/apps
ports:
- ${ENGINE_PORT:-9076}:9076
volumes:
- ${APPS_PATH:-./data/apps}:/apps

View File

@@ -1,49 +0,0 @@
const path = require('path');
const { spawn } = require('child_process');
const execCmd = (cmd, cmdArgs = [], opts) =>
new Promise((resolve, reject) => {
const child = spawn(cmd, cmdArgs, opts);
const res = {
exitCode: null,
out: '',
err: '',
};
child.on('error', reject);
child.stdout.on('data', (chunk) => {
res.out += chunk.toString();
});
child.stderr.on('data', (chunk) => {
res.err += chunk.toString();
});
child.on('exit', (exitCode) => {
res.exitCode = exitCode;
if (exitCode === 0) {
resolve(res);
} else {
reject(res);
}
});
});
const useEngine = ({ ACCEPT_EULA = false, cwd = path.resolve(__dirname, '../'), files }) => {
if (ACCEPT_EULA !== true) {
throw new Error('Need to accept EULA in order to start engine container');
}
console.error('Starting engine container...');
const f = (files || []).reduce((acc, curr) => [...acc, '-f', curr], []);
process.env.ACCEPT_EULA = 'yes';
const stopEngine = async () => {
console.error('Stopping engine container...');
try {
await execCmd('docker-compose', [...f, 'down', '--remove-orphans'], {
cwd,
});
} catch (err) {
console.error(err);
}
};
return execCmd('docker-compose', [...f, 'up', '-d', '--build'], { cwd }).then(() => stopEngine);
};
module.exports = useEngine;

View File

@@ -62,10 +62,6 @@ const options = {
webIntegrationId: {
type: 'string',
},
ACCEPT_EULA: {
type: 'boolean',
default: false,
},
fixturePath: {
type: 'string',
default: 'test/component',

View File

@@ -10,7 +10,6 @@ const build = require('@nebula.js/cli-build');
const initConfig = require('./init-config');
const webpackServe = require('./webpack.serve');
const useEngine = require('./engine');
const initiateWatch = async ({ snPath, snName, host }) => {
// TODO - timeout
@@ -103,11 +102,6 @@ module.exports = async (argv) => {
}
const serveConfig = extend(true, {}, defaultServeConfig, argv);
let stopEngine = () => {};
if (serveConfig.ACCEPT_EULA) {
stopEngine = await useEngine(serveConfig);
}
const host = serveConfig.host || 'localhost';
const port = serveConfig.port || (await portfinder.getPortPromise({ host }));
const enigmaConfig = serveConfig.enigma;
@@ -169,7 +163,6 @@ module.exports = async (argv) => {
});
const close = async () => {
await stopEngine();
if (watcher) {
watcher.close();
}

View File

@@ -18,7 +18,6 @@
"command.js",
"data",
"dist",
"docker-compose.yml",
"lib"
],
"scripts": {

View File

@@ -1,9 +0,0 @@
version: '3.1'
services:
engine:
image: qlikcore/engine:${ENGINE_VERSION}
restart: always
command: -S AcceptEULA="${ACCEPT_EULA:-no}"
ports:
- '9076:9076'

View File

@@ -3,21 +3,15 @@
const yargs = require('yargs');
const mashupServer = require('../test/mashup/server');
const useEngine = require('../commands/serve/lib/engine');
const args = yargs
.option('start', {
default: true,
type: 'boolean',
describe: 'Start the mashup server',
})
.option('engine', {
default: false,
type: 'boolean',
describe: 'Start the engine',
}).argv;
const { start, engine } = args;
const { start } = args;
let hasCleanedUp = false;
const services = [];
@@ -36,23 +30,6 @@ if (start) {
});
}
if (engine) {
let e;
services.push({
name: 'Qlik Engine',
start: async () => {
e = await useEngine({
ACCEPT_EULA: true,
files: ['./test/fixtures/docker/docker-compose.yml'],
cwd: process.cwd(),
});
},
stop: async () => {
e && (await e());
},
});
}
function cleanup() {
if (hasCleanedUp) {
return;

View File

@@ -1,14 +0,0 @@
version: '3.1'
services:
engine:
image: qlikcore/engine:${ENGINE_VERSION:-12.972.0}
# restart: always
command: |
-S AcceptEULA=${ACCEPT_EULA:-no}
-S DocumentDirectory=/apps
-S SSEPlugin=sse,host.docker.internal:50051
ports:
- '9076:9076'
volumes:
- ${APPS_PATH:-../data/apps}:/apps