From 63b938402eb7d9c33cb87e772f6b756e4e4210c5 Mon Sep 17 00:00:00 2001 From: Cole White <42356806+shdubsh@users.noreply.github.com> Date: Mon, 26 Apr 2021 10:20:01 -0600 Subject: [PATCH] [BUILD]Rename files on disk needed for systemd and service start. (#302) The Debian packages build ok with fpm, but installing it fails due to an invalid username and group name (see useradd(8): CAVEATS). Once this was fixed, the service failed to start due to parts of the startup configuration wanting files that did not exist on disk. Files renamed to where systemd expects and runtime username and group name changed to a supported form. Tested on Debian 10. Signed-off-by: Cole White --- src/dev/build/tasks/os_packages/run_fpm.ts | 4 ++-- ...rch_dashboards.service => opensearch-dashboards.service} | 4 ++-- ...pensearch_dashboards.conf => opensearch-dashboards.conf} | 0 .../{opensearch_dashboards => opensearch-dashboards} | 6 +++--- .../init.d/{opensearch_dashboards => opensearch-dashboards} | 0 5 files changed, 7 insertions(+), 7 deletions(-) rename src/dev/build/tasks/os_packages/service_templates/systemd/etc/systemd/system/{opensearch_dashboards.service => opensearch-dashboards.service} (90%) rename src/dev/build/tasks/os_packages/service_templates/systemd/usr/lib/tmpfiles.d/{opensearch_dashboards.conf => opensearch-dashboards.conf} (100%) rename src/dev/build/tasks/os_packages/service_templates/sysv/etc/default/{opensearch_dashboards => opensearch-dashboards} (73%) rename src/dev/build/tasks/os_packages/service_templates/sysv/etc/init.d/{opensearch_dashboards => opensearch-dashboards} (100%) diff --git a/src/dev/build/tasks/os_packages/run_fpm.ts b/src/dev/build/tasks/os_packages/run_fpm.ts index 8ae975d80a93..0c74ab979863 100644 --- a/src/dev/build/tasks/os_packages/run_fpm.ts +++ b/src/dev/build/tasks/os_packages/run_fpm.ts @@ -103,9 +103,9 @@ export async function runFpm( // define template values that will be injected into the install/uninstall // scripts, also causes scripts to be processed with erb '--template-value', - `user=opensearchDashboards`, + `user=opensearch-dashboards`, '--template-value', - `group=opensearchDashboards`, + `group=opensearch-dashboards`, '--template-value', `optimizeDir=/usr/share/opensearch-dashboards/optimize`, '--template-value', diff --git a/src/dev/build/tasks/os_packages/service_templates/systemd/etc/systemd/system/opensearch_dashboards.service b/src/dev/build/tasks/os_packages/service_templates/systemd/etc/systemd/system/opensearch-dashboards.service similarity index 90% rename from src/dev/build/tasks/os_packages/service_templates/systemd/etc/systemd/system/opensearch_dashboards.service rename to src/dev/build/tasks/os_packages/service_templates/systemd/etc/systemd/system/opensearch-dashboards.service index 99dfd0f2e3f2..5b31374b9427 100644 --- a/src/dev/build/tasks/os_packages/service_templates/systemd/etc/systemd/system/opensearch_dashboards.service +++ b/src/dev/build/tasks/os_packages/service_templates/systemd/etc/systemd/system/opensearch-dashboards.service @@ -3,8 +3,8 @@ Description=OpenSearch Dashboards [Service] Type=simple -User=opensearchDashboards -Group=opensearchDashboards +User=opensearch-dashboards +Group=opensearch-dashboards # Load env vars from /etc/default/ and /etc/sysconfig/ if they exist. # Prefixing the path with '-' makes it try to load, but if the file doesn't # exist, it continues onward. diff --git a/src/dev/build/tasks/os_packages/service_templates/systemd/usr/lib/tmpfiles.d/opensearch_dashboards.conf b/src/dev/build/tasks/os_packages/service_templates/systemd/usr/lib/tmpfiles.d/opensearch-dashboards.conf similarity index 100% rename from src/dev/build/tasks/os_packages/service_templates/systemd/usr/lib/tmpfiles.d/opensearch_dashboards.conf rename to src/dev/build/tasks/os_packages/service_templates/systemd/usr/lib/tmpfiles.d/opensearch-dashboards.conf diff --git a/src/dev/build/tasks/os_packages/service_templates/sysv/etc/default/opensearch_dashboards b/src/dev/build/tasks/os_packages/service_templates/sysv/etc/default/opensearch-dashboards similarity index 73% rename from src/dev/build/tasks/os_packages/service_templates/sysv/etc/default/opensearch_dashboards rename to src/dev/build/tasks/os_packages/service_templates/sysv/etc/default/opensearch-dashboards index 55ae00120a41..f2813224df29 100644 --- a/src/dev/build/tasks/os_packages/service_templates/sysv/etc/default/opensearch_dashboards +++ b/src/dev/build/tasks/os_packages/service_templates/sysv/etc/default/opensearch-dashboards @@ -1,5 +1,5 @@ -user="opensearchDashboards" -group="opensearchDashboards" +user="opensearch-dashboards" +group="opensearch-dashboards" chroot="/" chdir="/" nice="" @@ -10,4 +10,4 @@ nice="" # The default behavior is to simply log a message "program stop failed; still running" KILL_ON_STOP_TIMEOUT=0 -OSD_PATH_CONF="/etc/opensearch_dashboards" +OSD_PATH_CONF="/etc/opensearch-dashboards" diff --git a/src/dev/build/tasks/os_packages/service_templates/sysv/etc/init.d/opensearch_dashboards b/src/dev/build/tasks/os_packages/service_templates/sysv/etc/init.d/opensearch-dashboards similarity index 100% rename from src/dev/build/tasks/os_packages/service_templates/sysv/etc/init.d/opensearch_dashboards rename to src/dev/build/tasks/os_packages/service_templates/sysv/etc/init.d/opensearch-dashboards