Skip to content

Commit

Permalink
[build] Add data directory that plugins can write to. Closes elastic#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jbudz committed Jun 16, 2016
1 parent 6b98215 commit 5b19534
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 1 deletion.
Empty file removed installedPlugins/.empty
Empty file.
1 change: 1 addition & 0 deletions tasks/build/installed_plugins.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = function (grunt) {
grunt.registerTask('_build:installedPlugins', function () {
grunt.file.mkdir('build/kibana/installedPlugins');
grunt.file.mkdir('build/kibana/installedPlugins/.data');
});
};
5 changes: 4 additions & 1 deletion tasks/build/os_packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ export default (grunt) => {
'--template-value', `optimizeDir=${packages.path.home}/optimize`,
'--template-value', `configDir=${packages.path.conf}`,
'--template-value', `pluginsDir=${packages.path.plugins}`,
'--template-value', `dataDir=${packages.path.data}`,
//config folder is moved to path.conf, exclude {path.home}/config
//uses relative path to --prefix, strip the leading /
'--exclude', `${packages.path.home.slice(1)}/config`
'--exclude', `${packages.path.home.slice(1)}/config`,
'--exclude', `${packages.path.home.slice(1)}/installedPlugins/.data`
];
const debOptions = [
'-t', 'deb',
Expand All @@ -59,6 +61,7 @@ export default (grunt) => {
const args = [
`${buildDir}/=${packages.path.home}/`,
`${buildDir}/config/=${packages.path.conf}/`,
`${buildDir}/installedPlugins/.data/=${packages.path.data}/`,
`${servicesByName.sysv.outputDir}/etc/=/etc/`,
`${servicesByName.systemd.outputDir}/lib/=/lib/`
];
Expand Down
2 changes: 2 additions & 0 deletions tasks/build/package_scripts/post_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ if ! user_check "<%= user %>" ; then
user_create "<%= user %>"
fi
chown -R <%= user %>:<%= group %> <%= optimizeDir %>
chown <%= user %>:<%= group %> <%= dataDir %>
chown <%= user %>:<%= group %> <%= pluginsDir %>
4 changes: 4 additions & 0 deletions tasks/build/package_scripts/post_remove.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,8 @@ if [ "$REMOVE_DIRS" = "true" ]; then
if [ -d "<%= configDir %>" ]; then
rmdir --ignore-fail-on-non-empty "<%= configDir %>"
fi

if [ -d "<%= dataDir %>" ]; then
rmdir --ignore-fail-on-non-empty "<%= dataDir %>"
fi
fi
2 changes: 2 additions & 0 deletions tasks/config/packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default (grunt) => {

const FOLDER_CONFIG = '/etc/kibana';
const FOLDER_HOME = '/usr/share/kibana';
const FOLDER_DATA = '/var/lib/kibana';
const FOLDER_PLUGINS = `${FOLDER_HOME}/installedPlugins`;

const FILE_KIBANA_CONF = `${FOLDER_CONFIG}/kibana.yml`;
Expand Down Expand Up @@ -43,6 +44,7 @@ export default (grunt) => {
version: VERSION,
path: {
conf: FOLDER_CONFIG,
data: FOLDER_DATA,
plugins: FOLDER_PLUGINS,
home: FOLDER_HOME,
kibanaBin: FILE_KIBANA_BINARY,
Expand Down

0 comments on commit 5b19534

Please sign in to comment.