Skip to content

Commit

Permalink
move optimize into data folder (#25944)
Browse files Browse the repository at this point in the history
* move optimize into data folder

* path

* replace optimize with data in notice glob

* update docs

* more updates

* update snapshots

* re-add folder references

* prettier

* save changes

* rm optimize from .eslintignore

* rm extra file

* fix merge
  • Loading branch information
jbudz committed Aug 28, 2019
1 parent 1f98213 commit bad947d
Show file tree
Hide file tree
Showing 17 changed files with 22 additions and 27 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ bower_components
/target
/.es
/plugins
/optimize
/built_assets
/html_docs
/src/fixtures/vislib/mock_data
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ node_modules
!/src/dev/npm/integration_tests/__fixtures__/fixture1/node_modules
!/src/dev/notice/__fixtures__/node_modules
trash
/optimize
/built_assets
target
/build
Expand Down
8 changes: 7 additions & 1 deletion docs/migration/migrate_8_0.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,10 @@ specified explicitly.

*Impact:* Define `xpack.security.authc.saml.realm` when using the SAML authentication provider instead.

// end::notable-breaking-changes[]
[float]
=== `optimize` directory is now in the `data` folder
*Details:* Generated bundles have moved to the configured `path.data` folder.

*Impact:* Any workflow that involved manually clearing generated bundles will have to be updated with the new path.

// end::notable-breaking-changes[]
2 changes: 1 addition & 1 deletion docs/setup/install/deb.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ locations for a Debian-based system:
| optimize
| Transpiled source code. Certain administrative actions (e.g. plugin install)
result in the source code being retranspiled on the fly.
| /usr/share/kibana/optimize
| /var/lib/kibana/optimize
d|

| plugins
Expand Down
2 changes: 1 addition & 1 deletion docs/setup/install/rpm.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ locations for an RPM-based system:
| optimize
| Transpiled source code. Certain administrative actions (e.g. plugin install)
result in the source code being retranspiled on the fly.
| /usr/share/kibana/optimize
| /var/lib/kibana/optimize
d|

| plugins
Expand Down
2 changes: 1 addition & 1 deletion docs/setup/install/targz.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ important data later on.
| optimize
| Transpiled source code. Certain administrative actions (e.g. plugin install)
result in the source code being retranspiled on the fly.
| $KIBANA_HOME\optimize
| $KIBANA_HOME\data\optimize
d|

| plugins
Expand Down
2 changes: 1 addition & 1 deletion docs/setup/install/windows.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ important data later on.
| optimize
| Transpiled source code. Certain administrative actions (e.g. plugin install)
result in the source code being retranspiled on the fly.
| $KIBANA_HOME\optimize
| $KIBANA_HOME\data\optimize
d|

| plugins
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-test/src/functional_tests/lib/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ export const KIBANA_FTR_SCRIPT = resolve(KIBANA_ROOT, 'scripts/functional_test_r
export const PROJECT_ROOT = resolve(__dirname, '../../../../../../');
export const FUNCTIONAL_CONFIG_PATH = resolve(KIBANA_ROOT, 'test/functional/config');
export const API_CONFIG_PATH = resolve(KIBANA_ROOT, 'test/api_integration/config');
export const OPTIMIZE_BUNDLE_DIR = resolve(KIBANA_ROOT, 'optimize/bundles');
export const OPTIMIZE_BUNDLE_DIR = resolve(KIBANA_ROOT, 'data/optimize/bundles');
4 changes: 2 additions & 2 deletions src/dev/build/tasks/create_empty_dirs_and_files_task.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export const CreateEmptyDirsAndFilesTask = {
async run(config, log, build) {
await Promise.all([
mkdirp(build.resolvePath('plugins')),
mkdirp(build.resolvePath('data')),
write(build.resolvePath('optimize/.babel_register_cache.json'), '{}'),
mkdirp(build.resolvePath('data/optimize')),
write(build.resolvePath('data/optimize/.babel_register_cache.json'), '{}'),
]);
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,5 @@ case $1 in
;;
esac

chown -R <%= user %>:<%= group %> <%= optimizeDir %>
chown <%= user %>:<%= group %> <%= dataDir %>
chown -R <%= user %>:<%= group %> <%= dataDir %>
chown <%= user %>:<%= group %> <%= pluginsDir %>
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ if [ "$REMOVE_USER_AND_GROUP" = "true" ]; then
fi

if [ "$REMOVE_DIRS" = "true" ]; then
if [ -d "<%= optimizeDir %>" ]; then
rm -rf "<%= optimizeDir %>"
fi

if [ -d "<%= pluginsDir %>" ]; then
rm -rf "<%= pluginsDir %>"
fi
Expand Down
1 change: 0 additions & 1 deletion src/dev/build/tasks/os_packages/run_fpm.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ export async function runFpm(config, log, build, type, pkgSpecificFlags) {
// scripts, also causes scripts to be processed with erb
'--template-value', `user=kibana`,
'--template-value', `group=kibana`,
'--template-value', `optimizeDir=/usr/share/kibana/optimize`,
'--template-value', `configDir=/etc/kibana`,
'--template-value', `pluginsDir=/usr/share/kibana/plugins`,
'--template-value', `dataDir=/var/lib/kibana`,
Expand Down
4 changes: 2 additions & 2 deletions src/dev/notice/generate_notice_from_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ export async function generateNoticeFromSource({ productName, directory, log })
cwd: directory,
nodir: true,
ignore: [
'{node_modules,build,target,dist,optimize,built_assets}/**',
'{node_modules,build,target,dist,data,built_assets}/**',
'packages/*/{node_modules,build,target,dist}/**',
'x-pack/{node_modules,build,target,dist,optimize}/**',
'x-pack/{node_modules,build,target,dist,data}/**',
'x-pack/packages/*/{node_modules,build,target,dist}/**',
]
};
Expand Down
7 changes: 2 additions & 5 deletions src/legacy/server/config/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@

import Joi from 'joi';
import os from 'os';

import {
fromRoot
} from '../../utils';
import { join } from 'path';
import {
getData
} from '../path';
Expand Down Expand Up @@ -170,7 +167,7 @@ export default () => Joi.object({
optimize: Joi.object({
enabled: Joi.boolean().default(true),
bundleFilter: Joi.string().default('!tests'),
bundleDir: Joi.string().default(fromRoot('optimize/bundles')),
bundleDir: Joi.string().default(join(getData(), 'optimize')),
viewCaching: Joi.boolean().default(Joi.ref('$prod')),
watch: Joi.boolean().default(false),
watchPort: Joi.number().default(5602),
Expand Down
2 changes: 1 addition & 1 deletion src/optimize/base_optimizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export default class BaseOptimizer {
/**
* Adds a cache loader if we're running in dev mode. The reason we're not adding
* the cache-loader when running in production mode is that it creates cache
* files in optimize/.cache that are not necessary for distributable versions
* files in data/optimize/.cache that are not necessary for distributable versions
* of Kibana and just make compressing and extracting it more difficult.
*/
const maybeAddCacheLoader = (cacheName, loaders) => {
Expand Down
2 changes: 1 addition & 1 deletion src/setup_node_env/babel_register/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var resolve = require('path').resolve;
// this must happen before `require('@babel/register')` and can't be changed
// once the module has been loaded
if (!process.env.BABEL_CACHE_PATH) {
process.env.BABEL_CACHE_PATH = resolve(__dirname, '../../../optimize/.babel_register_cache.json');
process.env.BABEL_CACHE_PATH = resolve(__dirname, '../../../data/optimize/.babel_register_cache.json');
}

// paths that @babel/register should ignore
Expand Down
2 changes: 1 addition & 1 deletion tasks/config/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ module.exports = function (grunt) {
'--no-base-path',
'--optimize.watchPort=5611',
'--optimize.watchPrebuild=true',
'--optimize.bundleDir=' + resolve(__dirname, '../../optimize/testdev'),
'--optimize.bundleDir=' + resolve(__dirname, '../../data/optimize/testdev'),
]
}),

Expand Down

0 comments on commit bad947d

Please sign in to comment.