From dc8f435766496435405d7a92978ad2aa363733e4 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Tue, 14 Sep 2021 11:20:10 -0500 Subject: [PATCH] =?UTF-8?q?Revert=20"[deb/rpm]=20Generate=20os=20package?= =?UTF-8?q?=20specific=20kibana.yml=20(#98213)=20(#=E2=80=A6=20(#111966)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 5d0065f736e4f549b483fc14acd8fd4db5459270. --- src/dev/build/build_distributables.ts | 4 -- .../create_os_package_kibana_yml.ts | 50 ------------------- .../os_packages/create_os_package_tasks.ts | 9 ---- src/dev/build/tasks/os_packages/run_fpm.ts | 1 - .../systemd/etc/systemd/system/kibana.service | 2 +- 5 files changed, 1 insertion(+), 65 deletions(-) delete mode 100644 src/dev/build/tasks/os_packages/create_os_package_kibana_yml.ts diff --git a/src/dev/build/build_distributables.ts b/src/dev/build/build_distributables.ts index 39a62c1fd35dc..315f9270e785e 100644 --- a/src/dev/build/build_distributables.ts +++ b/src/dev/build/build_distributables.ts @@ -106,10 +106,6 @@ export async function buildDistributables(log: ToolingLog, options: BuildOptions // control w/ --skip-archives await run(Tasks.CreateArchives); } - - if (options.createDebPackage || options.createRpmPackage) { - await run(Tasks.CreatePackageConfig); - } if (options.createDebPackage) { // control w/ --deb or --skip-os-packages await run(Tasks.CreateDebPackage); diff --git a/src/dev/build/tasks/os_packages/create_os_package_kibana_yml.ts b/src/dev/build/tasks/os_packages/create_os_package_kibana_yml.ts deleted file mode 100644 index e7137ada02182..0000000000000 --- a/src/dev/build/tasks/os_packages/create_os_package_kibana_yml.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { readFileSync, writeFileSync } from 'fs'; -import { resolve } from 'path'; -import { Build, Config, mkdirp } from '../../lib'; - -export async function createOSPackageKibanaYML(config: Config, build: Build) { - const configReadPath = config.resolveFromRepo('config', 'kibana.yml'); - const configWriteDir = config.resolveFromRepo('build', 'os_packages', 'config'); - const configWritePath = resolve(configWriteDir, 'kibana.yml'); - - await mkdirp(configWriteDir); - - let kibanaYML = readFileSync(configReadPath, { encoding: 'utf8' }); - - [ - [/#pid.file:.*/g, 'pid.file: /run/kibana/kibana.pid'], - [/#logging.dest:.*/g, 'logging.dest: /var/log/kibana/kibana.log'], - ].forEach((options) => { - const [regex, setting] = options; - const diff = kibanaYML; - const match = kibanaYML.search(regex) >= 0; - if (match) { - if (typeof setting === 'string') { - kibanaYML = kibanaYML.replace(regex, setting); - } - } - - if (!diff.localeCompare(kibanaYML)) { - throw new Error( - `OS package configuration unmodified. Verify match for ${regex} is available` - ); - } - }); - - try { - writeFileSync(configWritePath, kibanaYML, { flag: 'wx' }); - } catch (err) { - if (err.code === 'EEXIST') { - return; - } - throw err; - } -} diff --git a/src/dev/build/tasks/os_packages/create_os_package_tasks.ts b/src/dev/build/tasks/os_packages/create_os_package_tasks.ts index ab9a7ce65cbc6..0a6faa2e95fa1 100644 --- a/src/dev/build/tasks/os_packages/create_os_package_tasks.ts +++ b/src/dev/build/tasks/os_packages/create_os_package_tasks.ts @@ -9,15 +9,6 @@ import { Task } from '../../lib'; import { runFpm } from './run_fpm'; import { runDockerGenerator } from './docker_generator'; -import { createOSPackageKibanaYML } from './create_os_package_kibana_yml'; - -export const CreatePackageConfig: Task = { - description: 'Creating OS package kibana.yml', - - async run(config, log, build) { - await createOSPackageKibanaYML(config, build); - }, -}; export const CreateDebPackage: Task = { description: 'Creating deb package', diff --git a/src/dev/build/tasks/os_packages/run_fpm.ts b/src/dev/build/tasks/os_packages/run_fpm.ts index b991c6e36d285..aaf8c31b3ce08 100644 --- a/src/dev/build/tasks/os_packages/run_fpm.ts +++ b/src/dev/build/tasks/os_packages/run_fpm.ts @@ -125,7 +125,6 @@ export async function runFpm( `${resolveWithTrailingSlash(fromBuild('.'))}=/usr/share/kibana/`, // copy the config directory to /etc/kibana - `${config.resolveFromRepo('build/os_packages/config/kibana.yml')}=/etc/kibana/kibana.yml`, `${resolveWithTrailingSlash(fromBuild('config'))}=/etc/kibana/`, // copy the data directory at /var/lib/kibana diff --git a/src/dev/build/tasks/os_packages/service_templates/systemd/etc/systemd/system/kibana.service b/src/dev/build/tasks/os_packages/service_templates/systemd/etc/systemd/system/kibana.service index df33b82f1f967..7a1508d91b213 100644 --- a/src/dev/build/tasks/os_packages/service_templates/systemd/etc/systemd/system/kibana.service +++ b/src/dev/build/tasks/os_packages/service_templates/systemd/etc/systemd/system/kibana.service @@ -15,7 +15,7 @@ Environment=KBN_PATH_CONF=/etc/kibana EnvironmentFile=-/etc/default/kibana EnvironmentFile=-/etc/sysconfig/kibana -ExecStart=/usr/share/kibana/bin/kibana +ExecStart=/usr/share/kibana/bin/kibana --logging.dest="/var/log/kibana/kibana.log" --pid.file="/run/kibana/kibana.pid" Restart=on-failure RestartSec=3