Fixing Binaries for Deployment

- Fixed the way the config parses the plugins
- Fixed scripts to load config from the right place in production
This commit is contained in:
Chris Cowan 2015-01-16 11:35:46 -07:00
parent 0bbcef13b6
commit 33559850c1
10 changed files with 30 additions and 11 deletions

View file

@ -5,13 +5,13 @@ SETLOCAL
set SCRIPT_DIR=%~dp0
for %%I in ("%SCRIPT_DIR%..") do set DIR=%%~dpfI
set NODE=%FULL_PATH%\node\node.exe
set SERVER=%DIR%/src/bin/kibana.js
set NODE=%DIR%\node\node.exe
set SERVER=%DIR%\src\bin\kibana.js
set NODE_ENV="production"
TITLE Kibana Server @@version
%NODE% %SERVER%
%NODE% %SERVER% --config %DIR%\config\kibana.yml
:finally

View file

@ -17,5 +17,5 @@ DIR=$(dirname "${SCRIPT}")/..
NODE=${DIR}/node/bin/node
SERVER=${DIR}/src/bin/kibana.js
NODE_ENV="production" exec "${NODE}" ${SERVER}
NODE_ENV="production" exec "${NODE}" ${SERVER} --config ${DIR}/config/kibana.yml

View file

@ -11,7 +11,7 @@ var env = process.env.NODE_ENV || 'development';
// the NPM module. If it's not there then we are running in the git root.
var public_folder = path.resolve(__dirname, '..', 'public');
try {
fs.fstatSync(public_folder);
fs.statSync(public_folder);
} catch (err) {
public_folder = path.resolve(__dirname, '..', '..', 'kibana');
}

View file

@ -11,8 +11,9 @@ var plugins = function (dir) {
};
module.exports = function (config) {
var bundled_plugin_ids = config.kibana.bundled_plugin_ids || [];
var bundled_plugins = plugins(config.bundled_plugins_folder);
var external_plugins = plugins(config.external_plugins_folder);
return bundled_plugins.concat(external_plugins);
return bundled_plugin_ids.concat(bundled_plugins, external_plugins);
};

View file

@ -12,7 +12,8 @@ router.get('/config', function (req, res, next) {
'elasticsearch_url',
'elasticsearch_username',
'elasticsearch_password',
'elasticsearch_preserve_host'
'elasticsearch_preserve_host',
'bundled_plugin_ids'
];
var data = _.omit(config.kibana, excludedKeys);
data.plugins = config.plugins;

View file

@ -20,6 +20,7 @@ module.exports = function (grunt) {
'copy:plugin_readme',
'describe_bundled_plugins',
'npm_install_kibana',
'clean:test_from_node_modules',
'download_node_binaries',
'copy:versioned_dist',
'create_packages'

View file

@ -28,6 +28,7 @@ module.exports = function (grunt) {
'<%= app %>/public/{css-builder,normalize}.js'
]
},
dev_only_plugins: '<%= build %>/src/plugins/<%= devPlugins %>'
dev_only_plugins: '<%= build %>/src/plugins/<%= devPlugins %>',
test_from_node_modules: '<%= build %>/dist/kibana/src/node_modules/**/*test*'
};
};

View file

@ -20,6 +20,10 @@ module.exports = function (grunt) {
var tgzCmd = 'tar -zcf ' + archiveName + '.tar.gz ' + name;
var zipCmd = 'zip -rq ' + archiveName + '.zip ' + name;
if (platform === 'windows') {
zipCmd = 'zip -rq -ll ' + archiveName + '.zip ' + name;
}
return mkdirp.mkdirpAsync(target)
.then(function (arg) {
return exec(tgzCmd, options);

View file

@ -16,14 +16,21 @@ module.exports = function (grunt) {
var buildPath = grunt.config.get('build');
var version = grunt.config.get('nodeVersion');
var handle404 = function (response) {
if (response.statusCode !== 200) {
throw new Error(response.request.href + ' failed with a ' + response.statusCode);
}
};
var downloadWindows = function (cb) {
var dest = join(buildPath, 'node_binaries', 'windows');
var url = urlPattern({ version: version, file: 'nodex.exe'});
var url = urlPattern({ version: version, file: 'node.exe'});
mkdirp(dest, function (err) {
if (err) return cb(err);
var out = fs.createWriteStream(join(dest, 'node.exe'));
out.on('close', cb).on('error', cb);
var req = request.get(url);
req.on('response', handle404);
req.pipe(out);
});
};
@ -38,6 +45,7 @@ module.exports = function (grunt) {
var out = tar.Extract({ path: dest, strip: 1 });
out.on('close', cb).on('error', cb);
var req = request.get(url);
req.on('response', handle404);
req.pipe(unzip).pipe(out);
});
};

View file

@ -1,3 +1,4 @@
var os = require('os');
module.exports = function (grunt) {
grunt.registerTask('run_build', [
'build',
@ -7,12 +8,14 @@ module.exports = function (grunt) {
'wait:built_kibana'
]);
var arch = os.arch();
var platform = os.platform();
var join = require('path').join;
var extract = require('./utils/spawn')(
'tar',
[
'-xzf',
grunt.config.process('<%= pkg.name %>-<%= pkg.version %>.tar.gz')
grunt.config.process('<%= pkg.name %>-<%= pkg.version %>-' + platform + '-' + arch + '.tar.gz')
],
join(__dirname, '../target')
);
@ -24,4 +27,4 @@ module.exports = function (grunt) {
grunt.registerTask('_open_built_kibana', function () {
require('opn')('http://localhost:5601');
});
};
};