From 3d01ec89b6e1e9d2e970136c350edca16da00d8b Mon Sep 17 00:00:00 2001 From: Marco Mambelli Date: Sun, 22 Dec 2024 11:57:27 -0600 Subject: [PATCH] Improved GWMS logserver support --- workspaces/compose-testbed.yml | 9 +- workspaces/compose.yml | 2 + .../factory-workspace/scripts/startup.sh | 2 +- .../frontend-workspace/scripts/startup.sh | 2 +- .../shared/scripts/logserver-startup.sh | 121 ++++++++++++++++++ .../scripts/install-glideinwms.sh | 16 ++- 6 files changed, 146 insertions(+), 6 deletions(-) create mode 100644 workspaces/shared/scripts/logserver-startup.sh diff --git a/workspaces/compose-testbed.yml b/workspaces/compose-testbed.yml index 6f59a19..80057bb 100644 --- a/workspaces/compose-testbed.yml +++ b/workspaces/compose-testbed.yml @@ -6,6 +6,7 @@ # IMAGE_NAMESPACE: 'glideinwms' # IMAGE_LABEL: 'latest' +# GWMS_PATH: 'gwms-dev-local' services: @@ -17,6 +18,8 @@ services: - ${IMAGE_NAMESPACE-glideinwms}/ce-workspace:${IMAGE_LABEL-latest} dockerfile: ce-workspace/Dockerfile image: ${IMAGE_NAMESPACE-glideinwms}/ce-workspace:${IMAGE_LABEL-latest} + volumes: + - ${GWMS_PATH-gwms-dev-local}:/opt/gwms networks: - gwms hostname: ce-workspace.glideinwms.org @@ -34,6 +37,7 @@ services: image: ${IMAGE_NAMESPACE-glideinwms}/testbed-workspace:${IMAGE_LABEL-latest} volumes: - gwms-tokens:/var/lib/gwms-factory/.condor/tokens.d + - ${GWMS_PATH-gwms-dev-local}:/opt/gwms networks: - gwms hostname: factory-workspace.glideinwms.org @@ -53,6 +57,7 @@ services: image: ${IMAGE_NAMESPACE-glideinwms}/testbed-workspace:${IMAGE_LABEL-latest} volumes: - gwms-tokens:/var/lib/gwms-frontend/.condor/tokens.d + - ${GWMS_PATH-gwms-dev-local}:/opt/gwms networks: - gwms hostname: frontend-workspace.glideinwms.org @@ -64,11 +69,11 @@ services: volumes: - + gwms-dev-local: + driver: local gwms-tokens: driver: local networks: - gwms: driver: bridge diff --git a/workspaces/compose.yml b/workspaces/compose.yml index a279279..4d4e03e 100644 --- a/workspaces/compose.yml +++ b/workspaces/compose.yml @@ -15,6 +15,8 @@ services: - ${IMAGE_NAMESPACE-glideinwms}/ce-workspace:${IMAGE_LABEL-latest} dockerfile: ce-workspace/Dockerfile image: ${IMAGE_NAMESPACE-glideinwms}/ce-workspace:${IMAGE_LABEL-latest} + volumes: + - ${GWMS_PATH-gwms-dev-local}:/opt/gwms networks: - gwms hostname: ce-workspace.glideinwms.org diff --git a/workspaces/factory-workspace/scripts/startup.sh b/workspaces/factory-workspace/scripts/startup.sh index e1aabbb..3e325bc 100755 --- a/workspaces/factory-workspace/scripts/startup.sh +++ b/workspaces/factory-workspace/scripts/startup.sh @@ -52,9 +52,9 @@ if $FULL_STARTUP; then systemctl start httpd # PHP may be used by the logserver if [[ -f /etc/php-fpm.conf ]]; then - systemctl start start php-fpm # the container systemd imitation cannot receive messages echo "systemd_interval = 0" >> /etc/php-fpm.conf + systemctl start php-fpm if [[ -f /var/lib/gwms-logserver/composer.json ]]; then pushd /var/lib/gwms-logserver/ if ! composer install; then diff --git a/workspaces/frontend-workspace/scripts/startup.sh b/workspaces/frontend-workspace/scripts/startup.sh index e14e73c..0302b10 100755 --- a/workspaces/frontend-workspace/scripts/startup.sh +++ b/workspaces/frontend-workspace/scripts/startup.sh @@ -51,9 +51,9 @@ if $FULL_STARTUP; then systemctl start httpd # PHP may be used by the logserver if [[ -f /etc/php-fpm.conf ]]; then - systemctl start start php-fpm # the container systemd imitation cannot receive messages echo "systemd_interval = 0" >> /etc/php-fpm.conf + systemctl start php-fpm if [[ -f /var/lib/gwms-logserver/composer.json ]]; then pushd /var/lib/gwms-logserver/ if ! composer install; then diff --git a/workspaces/shared/scripts/logserver-startup.sh b/workspaces/shared/scripts/logserver-startup.sh new file mode 100644 index 0000000..aee601e --- /dev/null +++ b/workspaces/shared/scripts/logserver-startup.sh @@ -0,0 +1,121 @@ +#!/usr/bin/bash + +# SPDX-FileCopyrightText: 2020 Fermi Research Alliance, LLC +# SPDX-License-Identifier: Apache-2.0 + +# Install, setup, and start on EL9 the GlideinWMS Logserver +# This assumes a GlideinWMS Factory is already installed + + +### INTRO ### + +# Environment +OSG_REPO= +GWMS_REPO=osg-development +CHECK_ONLY=false +GWMS_USE_BUILD=false +# Outside mounted directory with shared files +GWMS_DIR=/opt/gwms + +help(){ + cat <> /etc/php-fpm.conf + pushd /var/lib/gwms-logserver/ + if ! composer install; then + # running a second time because the first frequently times out + composer install + fi + popd + +} +start(){ + # Start + + systemctl start php-fpm + /sbin/service httpd reload > /dev/null 2>&1 || true + systemctl enable httpd php-fpm +} + + +### MAIN ### + + +if $CHECK_ONLY; then + echo "Listing available GlideinWMS Logserver packages and aborting" + yum list --enablerepo="$GWMS_REPO" glideinwms-logserver + exit 0 +fi +install +check +setup +start diff --git a/workspaces/testbed-workspace/scripts/install-glideinwms.sh b/workspaces/testbed-workspace/scripts/install-glideinwms.sh index fc1edf6..78fb8e0 100755 --- a/workspaces/testbed-workspace/scripts/install-glideinwms.sh +++ b/workspaces/testbed-workspace/scripts/install-glideinwms.sh @@ -13,6 +13,7 @@ OSG_VERSION=24 OSG_REPO= GWMS_REPO=osg-development GWMS_SW= +GWMS_LOGSERVER=false CHECK_ONLY=false GWMS_USE_BUILD=false # Outside mounted directory with shared files @@ -27,6 +28,7 @@ Install the EL9 version of the specified GlideinWMS software --osg-version OSG_VERSION Set the OSG version, e.g. 24 (default), 23 --factory Install the Factory --frontend Install the Frontend +--logserver Add a Log server to the Factory (only if installing the Factory) --check-only Only print the available RPMs (no install and set up) --use-build Use the build-workspace container as YUM repo You cannot set both --factory and --frontend. If none is set the script tries to guess from the hostname @@ -60,6 +62,9 @@ while [ -n "$1" ];do --frontend) GWMS_SW=vofrontend ;; + --logserver) + GWMS_LOGSERVER=true + ;; *) echo "Parameter '$1' is not supported." help @@ -86,7 +91,10 @@ if [[ -z "$OSG_REPO" ]]; then fi if $GWMS_USE_BUILD; then - wget http://build-workspace.glideinwms.org/repo/build.repo -O /etc/yum.repos.d/build.repo + # Install and setup the build server YUM repo + if [[ ! -f /etc/yum.repos.d/build.repo ]]; then + wget http://build-workspace.glideinwms.org/repo/build.repo -O /etc/yum.repos.d/build.repo + fi GWMS_REPO="gwms-build" fi @@ -112,6 +120,10 @@ install_sw(){ # sudo is required by the run-test script dnf install -y sudo fi + # For now the example logserver is supported on the Factory + if [[ "$GWMS_LOGSERVER" && "$GWMS_SW" = factory ]]; then + dnf install -y --enablerepo="$GWMS_REPO" glideinwms-logserver + fi } @@ -166,8 +178,8 @@ start_common(){ start_logserver(){ # Will start only if installed if [[ -f /etc/php-fpm.conf ]]; then - systemctl start start php-fpm echo "systemd_interval = 0" >> /etc/php-fpm.conf + systemctl start php-fpm if [[ -f /var/lib/gwms-logserver/composer.json ]]; then pushd /var/lib/gwms-logserver/ if ! composer install; then