From 3a1d4ad0acd986f55b7da532878e842dd62a1237 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Tue, 5 Feb 2019 16:10:01 +0000 Subject: [PATCH] [build] Support for generating docker image (#28380) --- src/dev/build/build_distributables.js | 5 + src/dev/build/cli.js | 13 +- .../os_packages/create_os_package_tasks.js | 9 + .../os_packages/docker_generator/index.js | 20 ++ .../resources/bin/kibana-docker | 175 ++++++++++++++++++ .../tasks/os_packages/docker_generator/run.js | 99 ++++++++++ .../templates/build_docker_sh.template.js | 44 +++++ .../templates/dockerfile.template.js | 95 ++++++++++ .../docker_generator/templates/index.js | 22 +++ .../templates/kibana_yml.template.js | 39 ++++ src/dev/build/tasks/os_packages/index.js | 2 +- 11 files changed, 520 insertions(+), 3 deletions(-) create mode 100644 src/dev/build/tasks/os_packages/docker_generator/index.js create mode 100755 src/dev/build/tasks/os_packages/docker_generator/resources/bin/kibana-docker create mode 100644 src/dev/build/tasks/os_packages/docker_generator/run.js create mode 100644 src/dev/build/tasks/os_packages/docker_generator/templates/build_docker_sh.template.js create mode 100755 src/dev/build/tasks/os_packages/docker_generator/templates/dockerfile.template.js create mode 100644 src/dev/build/tasks/os_packages/docker_generator/templates/index.js create mode 100644 src/dev/build/tasks/os_packages/docker_generator/templates/kibana_yml.template.js diff --git a/src/dev/build/build_distributables.js b/src/dev/build/build_distributables.js index 0f4336535a078..7425565d585d9 100644 --- a/src/dev/build/build_distributables.js +++ b/src/dev/build/build_distributables.js @@ -34,6 +34,7 @@ import { CreateArchivesSourcesTask, CreateArchivesTask, CreateDebPackageTask, + CreateDockerPackageTask, CreateEmptyDirsAndFilesTask, CreateNoticeFileTask, CreatePackageJsonTask, @@ -64,6 +65,7 @@ export async function buildDistributables(options) { createArchives, createRpmPackage, createDebPackage, + createDockerPackage, versionQualifier, targetAllPlatforms, } = options; @@ -145,6 +147,9 @@ export async function buildDistributables(options) { if (createRpmPackage) { // control w/ --rpm or --skip-os-packages await run(CreateRpmPackageTask); } + if (createDockerPackage) { // control w/ --docker or --skip-os-packages + await run(CreateDockerPackageTask); + } /** * finalize artifacts by writing sha1sums of each into the target directory diff --git a/src/dev/build/cli.js b/src/dev/build/cli.js index d4a25ec98a56c..11c2ca5859134 100644 --- a/src/dev/build/cli.js +++ b/src/dev/build/cli.js @@ -39,6 +39,7 @@ const flags = getopts(process.argv.slice(0), { 'skip-os-packages', 'rpm', 'deb', + 'docker', 'release', 'skip-node-download', 'verbose', @@ -75,10 +76,11 @@ if (flags.help) { --oss {dim Only produce the OSS distributable of Kibana} --no-oss {dim Only produce the default distributable of Kibana} --skip-archives {dim Don't produce tar/zip archives} - --skip-os-packages {dim Don't produce rpm/deb packages} + --skip-os-packages {dim Don't produce rpm/deb/docker packages} --all-platforms {dim Produce archives for all platforms, not just this one} --rpm {dim Only build the rpm package} --deb {dim Only build the deb package} + --docker {dim Only build the docker image} --release {dim Produce a release-ready distributable} --version-qualifier {dim Suffix version with a qualifier} --skip-node-download {dim Reuse existing downloads of node.js} @@ -89,6 +91,12 @@ if (flags.help) { process.exit(1); } +// In order to build a docker image we always need +// to generate all the platforms +if (flags.docker) { + flags['all-platforms'] = true; +} + const log = new ToolingLog({ level: pickLevelFromFlags(flags, { default: flags.debug === false ? 'info' : 'debug' @@ -102,7 +110,7 @@ function isOsPackageDesired(name) { } // build all if no flags specified - if (flags.rpm === undefined && flags.deb === undefined) { + if (flags.rpm === undefined && flags.deb === undefined && flags.docker === undefined) { return true; } @@ -119,6 +127,7 @@ buildDistributables({ createArchives: !Boolean(flags['skip-archives']), createRpmPackage: isOsPackageDesired('rpm'), createDebPackage: isOsPackageDesired('deb'), + createDockerPackage: isOsPackageDesired('docker'), targetAllPlatforms: Boolean(flags['all-platforms']), }).catch(error => { if (!isErrorLogged(error)) { diff --git a/src/dev/build/tasks/os_packages/create_os_package_tasks.js b/src/dev/build/tasks/os_packages/create_os_package_tasks.js index a04f2b6f01ba0..0d64a766fbd07 100644 --- a/src/dev/build/tasks/os_packages/create_os_package_tasks.js +++ b/src/dev/build/tasks/os_packages/create_os_package_tasks.js @@ -18,6 +18,7 @@ */ import { runFpm } from './run_fpm'; +import { runDockerGenerator } from './docker_generator'; export const CreateDebPackageTask = { description: 'Creating deb package', @@ -40,3 +41,11 @@ export const CreateRpmPackageTask = { ]); } }; + +export const CreateDockerPackageTask = { + description: 'Creating docker package', + + async run(config, log, build) { + await runDockerGenerator(config, log, build); + } +}; diff --git a/src/dev/build/tasks/os_packages/docker_generator/index.js b/src/dev/build/tasks/os_packages/docker_generator/index.js new file mode 100644 index 0000000000000..9e0bbf51f9a56 --- /dev/null +++ b/src/dev/build/tasks/os_packages/docker_generator/index.js @@ -0,0 +1,20 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export * from './run'; diff --git a/src/dev/build/tasks/os_packages/docker_generator/resources/bin/kibana-docker b/src/dev/build/tasks/os_packages/docker_generator/resources/bin/kibana-docker new file mode 100755 index 0000000000000..dceb98736c83d --- /dev/null +++ b/src/dev/build/tasks/os_packages/docker_generator/resources/bin/kibana-docker @@ -0,0 +1,175 @@ +#!/bin/bash + +# Run Kibana, using environment variables to set longopts defining Kibana's +# configuration. +# +# eg. Setting the environment variable: +# +# ELASTICSEARCH_STARTUPTIMEOUT=60 +# +# will cause Kibana to be invoked with: +# +# --elasticsearch.startupTimeout=60 + +kibana_vars=( + console.enabled + console.proxyConfig + console.proxyFilter + elasticsearch.customHeaders + elasticsearch.hosts + elasticsearch.logQueries + elasticsearch.password + elasticsearch.pingTimeout + elasticsearch.preserveHost + elasticsearch.requestHeadersWhitelist + elasticsearch.requestTimeout + elasticsearch.shardTimeout + elasticsearch.sniffInterval + elasticsearch.sniffOnConnectionFault + elasticsearch.sniffOnStart + elasticsearch.ssl.certificate + elasticsearch.ssl.certificateAuthorities + elasticsearch.ssl.key + elasticsearch.ssl.keyPassphrase + elasticsearch.ssl.verificationMode + elasticsearch.startupTimeout + elasticsearch.username + i18n.locale + kibana.defaultAppId + kibana.index + logging.dest + logging.quiet + logging.silent + logging.useUTC + logging.verbose + map.includeElasticMapsService + ops.interval + path.data + pid.file + regionmap + regionmap.includeElasticMapsService + server.basePath + server.customResponseHeaders + server.defaultRoute + server.host + server.maxPayloadBytes + server.name + server.port + server.rewriteBasePath + server.ssl.cert + server.ssl.certificate + server.ssl.certificateAuthorities + server.ssl.cipherSuites + server.ssl.clientAuthentication + server.customResponseHeaders + server.ssl.enabled + server.ssl.key + server.ssl.keyPassphrase + server.ssl.redirectHttpFromPort + server.ssl.supportedProtocols + server.xsrf.whitelist + status.allowAnonymous + status.v6ApiFormat + tilemap.options.attribution + tilemap.options.maxZoom + tilemap.options.minZoom + tilemap.options.subdomains + tilemap.url + timelion.enabled + vega.enableExternalUrls + xpack.apm.enabled + xpack.apm.ui.enabled + xpack.canvas.enabled + xpack.graph.enabled + xpack.grokdebugger.enabled + xpack.infra.enabled + xpack.infra.query.partitionFactor + xpack.infra.query.partitionSize + xpack.infra.sources.default.fields.container + xpack.infra.sources.default.fields.host + xpack.infra.sources.default.fields.message + xpack.infra.sources.default.fields.pod + xpack.infra.sources.default.fields.tiebreaker + xpack.infra.sources.default.fields.timestamp + xpack.infra.sources.default.logAlias + xpack.infra.sources.default.metricAlias + xpack.ml.enabled + xpack.monitoring.elasticsearch.password + xpack.monitoring.elasticsearch.pingTimeout + xpack.monitoring.elasticsearch.hosts + xpack.monitoring.elasticsearch.username + xpack.monitoring.elasticsearch.ssl.certificateAuthorities + xpack.monitoring.elasticsearch.ssl.verificationMode + xpack.monitoring.enabled + xpack.monitoring.kibana.collection.enabled + xpack.monitoring.kibana.collection.interval + xpack.monitoring.max_bucket_size + xpack.monitoring.min_interval_seconds + xpack.monitoring.node_resolver + xpack.monitoring.report_stats + xpack.monitoring.elasticsearch.pingTimeout + xpack.monitoring.ui.container.elasticsearch.enabled + xpack.monitoring.ui.container.logstash.enabled + xpack.monitoring.ui.enabled + xpack.reporting.capture.browser.chromium.disableSandbox + xpack.reporting.capture.browser.chromium.proxy.enabled + xpack.reporting.capture.browser.chromium.proxy.server + xpack.reporting.capture.browser.chromium.proxy.bypass + xpack.reporting.capture.browser.type + xpack.reporting.capture.concurrency + xpack.reporting.capture.loadDelay + xpack.reporting.capture.settleTime + xpack.reporting.capture.timeout + xpack.reporting.csv.maxSizeBytes + xpack.reporting.enabled + xpack.reporting.encryptionKey + xpack.reporting.index + xpack.reporting.kibanaApp + xpack.reporting.kibanaServer.hostname + xpack.reporting.kibanaServer.port + xpack.reporting.kibanaServer.protocol + xpack.reporting.queue.indexInterval + xpack.reporting.queue.pollInterval + xpack.reporting.queue.timeout + xpack.reporting.roles.allow + xpack.searchprofiler.enabled + xpack.security.authProviders + xpack.security.cookieName + xpack.security.enabled + xpack.security.encryptionKey + xpack.security.secureCookies + xpack.security.sessionTimeout + xpack.xpack_main.telemetry.enabled +) + +longopts='' +for kibana_var in ${kibana_vars[*]}; do + # 'elasticsearch.hosts' -> 'ELASTICSEARCH_HOSTS' + env_var=$(echo ${kibana_var^^} | tr . _) + + # Indirectly lookup env var values via the name of the var. + # REF: http://tldp.org/LDP/abs/html/bashver2.html#EX78 + value=${!env_var} + if [[ -n $value ]]; then + longopt="--${kibana_var}=${value}" + longopts+=" ${longopt}" + fi +done + +# Files created at run-time should be group-writable, for Openshift's sake. +umask 0002 + +# The virtual file /proc/self/cgroup should list the current cgroup +# membership. For each hierarchy, you can follow the cgroup path from +# this file to the cgroup filesystem (usually /sys/fs/cgroup/) and +# introspect the statistics for the cgroup for the given +# hierarchy. Alas, Docker breaks this by mounting the container +# statistics at the root while leaving the cgroup paths as the actual +# paths. Therefore, Kibana provides a mechanism to override +# reading the cgroup path from /proc/self/cgroup and instead uses the +# cgroup path defined the configuration properties +# cpu.cgroup.path.override and cpuacct.cgroup.path.override. +# Therefore, we set this value here so that cgroup statistics are +# available for the container this process will run in. + +exec /usr/share/kibana/bin/kibana --cpu.cgroup.path.override=/ --cpuacct.cgroup.path.override=/ ${longopts} "$@" diff --git a/src/dev/build/tasks/os_packages/docker_generator/run.js b/src/dev/build/tasks/os_packages/docker_generator/run.js new file mode 100644 index 0000000000000..85cafad0b0eca --- /dev/null +++ b/src/dev/build/tasks/os_packages/docker_generator/run.js @@ -0,0 +1,99 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { access, link, unlink, chmod } from 'fs'; +import { resolve } from 'path'; +import { promisify } from 'util'; +import { write, copyAll, mkdirp, exec } from '../../../lib'; +import * as dockerTemplates from './templates'; + +const accessAsync = promisify(access); +const linkAsync = promisify(link); +const unlinkAsync = promisify(unlink); +const chmodAsync = promisify(chmod); + +export async function runDockerGenerator(config, log, build) { + const license = build.isOss() ? 'ASL 2.0' : 'Elastic License'; + const imageFlavor = build.isOss() ? '-oss' : ''; + const imageTag = 'docker.elastic.co/kibana/kibana'; + const versionTag = config.getBuildVersion(); + const artifactTarball = `kibana${ imageFlavor }-${ versionTag }-linux-x86_64.tar.gz`; + const artifactsDir = config.resolveFromTarget('.'); + const dockerBuildDir = config.resolveFromRepo('build', 'kibana-docker', build.isOss() ? 'oss' : 'default'); + const dockerOutputDir = config.resolveFromTarget(`kibana${ imageFlavor }-${ versionTag }-docker.tar.gz`); + + // Verify if we have the needed kibana target in order + // to build the kibana docker image. + // Also create the docker build target folder + // and delete the current linked target into the + // kibana docker build folder if we have one. + try { + await accessAsync(resolve(artifactsDir, artifactTarball)); + await mkdirp(dockerBuildDir); + await unlinkAsync(resolve(dockerBuildDir, artifactTarball)); + } catch (e) { + if (e && e.code === 'ENOENT' && e.syscall === 'access') { + throw new Error( + `Kibana linux target (${ artifactTarball }) is needed in order to build ${'' + }the docker image. None was found at ${ artifactsDir }` + ); + } + } + + // Create the kibana linux target inside the + // Kibana docker build + await linkAsync( + resolve(artifactsDir, artifactTarball), + resolve(dockerBuildDir, artifactTarball), + ); + + // Write all the needed docker config files + // into kibana-docker folder + const scope = { + artifactTarball, + imageFlavor, + versionTag, + license, + artifactsDir, + imageTag, + dockerOutputDir + }; + + for (const [, dockerTemplate] of Object.entries(dockerTemplates)) { + await write(resolve(dockerBuildDir, dockerTemplate.name), dockerTemplate.generator(scope)); + } + + // Copy all the needed resources into kibana-docker folder + // in order to build the docker image accordingly the dockerfile defined + // under templates/kibana_yml.template/js + await copyAll( + config.resolveFromRepo('src/dev/build/tasks/os_packages/docker_generator/resources'), + dockerBuildDir, + ); + + // Build docker image into the target folder + // In order to do this we just call the file we + // created from the templates/build_docker_sh.template.js + // and we just run that bash script + await chmodAsync(`${resolve(dockerBuildDir, 'build_docker.sh')}`, '755'); + await exec(log, `./build_docker.sh`, [], { + cwd: dockerBuildDir, + level: 'info', + }); +} diff --git a/src/dev/build/tasks/os_packages/docker_generator/templates/build_docker_sh.template.js b/src/dev/build/tasks/os_packages/docker_generator/templates/build_docker_sh.template.js new file mode 100644 index 0000000000000..59506402ff620 --- /dev/null +++ b/src/dev/build/tasks/os_packages/docker_generator/templates/build_docker_sh.template.js @@ -0,0 +1,44 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import dedent from 'dedent'; + +function generator({ imageTag, imageFlavor, versionTag, dockerOutputDir }) { + return dedent(` + #!/usr/bin/env bash + # + # ** THIS IS AN AUTO-GENERATED FILE ** + # + set -euo pipefail + + docker pull centos:7 + + echo "Building: kibana${ imageFlavor }-docker"; \\ + docker build -t ${ imageTag }${ imageFlavor }:${ versionTag } -f Dockerfile . || exit 1; + + docker save ${ imageTag }${ imageFlavor }:${ versionTag } | gzip -c > ${ dockerOutputDir } + + exit 0 + `); +} + +export const buildDockerSHTemplate = { + name: 'build_docker.sh', + generator, +}; diff --git a/src/dev/build/tasks/os_packages/docker_generator/templates/dockerfile.template.js b/src/dev/build/tasks/os_packages/docker_generator/templates/dockerfile.template.js new file mode 100755 index 0000000000000..4cbdca66d16e3 --- /dev/null +++ b/src/dev/build/tasks/os_packages/docker_generator/templates/dockerfile.template.js @@ -0,0 +1,95 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import dedent from 'dedent'; + +function generator({ artifactTarball, versionTag, license }) { + return dedent(` + # + # ** THIS IS AN AUTO-GENERATED FILE ** + # + + ################################################################################ + # Build stage 0 + # Extract Kibana and make various file manipulations. + ################################################################################ + FROM centos:7 AS prep_files + COPY ${ artifactTarball } /opt + RUN mkdir /usr/share/kibana + WORKDIR /usr/share/kibana + RUN tar --strip-components=1 -zxf /opt/${ artifactTarball } + # Ensure that group permissions are the same as user permissions. + # This will help when relying on GID-0 to run Kibana, rather than UID-1000. + # OpenShift does this, for example. + # REF: https://docs.openshift.org/latest/creating_images/guidelines.html + RUN chmod -R g=u /usr/share/kibana + RUN find /usr/share/kibana -type d -exec chmod g+s {} \\; + + ################################################################################ + # Build stage 1 + # Copy prepared files from the previous stage and complete the image. + ################################################################################ + FROM centos:7 + EXPOSE 5601 + + # Add Reporting dependencies. + RUN yum update -y && yum install -y fontconfig freetype && yum clean all + + # Bring in Kibana from the initial stage. + COPY --from=prep_files --chown=1000:0 /usr/share/kibana /usr/share/kibana + WORKDIR /usr/share/kibana + RUN ln -s /usr/share/kibana /opt/kibana + + ENV ELASTIC_CONTAINER true + ENV PATH=/usr/share/kibana/bin:$PATH + + # Set some Kibana configuration defaults. + COPY --chown=1000:0 config/kibana.yml /usr/share/kibana/config/kibana.yml + + # Add the launcher/wrapper script. It knows how to interpret environment + # variables and translate them to Kibana CLI options. + COPY --chown=1000:0 bin/kibana-docker /usr/local/bin/ + + # Ensure gid 0 write permissions for OpenShift. + RUN chmod g+ws /usr/share/kibana && \\ + find /usr/share/kibana -gid 0 -and -not -perm /g+w -exec chmod g+w {} \\; + + # Provide a non-root user to run the process. + RUN groupadd --gid 1000 kibana && \\ + useradd --uid 1000 --gid 1000 \\ + --home-dir /usr/share/kibana --no-create-home \\ + kibana + USER kibana + + LABEL org.label-schema.schema-version="1.0" \\ + org.label-schema.vendor="Elastic" \\ + org.label-schema.name="kibana" \\ + org.label-schema.version="${ versionTag }" \\ + org.label-schema.url="https://www.elastic.co/products/kibana" \\ + org.label-schema.vcs-url="https://github.com/elastic/kibana" \\ + license="${ license }" + + CMD ["/usr/local/bin/kibana-docker"] + `); +} + +export const dockerfileTemplate = { + name: 'Dockerfile', + generator, +}; diff --git a/src/dev/build/tasks/os_packages/docker_generator/templates/index.js b/src/dev/build/tasks/os_packages/docker_generator/templates/index.js new file mode 100644 index 0000000000000..fe76edbedb44e --- /dev/null +++ b/src/dev/build/tasks/os_packages/docker_generator/templates/index.js @@ -0,0 +1,22 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export { buildDockerSHTemplate } from './build_docker_sh.template'; +export { dockerfileTemplate } from './dockerfile.template'; +export { kibanaYMLTemplate } from './kibana_yml.template'; diff --git a/src/dev/build/tasks/os_packages/docker_generator/templates/kibana_yml.template.js b/src/dev/build/tasks/os_packages/docker_generator/templates/kibana_yml.template.js new file mode 100644 index 0000000000000..f52fc840929a9 --- /dev/null +++ b/src/dev/build/tasks/os_packages/docker_generator/templates/kibana_yml.template.js @@ -0,0 +1,39 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import dedent from 'dedent'; + +function generator({ imageFlavor }) { + return dedent(` + # + # ** THIS IS AN AUTO-GENERATED FILE ** + # + + # Default Kibana configuration for docker target + server.name: kibana + server.host: "0" + elasticsearch.hosts: [ "http://elasticsearch:9200" ] + ${ !imageFlavor ? 'xpack.monitoring.ui.container.elasticsearch.enabled: true' : '' } + `); +} + +export const kibanaYMLTemplate = { + name: 'config/kibana.yml', + generator, +}; diff --git a/src/dev/build/tasks/os_packages/index.js b/src/dev/build/tasks/os_packages/index.js index a616929e0196a..905b7568dc1c7 100644 --- a/src/dev/build/tasks/os_packages/index.js +++ b/src/dev/build/tasks/os_packages/index.js @@ -17,4 +17,4 @@ * under the License. */ -export { CreateRpmPackageTask, CreateDebPackageTask } from './create_os_package_tasks'; +export { CreateRpmPackageTask, CreateDebPackageTask, CreateDockerPackageTask } from './create_os_package_tasks';