diff --git a/.github/workflows/loading-gs64-components.yml b/.github/workflows/loading-gs64-components.yml index df51ad2..aaef00d 100644 --- a/.github/workflows/loading-gs64-components.yml +++ b/.github/workflows/loading-gs64-components.yml @@ -11,6 +11,7 @@ jobs: matrix: load-spec: - Deployment + - Dependent-SUnit-Extensions name: GS64 + ${{ matrix.load-spec }} steps: - uses: actions/checkout@v3 diff --git a/docker/gs64/Dockerfile b/docker/gs64/Dockerfile index 9471368..935fcf0 100644 --- a/docker/gs64/Dockerfile +++ b/docker/gs64/Dockerfile @@ -2,8 +2,9 @@ FROM ghcr.io/ba-st/gs64-gem:v3.7.0 COPY --chown=gemstone:users ./launchpad* ./ COPY --chown=gemstone:users ./command-line-handler.tpz ./command-line-handler.tpz +USER root RUN set -eu; \ ln -s /opt/gemstone/launchpad /usr/local/bin/launchpad; \ - ln -s /opt/gemstone/launchpad-gem /usr/local/bin/launchpad-gem; \ chmod a+x /usr/local/bin/launchpad*; \ true +USER ${GS_USER} diff --git a/docker/gs64/launchpad b/docker/gs64/launchpad index 6ec4325..1748a56 100755 --- a/docker/gs64/launchpad +++ b/docker/gs64/launchpad @@ -1,19 +1,45 @@ #!/usr/bin/env bash -echo "${NETLDI_SERVICE_NAME} ${NETLDI_PORT}/tcp # GemStone - Netldi" >> /etc/services - -# Ensure write permissions -NEED_WRITE_PERMISSION=( - "${GEMSTONE_GLOBAL_DIR}/locks/" - "${GEMSTONE_LOG_DIR}/" -) - -for path in "${NEED_WRITE_PERMISSION[@]}"; do - if ! gosu "${GS_USER}" test -w "$path"; then - chown "${GS_UID}:${GS_GID}" "$path" - chmod ug+w "$path" +# Prepare Launchpad topaz input script +readonly SYSTEM_USER_PASSWORD="${GS64_SYSTEM_USER_PASSWORD:-swordfish}" +readonly STONE_NAME="${GS64_STONE_SERVICE_NAME:-gs64stone}" + +set -e +readonly LAUNCHPAD_TOPAZ_SCRIPT="${GEMSTONE_GLOBAL_DIR}/launchpad-start.tpz" +set +o histexpand +echo "set gemstone !@${GS64_STONE_HOSTNAME}!${STONE_NAME} user SystemUser pass ${SYSTEM_USER_PASSWORD}" >> "${LAUNCHPAD_TOPAZ_SCRIPT}" +set -o histexpand + +pid=0 + +termination_handler() { + exit_status=0 + if [ $pid -ne 0 ]; then + echo 'SIGTERM received, shutting down the gem' + kill "$pid" + stopnetldi + wait "$pid" + exit_status=$? fi -done + exit "$exit_status" +} + +trap 'termination_handler' SIGTERM + +# shellcheck disable=SC2086 +startnetldi \ + -g \ + -a "${GS_USER}" \ + -n \ + -P "${NETLDI_PORT}" \ + -l "${GEMSTONE_LOG_DIR}/${NETLDI_SERVICE_NAME}.log" \ + -D "${GEMSTONE_LOG_DIR}" \ + ${NETLDI_ARGS:-} \ + "${NETLDI_SERVICE_NAME}" >> "${GEMSTONE_LOG_DIR}/startnetldi.log" + +# list GemStone services +gslist -cvl >> "${GEMSTONE_LOG_DIR}/startnetldi.log" -# Run as GS_USER -exec gosu "${GS_USER}" "${GEMSTONE_GLOBAL_DIR}/launchpad-gem" "$@" +topaz -l -q -I "${LAUNCHPAD_TOPAZ_SCRIPT}" -S "${GEMSTONE_GLOBAL_DIR}/command-line-handler.tpz" -- launchpad "$@" & +pid="$!" +wait "$pid" diff --git a/docker/gs64/launchpad-gem b/docker/gs64/launchpad-gem deleted file mode 100755 index b18c24e..0000000 --- a/docker/gs64/launchpad-gem +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env bash - -# Prepare Launchpad topaz input script -readonly SYSTEM_USER_PASSWORD="${GS64_SYSTEM_USER_PASSWORD:-swordfish}" -readonly STONE_NAME="${GS64_STONE_SERVICE_NAME:-gs64stone}" - -set -e -readonly LAUNCHPAD_TOPAZ_SCRIPT="${GEMSTONE_GLOBAL_DIR}/data/launchpad-start.tpz" -set +o histexpand -echo "set gemstone !@${GS64_STONE_HOSTNAME}!${STONE_NAME} user SystemUser pass ${SYSTEM_USER_PASSWORD}" >> "${LAUNCHPAD_TOPAZ_SCRIPT}" -set -o histexpand - -pid=0 - -termination_handler() { - exit_status=0 - if [ $pid -ne 0 ]; then - echo 'SIGTERM received, shutting down the gem' - kill "$pid" - stopnetldi - wait "$pid" - exit_status=$? - fi - exit "$exit_status" -} - -trap 'termination_handler' SIGTERM - -# shellcheck disable=SC2086 -startnetldi \ - -g \ - -a "${GS_USER}" \ - -n \ - -P "${NETLDI_PORT}" \ - -l "${GEMSTONE_LOG_DIR}/${NETLDI_SERVICE_NAME}.log" \ - -D "${GEMSTONE_LOG_DIR}" \ - ${NETLDI_ARGS:-} \ - "${NETLDI_SERVICE_NAME}" >> "${GEMSTONE_LOG_DIR}/startnetldi.log" - -# list GemStone services -gslist -cvl >> "${GEMSTONE_LOG_DIR}/startnetldi.log" - -topaz -l -q -I "${LAUNCHPAD_TOPAZ_SCRIPT}" -S "${GEMSTONE_GLOBAL_DIR}/command-line-handler.tpz" -- launchpad "$@" & -pid="$!" -wait "$pid" diff --git a/rowan/components/Dependent-SUnit-Extensions.ston b/rowan/components/Dependent-SUnit-Extensions.ston new file mode 100644 index 0000000..0aef5b9 --- /dev/null +++ b/rowan/components/Dependent-SUnit-Extensions.ston @@ -0,0 +1,20 @@ +RwSimpleProjectLoadComponentV2 { + #name : 'Dependent-SUnit-Extensions', + #condition : 'sunit', + #projectNames : [ ], + #componentNames : [ + 'Deployment' + ], + #packageNames : [ + 'Launchpad-SUnit' + ], + #conditionalPackageMapSpecs : { + 'gemstone' : { + 'allusers' : { + #packageNameToPlatformPropertiesMap : { + 'Launchpad-SUnit' : { 'symbolDictName' : 'Launchpad' } + } + } + } + } +} diff --git a/rowan/components/Tests.ston b/rowan/components/Tests.ston index cf15595..a3f538f 100644 --- a/rowan/components/Tests.ston +++ b/rowan/components/Tests.ston @@ -3,7 +3,8 @@ RwSimpleProjectLoadComponentV2 { #condition : 'tests', #projectNames : [ ], #componentNames : [ - 'Deployment' + 'Deployment', + 'Dependent-SUnit-Extensions' ], #packageNames : [ 'Launchpad-Applications-Tests', @@ -11,7 +12,6 @@ RwSimpleProjectLoadComponentV2 { 'Launchpad-Configuration-Tests', 'Launchpad-Examples', 'Launchpad-GS64-Extensions-Tests', - 'Launchpad-SUnit', 'Launchpad-Tracing-Tests' ], #conditionalPackageMapSpecs : { @@ -23,7 +23,6 @@ RwSimpleProjectLoadComponentV2 { 'Launchpad-Configuration-Tests' : { 'symbolDictName' : 'Launchpad' }, 'Launchpad-Examples' : { 'symbolDictName' : 'Launchpad' }, 'Launchpad-GS64-Extensions-Tests' : { 'symbolDictName' : 'Launchpad' }, - 'Launchpad-SUnit' : { 'symbolDictName' : 'Launchpad' }, 'Launchpad-Tracing-Tests' : { 'symbolDictName' : 'Launchpad' } } } diff --git a/rowan/specs/Launchpad-Dependent-SUnit-Extensions.ston b/rowan/specs/Launchpad-Dependent-SUnit-Extensions.ston new file mode 100644 index 0000000..4d1fca4 --- /dev/null +++ b/rowan/specs/Launchpad-Dependent-SUnit-Extensions.ston @@ -0,0 +1,13 @@ +RwLoadSpecificationV2 { + #specName: 'Launchpad-Dependent-SUnit-Extensions', + #projectName : 'Launchpad', + #diskUrl : 'Launchpad', + #projectSpecFile : 'rowan/project.ston', + #componentNames : [ + 'Dependent-SUnit-Extensions' + ], + #customConditionalAttributes : [ + 'tests', + 'sunit' + ] +}