Skip to content

Commit

Permalink
Improved GWMS logserver support
Browse files Browse the repository at this point in the history
  • Loading branch information
mambelli committed Dec 26, 2024
1 parent faaa3fb commit 1055570
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 6 deletions.
9 changes: 7 additions & 2 deletions workspaces/compose-testbed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

# IMAGE_NAMESPACE: 'glideinwms'
# IMAGE_LABEL: 'latest'
# GWMS_PATH: 'gwms-dev-local'

services:

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -64,11 +69,11 @@ services:


volumes:

gwms-dev-local:
driver: local
gwms-tokens:
driver: local

networks:

gwms:
driver: bridge
2 changes: 2 additions & 0 deletions workspaces/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion workspaces/factory-workspace/scripts/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion workspaces/frontend-workspace/scripts/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
121 changes: 121 additions & 0 deletions workspaces/shared/scripts/logserver-startup.sh
Original file line number Diff line number Diff line change
@@ -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 <<EOF
$0 [options]
Install the EL9 version of the GlideinWMS Logserver
--osg-repo OSG_REPO Set the repository for the OSG osg-ca-certs, e.g. osg-development, osg (defaults to GWMS_REPO)
--gwms-repo GWMS_REPO Set the GlideinWMS repository, e.g. osg-development (default), osg, upcoming-development
--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
EOF
}

# Argument parser
while [ -n "$1" ];do
case "$1" in
--osg-repo)
OSG_REPO="$2"
shift
;;
--gwms-repo)
GWMS_REPO="$2"
shift
;;
--use-build)
GWMS_USE_BUILD=true
;;
--check-only)
CHECK_ONLY=true
;;
*)
echo "Parameter '$1' is not supported."
help
exit 1
esac
shift
done

if [[ -z "$OSG_REPO" ]]; then
OSG_REPO="$GWMS_REPO"
fi

if $GWMS_USE_BUILD; then
# 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


install(){
# Install the Logserver

dnf install -y --enablerepo="$GWMS_REPO" glideinwms-logserver
}

check(){
# Check if important installation steps worked OK

if [[ ! -f /etc/php-fpm.conf ]]; then
echo "php-fpm seems not installed. Aborting."
exit 1
fi
if [[ ! -f /var/lib/gwms-logserver/composer.json ]]; then
echo "php dependencies (composer configuration) not installed. Aborting."
exit 1
fi
}

setup(){
# Setup

echo "systemd_interval = 0" >> /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
16 changes: 14 additions & 2 deletions workspaces/testbed-workspace/scripts/install-glideinwms.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -60,6 +62,9 @@ while [ -n "$1" ];do
--frontend)
GWMS_SW=vofrontend
;;
--logserver)
GWMS_LOGSERVER=true
;;
*)
echo "Parameter '$1' is not supported."
help
Expand All @@ -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

Expand All @@ -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
}


Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1055570

Please sign in to comment.