Skip to content

Commit 5b19534

Browse files
committed
[build] Add data directory that plugins can write to. Closes elastic#7157
1 parent 6b98215 commit 5b19534

6 files changed

Lines changed: 13 additions & 1 deletion

File tree

installedPlugins/.empty

Whitespace-only changes.

tasks/build/installed_plugins.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module.exports = function (grunt) {
22
grunt.registerTask('_build:installedPlugins', function () {
33
grunt.file.mkdir('build/kibana/installedPlugins');
4+
grunt.file.mkdir('build/kibana/installedPlugins/.data');
45
});
56
};

tasks/build/os_packages.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ export default (grunt) => {
4444
'--template-value', `optimizeDir=${packages.path.home}/optimize`,
4545
'--template-value', `configDir=${packages.path.conf}`,
4646
'--template-value', `pluginsDir=${packages.path.plugins}`,
47+
'--template-value', `dataDir=${packages.path.data}`,
4748
//config folder is moved to path.conf, exclude {path.home}/config
4849
//uses relative path to --prefix, strip the leading /
49-
'--exclude', `${packages.path.home.slice(1)}/config`
50+
'--exclude', `${packages.path.home.slice(1)}/config`,
51+
'--exclude', `${packages.path.home.slice(1)}/installedPlugins/.data`
5052
];
5153
const debOptions = [
5254
'-t', 'deb',
@@ -59,6 +61,7 @@ export default (grunt) => {
5961
const args = [
6062
`${buildDir}/=${packages.path.home}/`,
6163
`${buildDir}/config/=${packages.path.conf}/`,
64+
`${buildDir}/installedPlugins/.data/=${packages.path.data}/`,
6265
`${servicesByName.sysv.outputDir}/etc/=/etc/`,
6366
`${servicesByName.systemd.outputDir}/lib/=/lib/`
6467
];

tasks/build/package_scripts/post_install.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ if ! user_check "<%= user %>" ; then
1515
user_create "<%= user %>"
1616
fi
1717
chown -R <%= user %>:<%= group %> <%= optimizeDir %>
18+
chown <%= user %>:<%= group %> <%= dataDir %>
19+
chown <%= user %>:<%= group %> <%= pluginsDir %>

tasks/build/package_scripts/post_remove.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,8 @@ if [ "$REMOVE_DIRS" = "true" ]; then
5959
if [ -d "<%= configDir %>" ]; then
6060
rmdir --ignore-fail-on-non-empty "<%= configDir %>"
6161
fi
62+
63+
if [ -d "<%= dataDir %>" ]; then
64+
rmdir --ignore-fail-on-non-empty "<%= dataDir %>"
65+
fi
6266
fi

tasks/config/packages.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export default (grunt) => {
1414

1515
const FOLDER_CONFIG = '/etc/kibana';
1616
const FOLDER_HOME = '/usr/share/kibana';
17+
const FOLDER_DATA = '/var/lib/kibana';
1718
const FOLDER_PLUGINS = `${FOLDER_HOME}/installedPlugins`;
1819

1920
const FILE_KIBANA_CONF = `${FOLDER_CONFIG}/kibana.yml`;
@@ -43,6 +44,7 @@ export default (grunt) => {
4344
version: VERSION,
4445
path: {
4546
conf: FOLDER_CONFIG,
47+
data: FOLDER_DATA,
4648
plugins: FOLDER_PLUGINS,
4749
home: FOLDER_HOME,
4850
kibanaBin: FILE_KIBANA_BINARY,

0 commit comments

Comments
 (0)