mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[plugin cli] defer optimization (#26983)
* [plugin cli] defer optimization * include pr in docs * update migration docs * fix merge
This commit is contained in:
parent
c9eee0c222
commit
166c192c7f
6 changed files with 12 additions and 52 deletions
|
@ -237,6 +237,7 @@ Operations::
|
|||
* Creates separate startup scripts for development and production {pull}13806[#13806]
|
||||
* Sets default port based on protocol {pull}21564[#21564]
|
||||
* Removes deprecated `/shorten` API {pull}21861[#21861]
|
||||
* Plugin installer defers optimization step until server start {pull}26983[#26983]
|
||||
|
||||
[float]
|
||||
[[deprecation-7.0.0]]
|
||||
|
|
|
@ -124,6 +124,12 @@ It's now required that the user sets `server.ssl.enabled` to true for this to oc
|
|||
|
||||
*Impact:* Users with both `server.ssl.certificate` and `server.ssl.key` set must now also set `server.ssl.enabled` to enable SSL.
|
||||
|
||||
[float]
|
||||
=== Optimization step deferred until server start
|
||||
*Details:* Prior versions of Kibana would run the optimization step after each plugin installation. This is now run on server start when necessary.
|
||||
|
||||
*Impact:* Users can trigger a standalone optimization after all plugins have been installed with `bin/kibana --optimize` or let the server manage it on startup.
|
||||
|
||||
[float]
|
||||
=== kibana.yml setting `i18n.defaultLocale` is no longer valid
|
||||
*Details:* This deprecated setting has been removed and `i18n.locale` should be used instead.
|
||||
|
|
|
@ -54,27 +54,6 @@ NOTE: This command creates the specified directory if it does not already exist.
|
|||
|
||||
WARNING: This option is deprecated and will be removed in Kibana 7. It is known to not work with some plugins, including {xpack}.
|
||||
|
||||
[float]
|
||||
=== Installing Plugins with Linux packages
|
||||
|
||||
The Kibana server needs to be able to write to files in the `optimize` directory. If you're installing plugins using sudo or su you'll
|
||||
want to make sure these commands are ran as the user `kibana`. This user is already added for you as part of the package installation.
|
||||
|
||||
[source,shell]
|
||||
$ sudo -u kibana bin/kibana-plugin install x-pack
|
||||
|
||||
If plugins were installed as a different user and the server is not starting, then you will need to change the owner of these files:
|
||||
|
||||
[source,shell]
|
||||
$ chown -R kibana:kibana /path/to/kibana/optimize
|
||||
|
||||
[float]
|
||||
=== Installing plugins while deferring optimization
|
||||
|
||||
The majority of the time spent installing a plugin is running the optimizer. If you're installing multiple plugins it can make sense to omit that step and only run it once.
|
||||
This can be done by providing --no-optimize to the plugin installation command. You can then either execute bin/kibana --optimize to run the optimizer,
|
||||
or it will be ran the first time Kibana is started.
|
||||
|
||||
[float]
|
||||
=== Proxy support for plugin installation
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ function processCommand(command, options) {
|
|||
} catch (ex) {
|
||||
//The logger has not yet been initialized.
|
||||
console.error(ex.message);
|
||||
process.exit(64); // eslint-disable-line no-process-exit
|
||||
process.exit(64);
|
||||
}
|
||||
|
||||
const logger = new Logger(settings);
|
||||
|
@ -47,7 +47,6 @@ export default function pluginInstall(program) {
|
|||
.command('install <plugin/url>')
|
||||
.option('-q, --quiet', 'disable all process messaging except errors')
|
||||
.option('-s, --silent', 'disable all process messaging')
|
||||
.option('--no-optimize', 'disable optimization after plugin extraction')
|
||||
.option(
|
||||
'-c, --config <path>',
|
||||
'path to the config file',
|
||||
|
|
|
@ -25,7 +25,7 @@ import { extract, getPackData } from './pack';
|
|||
import { renamePlugin } from './rename';
|
||||
import { sync as rimrafSync } from 'rimraf';
|
||||
import { errorIfXPackInstall } from '../lib/error_if_x_pack';
|
||||
import { existingInstall, rebuildCache, assertVersion } from './kibana';
|
||||
import { existingInstall, assertVersion } from './kibana';
|
||||
import { prepareExternalProjectDependencies } from '@kbn/pm';
|
||||
import mkdirp from 'mkdirp';
|
||||
|
||||
|
@ -55,14 +55,10 @@ export default async function install(settings, logger) {
|
|||
|
||||
await renamePlugin(settings.workingPath, path.join(settings.pluginDir, settings.plugins[0].name));
|
||||
|
||||
if (settings.optimize) {
|
||||
await rebuildCache(settings, logger);
|
||||
}
|
||||
|
||||
logger.log('Plugin installation complete');
|
||||
} catch (err) {
|
||||
logger.error(`Plugin installation was unsuccessful due to error "${err.message}"`);
|
||||
cleanArtifacts(settings);
|
||||
process.exit(70); // eslint-disable-line no-process-exit
|
||||
process.exit(70);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
*/
|
||||
|
||||
import path from 'path';
|
||||
import execa from 'execa';
|
||||
import { fromRoot, watchStdioForLine } from '../../utils';
|
||||
import { versionSatisfies, cleanVersion } from '../../utils/version';
|
||||
import { statSync } from 'fs';
|
||||
|
||||
|
@ -28,34 +26,15 @@ export function existingInstall(settings, logger) {
|
|||
statSync(path.join(settings.pluginDir, settings.plugins[0].name));
|
||||
|
||||
logger.error(`Plugin ${settings.plugins[0].name} already exists, please remove before installing a new version`);
|
||||
process.exit(70); // eslint-disable-line no-process-exit
|
||||
process.exit(70);
|
||||
} catch (e) {
|
||||
if (e.code !== 'ENOENT') throw e;
|
||||
}
|
||||
}
|
||||
|
||||
export async function rebuildCache(settings, logger) {
|
||||
logger.log('Optimizing and caching browser bundles...');
|
||||
|
||||
const kibanaArgs = [
|
||||
fromRoot('./src/cli'),
|
||||
'--env.name=production',
|
||||
'--optimize.useBundleCache=false',
|
||||
'--server.autoListen=false',
|
||||
'--plugins.initialize=false'
|
||||
];
|
||||
|
||||
const proc = execa(process.execPath, kibanaArgs, {
|
||||
stdio: ['ignore', 'pipe', 'pipe'],
|
||||
cwd: fromRoot('.'),
|
||||
});
|
||||
|
||||
await watchStdioForLine(proc, () => {}, /Optimization .+ complete/);
|
||||
}
|
||||
|
||||
export function assertVersion(settings) {
|
||||
if (!settings.plugins[0].kibanaVersion) {
|
||||
throw new Error (`Plugin package.json is missing both a version property (required) and a kibana.version property (optional).`);
|
||||
throw new Error(`Plugin package.json is missing both a version property (required) and a kibana.version property (optional).`);
|
||||
}
|
||||
|
||||
const actual = cleanVersion(settings.plugins[0].kibanaVersion);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue