diff --git a/.docker/gs64/.gitignore b/.docker/gs64/.gitignore new file mode 100644 index 0000000..8d57495 --- /dev/null +++ b/.docker/gs64/.gitignore @@ -0,0 +1 @@ +gemstone.key diff --git a/.docker/gs64/Dockerfile b/.docker/gs64/Dockerfile new file mode 100644 index 0000000..af543dd --- /dev/null +++ b/.docker/gs64/Dockerfile @@ -0,0 +1,3 @@ +FROM launchpad-gs64:sut + +CMD [ "launchpad", "start", "greeter" , "--name=DJ", "--title=Mr." ] diff --git a/.docker/gs64/docker-tests.sh b/.docker/gs64/docker-tests.sh new file mode 100755 index 0000000..42349ae --- /dev/null +++ b/.docker/gs64/docker-tests.sh @@ -0,0 +1,151 @@ +#!/usr/bin/env bash + +readonly ANSI_BOLD="\\033[1m" +readonly ANSI_RED="\\033[31m" +readonly ANSI_GREEN="\\033[32m" +readonly ANSI_BLUE="\\033[34m" +readonly ANSI_RESET="\\033[0m" + +function print_info() { + if [ -t 1 ]; then + printf "${ANSI_BOLD}${ANSI_BLUE}%s${ANSI_RESET}\\n" "$1" + else + echo "$1" + fi +} + +function print_success() { + if [ -t 1 ]; then + printf "${ANSI_BOLD}${ANSI_GREEN}%s${ANSI_RESET}\\n" "$1" + else + echo "$1" + fi +} + +function print_error() { + if [ -t 1 ]; then + printf "${ANSI_BOLD}${ANSI_RED}%s${ANSI_RESET}\\n" "$1" 1>&2 + else + echo "$1" 1>&2 + fi +} + +function executeWithArguments() { + rm -rf logs out err + LAST_ARGUMENTS=$* + "$@" > out 2> err || true +} + +function assertOutputIncludesMessage() { + local message=$1 + local output=$2 + + if [ "$(grep -c "$message" "$output")" -eq 0 ]; then + print_error "Expected std$output to have: '$message' when invoked with $LAST_ARGUMENTS" + print_info "Output contents" + cat "$output" + exit 1 + fi +} + +set -e + +print_info "Creating network" +if docker network inspect launchpad-net > /dev/null 2>&1 ;then + docker network rm launchpad-net +fi +docker network create --attachable launchpad-net + +print_info "Starting stone" +if [[ ! -f "$PWD"/.docker/gs64/gemstone.key ]]; then + print_error "Missing $PWD/.docker/gs64/gemstone.key" + exit 1 +fi + +docker run --rm --detach --name gs64-stone \ + -e TZ="America/Argentina/Buenos_Aires" \ + --cap-add=SYS_RESOURCE \ + --network=launchpad-net \ + --volume="$PWD":/opt/gemstone/projects/Launchpad:ro \ + --volume="$PWD"/.docker/gs64/gem.conf:/opt/gemstone/conf/gem.conf \ + --volume="$PWD"/.docker/gs64/gemstone.key:/opt/gemstone/product/sys/gemstone.key:ro \ + ghcr.io/ba-st/gs64-rowan:v3.7.0 + +sleep 1 +print_info "Loading Launchpad in the stone" +docker exec -t -u gemstone gs64-stone ./load-rowan-project.sh Launchpad + +print_info "Building base gem" +docker buildx build --tag launchpad-gs64:sut docker/gs64 + + print_info "Building examples gem" + docker buildx build \ + --tag launchpad-examples-gs64:sut \ + --file .docker/gs64/Dockerfile \ + . + +function run_launchpad_gem(){ + executeWithArguments docker run \ + -e TZ="America/Argentina/Buenos_Aires" \ + -e GS64_STONE_HOSTNAME="gs64-stone" \ + --cap-add=SYS_RESOURCE \ + --network=launchpad-net \ + --volume="$PWD"/.docker/gs64/gem.conf:/opt/gemstone/conf/gem.conf \ + launchpad-examples-gs64:sut "$@" +} + +print_info "Running basic test" +run_launchpad_gem +assertOutputIncludesMessage '[INFO]' out +assertOutputIncludesMessage "Hi Mr. DJ!" out +print_success "OK" + +print_info "Running --version test" +run_launchpad_gem launchpad --version +assertOutputIncludesMessage "Launchpad" out +print_success "OK" + +print_info "Running launchpad list test" +run_launchpad_gem launchpad list +assertOutputIncludesMessage "broken greeter" out +print_success "OK" + +print_info "Running launchpad list --verbose test" +run_launchpad_gem launchpad list --verbose +assertOutputIncludesMessage "broken v0.0.1" out +assertOutputIncludesMessage "greeter v1.0.0" out +print_success "OK" + +print_info "Running launchpad explain test" +run_launchpad_gem launchpad explain broken +assertOutputIncludesMessage "broken \[v0.0.1\] - A broken application" out +run_launchpad_gem launchpad explain greeter +assertOutputIncludesMessage "greeter \[v1.0.0\] - A greetings application" out +run_launchpad_gem launchpad explain +assertOutputIncludesMessage "\[ERROR\] Missing application name or option." err +print_success "OK" + +print_info "Running launchpad start greeter test" +run_launchpad_gem launchpad start greeter --name=Juan +assertOutputIncludesMessage "Hi Juan!" out +print_success " Just name, OK" +run_launchpad_gem launchpad start greeter --name=Julia --title=Miss +assertOutputIncludesMessage "Hi Miss Julia!" out +print_success " Name and title, OK" +run_launchpad_gem launchpad start greeter --title=Miss +assertOutputIncludesMessage "\[ERROR\] \"Name\" parameter not provided. You must provide one." err +print_success " Missing name, OK" +run_launchpad_gem launchpad start greeter +assertOutputIncludesMessage "\[ERROR\] \"Name\" parameter not provided. You must provide one." err +print_success "OK" + +print_info "Running launchpad start broken test" +run_launchpad_gem launchpad start broken --raise-error +assertOutputIncludesMessage "\[INFO\] Obtaining configuration... \[DONE\]" out +assertOutputIncludesMessage "\[ERROR\] Unexpected startup error: \"Doh!\"" err +print_success "OK" + +print_info "Stopping stone" +docker stop gs64-stone +print_info "Removing network" +docker network rm launchpad-net diff --git a/.docker/gs64/gem.conf b/.docker/gs64/gem.conf new file mode 100644 index 0000000..02f3d48 --- /dev/null +++ b/.docker/gs64/gem.conf @@ -0,0 +1,2 @@ +GEM_TEMPOBJ_CACHE_SIZE = 500000KB; + diff --git a/.docker/Dockerfile b/.docker/pharo/Dockerfile similarity index 100% rename from .docker/Dockerfile rename to .docker/pharo/Dockerfile diff --git a/.docker/docker-tests.sh b/.docker/pharo/docker-tests.sh similarity index 97% rename from .docker/docker-tests.sh rename to .docker/pharo/docker-tests.sh index a7c9c98..67d8c11 100755 --- a/.docker/docker-tests.sh +++ b/.docker/pharo/docker-tests.sh @@ -51,12 +51,12 @@ function assertOutputIncludesMessage() { set -e print_info "Building base image" -docker buildx build --tag launchpad:sut docker +docker buildx build --tag launchpad:sut docker/pharo print_info "Building examples image" docker buildx build \ --tag launchpad-examples:sut \ - --file .docker/Dockerfile \ + --file .docker/pharo/Dockerfile \ . print_info "Running basic test" diff --git a/.github/workflows/.binary-stack-serialization.yml b/.github/workflows/.binary-stack-serialization.yml index bdffab1..c33eba9 100644 --- a/.github/workflows/.binary-stack-serialization.yml +++ b/.github/workflows/.binary-stack-serialization.yml @@ -1,14 +1,19 @@ name: Binary Stack Serialization Tests - -on: [push,pull_request,workflow_dispatch] - +on: + - push + - pull_request + - workflow_dispatch jobs: unit-tests: runs-on: ubuntu-latest strategy: fail-fast: false matrix: - smalltalk: [ Pharo64-11, Pharo64-10, Pharo64-9.0, Pharo64-8.0 ] + smalltalk: + - Pharo64-11 + - Pharo64-10 + - Pharo64-9.0 + - Pharo64-8.0 name: ${{ matrix.smalltalk }} steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/docker-build-gs64.yml b/.github/workflows/docker-build-gs64.yml new file mode 100644 index 0000000..f8e01d4 --- /dev/null +++ b/.github/workflows/docker-build-gs64.yml @@ -0,0 +1,38 @@ +name: Build and Publish GS64 Docker Images +on: + workflow_dispatch: + push: + branches: + - '**' + tags: + - 'v*.*.*' + pull_request: +jobs: + build_and_publish: + runs-on: ubuntu-latest + name: Build and Publish Docker images + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Docker meta + id: docker_meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository_owner }}/launchpad-gs64 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to Container Registry + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ secrets.DOCKER_REGISTRY_USERNAME }} + password: ${{ secrets.DOCKER_REGISTRY_TOKEN }} + - name: Docker build and push + uses: docker/build-push-action@v5 + with: + context: ./docker/gs64 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.docker_meta.outputs.tags }} + labels: ${{ steps.docker_meta.outputs.labels }} + secrets: GIT_AUTH_TOKEN=${{ secrets.DOCKER_REGISTRY_TOKEN }} diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 05803dc..be51582 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -1,5 +1,4 @@ -name: Build and Publish Docker Images - +name: Build and Publish Pharo Docker Images on: workflow_dispatch: push: @@ -8,7 +7,6 @@ on: tags: - 'v*.*.*' pull_request: - jobs: build_and_publish: runs-on: ubuntu-latest @@ -18,22 +16,22 @@ jobs: uses: actions/checkout@v3 - name: Docker meta id: docker_meta - uses: crazy-max/ghaction-docker-meta@v4 + uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository_owner }}/launchpad - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Login to Container Registry if: github.event_name != 'pull_request' - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ secrets.DOCKER_REGISTRY_USERNAME }} password: ${{ secrets.DOCKER_REGISTRY_TOKEN }} - name: Docker build and push - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v5 with: - context: ./docker + context: ./docker/pharo push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.docker_meta.outputs.tags }} labels: ${{ steps.docker_meta.outputs.labels }} diff --git a/.github/workflows/docker-tests-gs64.yml b/.github/workflows/docker-tests-gs64.yml new file mode 100644 index 0000000..71b6d66 --- /dev/null +++ b/.github/workflows/docker-tests-gs64.yml @@ -0,0 +1,21 @@ +name: GS64 Docker Tests +on: + - push + - pull_request + - workflow_dispatch +jobs: + unit-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 2 + - name: Configure keyfile + run: | + echo "$GS_KEYFILE" > ./.docker/gs64/gemstone.key + env: + GS_KEYFILE: ${{ secrets.GS_KEYFILE }} + - name: Run tests using Docker + run: ./.docker/gs64/docker-tests.sh + - name: Remove keyfile + run: rm -f ./.docker/gs64/gemstone.key diff --git a/.github/workflows/docker-tests.yml b/.github/workflows/docker-tests.yml index 0bf4474..f56fa7b 100644 --- a/.github/workflows/docker-tests.yml +++ b/.github/workflows/docker-tests.yml @@ -1,7 +1,8 @@ -name: Docker Tests - -on: [push,pull_request,workflow_dispatch] - +name: Pharo Docker Tests +on: + - push + - pull_request + - workflow_dispatch jobs: unit-tests: runs-on: ubuntu-latest @@ -10,4 +11,4 @@ jobs: with: fetch-depth: 2 - name: Run tests using Docker - run: ./.docker/docker-tests.sh + run: ./.docker/pharo/docker-tests.sh diff --git a/.github/workflows/loading-groups.yml b/.github/workflows/loading-groups.yml index 0e4dd83..c94dbc7 100644 --- a/.github/workflows/loading-groups.yml +++ b/.github/workflows/loading-groups.yml @@ -1,15 +1,23 @@ name: Baseline Groups - -on: [push,pull_request,workflow_dispatch] - +on: + - push + - pull_request + - workflow_dispatch jobs: group-loading: runs-on: ubuntu-latest strategy: fail-fast: false matrix: - smalltalk: [ Pharo64-11, Pharo64-10, Pharo64-9.0, Pharo64-8.0 ] - load-spec: [ deployment, examples, tools, sunit, development] + smalltalk: + - Pharo64-10 + - Pharo64-11 + load-spec: + - development + - deployment + - examples + - sunit + - tools name: ${{ matrix.smalltalk }} + ${{ matrix.load-spec }} steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/loading-gs64-components.yml b/.github/workflows/loading-gs64-components.yml new file mode 100644 index 0000000..df51ad2 --- /dev/null +++ b/.github/workflows/loading-gs64-components.yml @@ -0,0 +1,21 @@ +name: 'GS64 Components Loading' +on: + - push + - pull_request + - workflow_dispatch +jobs: + component-loading: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + load-spec: + - Deployment + name: GS64 + ${{ matrix.load-spec }} + steps: + - uses: actions/checkout@v3 + - name: Load component in image + uses: ba-st-actions/gs64-ci@v2 + with: + project_name: 'Launchpad' + load_spec: 'Launchpad-${{ matrix.load-spec }}' diff --git a/.github/workflows/markdown-lint.yml b/.github/workflows/markdown-lint.yml index fbb50fa..29b9002 100644 --- a/.github/workflows/markdown-lint.yml +++ b/.github/workflows/markdown-lint.yml @@ -1,5 +1,8 @@ name: Markdown Lint -on: [push,pull_request,workflow_dispatch] +on: + - push + - pull_request + - workflow_dispatch jobs: remark-lint: name: runner / markdownlint diff --git a/.github/workflows/notify.yml b/.github/workflows/notify.yml index bfe0828..b43382e 100644 --- a/.github/workflows/notify.yml +++ b/.github/workflows/notify.yml @@ -1,9 +1,5 @@ name: Release Notifications - -on: - release: - types: [published] - +on: workflow_dispatch jobs: notify: runs-on: ubuntu-latest diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index 1b3944d..20ddbdc 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -1,7 +1,7 @@ name: Shellcheck - -on: [push,pull_request] - +on: + - push + - pull_request jobs: shellcheck: runs-on: ubuntu-latest diff --git a/.github/workflows/unit-tests-gs64.yml b/.github/workflows/unit-tests-gs64.yml new file mode 100644 index 0000000..567ca81 --- /dev/null +++ b/.github/workflows/unit-tests-gs64.yml @@ -0,0 +1,16 @@ +name: 'GS64 Unit Tests' +on: + - push + - pull_request + - workflow_dispatch +jobs: + unit-tests: + runs-on: ubuntu-latest + name: GS64 Unit Tests + steps: + - uses: actions/checkout@v3 + - name: Load Image and Run Tests + uses: ba-st-actions/gs64-ci@v2 + with: + project_name: 'Launchpad' + run_tests: 'true' diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 4979740..aaca578 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -1,14 +1,19 @@ -name: Unit Tests - -on: [push,pull_request,workflow_dispatch] - +name: Pharo Unit Tests +on: + - push + - pull_request + - workflow_dispatch jobs: unit-tests: runs-on: ubuntu-latest strategy: fail-fast: false matrix: - smalltalk: [ Pharo64-11, Pharo64-10, Pharo64-9.0, Pharo64-8.0 ] + smalltalk: + - Pharo64-10 + - Pharo64-11 + - Pharo64-9.0 + - Pharo64-8.0 name: ${{ matrix.smalltalk }} steps: - uses: actions/checkout@v3 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f581dd7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +err +out diff --git a/README.md b/README.md index 57fda52..5b972b6 100644 --- a/README.md +++ b/README.md @@ -5,19 +5,27 @@ A command-line interface to start, list, and explain the applications available within the image. -[![Unit Tests](https://github.com/ba-st/Launchpad/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/ba-st/Launchpad/actions/workflows/unit-tests.yml) -[![Docker Tests](https://github.com/ba-st/Launchpad/actions/workflows/docker-tests.yml/badge.svg)](https://github.com/ba-st/Launchpad/actions/workflows/docker-tests.yml) +[![Pharo Unit Tests](https://github.com/ba-st/Launchpad/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/ba-st/Launchpad/actions/workflows/unit-tests.yml) +[![GS64 - Unit Tests](https://github.com/ba-st/Launchpad/actions/workflows/unit-tests-gs64.yml/badge.svg)](https://github.com/ba-st/Launchpad/actions/workflows/unit-tests-gs64.yml) +[![Pharo Docker Tests](https://github.com/ba-st/Launchpad/actions/workflows/docker-tests.yml/badge.svg)](https://github.com/ba-st/Launchpad/actions/workflows/docker-tests.yml) +[![GS64 Docker Tests](https://github.com/ba-st/Launchpad/actions/workflows/docker-tests-gs64.yml/badge.svg)](https://github.com/ba-st/Launchpad/actions/workflows/docker-tests-gs64.yml) [![Coverage Status](https://codecov.io/github/ba-st/Launchpad/coverage.svg?branch=release-candidate)](https://codecov.io/gh/ba-st/Launchpad/branch/release-candidate) + [![Baseline Groups](https://github.com/ba-st/Launchpad/actions/workflows/loading-groups.yml/badge.svg)](https://github.com/ba-st/Launchpad/actions/workflows/loading-groups.yml) -[![Docker Build](https://github.com/ba-st/Launchpad/actions/workflows/docker-build.yml/badge.svg)](https://github.com/ba-st/Launchpad/actions/workflows/docker-build.yml) +[![GS64 Components](https://github.com/ba-st/Launchpad/actions/workflows/loading-gs64-components.yml/badge.svg)](https://github.com/ba-st/Launchpad/actions/workflows/loading-gs64-components.yml) [![Markdown Lint](https://github.com/ba-st/Launchpad/actions/workflows/markdown-lint.yml/badge.svg)](https://github.com/ba-st/Launchpad/actions/workflows/markdown-lint.yml) +[![Shellcheck](https://github.com/ba-st/Stargate/actions/workflows/shellcheck.yml/badge.svg)](https://github.com/ba-st/Stargate/actions/workflows/shellcheck.yml) + +[![Pharo Docker Build](https://github.com/ba-st/Launchpad/actions/workflows/docker-build.yml/badge.svg)](https://github.com/ba-st/Launchpad/actions/workflows/docker-build.yml) +[![GS64 Docker Build](https://github.com/ba-st/Launchpad/actions/workflows/docker-build-gs64.yml/badge.svg)](https://github.com/ba-st/Launchpad/actions/workflows/docker-build-gs64.yml) [![GitHub release](https://img.shields.io/github/release/ba-st/Launchpad.svg)](https://github.com/ba-st/Launchpad/releases/latest) -[![Pharo 8.0](https://img.shields.io/badge/Pharo-8.0-informational)](https://pharo.org) -[![Pharo 9.0](https://img.shields.io/badge/Pharo-9.0-informational)](https://pharo.org) + [![Pharo 10](https://img.shields.io/badge/Pharo-10-informational)](https://pharo.org) [![Pharo 11](https://img.shields.io/badge/Pharo-11-informational)](https://pharo.org) +[![GS64 3.7.0](https://img.shields.io/badge/GS64-3.7.0-informational)](https://gemtalksystems.com/products/gs64/) + ## Quick links - [**Explore the docs**](docs/README.md) diff --git a/docker/gs64/Dockerfile b/docker/gs64/Dockerfile new file mode 100644 index 0000000..9471368 --- /dev/null +++ b/docker/gs64/Dockerfile @@ -0,0 +1,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 +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 diff --git a/docker/gs64/command-line-handler.tpz b/docker/gs64/command-line-handler.tpz new file mode 100644 index 0000000..7eca0f7 --- /dev/null +++ b/docker/gs64/command-line-handler.tpz @@ -0,0 +1,6 @@ +iferror exit 1 +login +doit + LaunchpadCommandLineHandler activateWith: (CommandLineArguments new copyAfter: '--') +% +exit 0 diff --git a/docker/gs64/launchpad b/docker/gs64/launchpad new file mode 100755 index 0000000..6ec4325 --- /dev/null +++ b/docker/gs64/launchpad @@ -0,0 +1,19 @@ +#!/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" + fi +done + +# Run as GS_USER +exec gosu "${GS_USER}" "${GEMSTONE_GLOBAL_DIR}/launchpad-gem" "$@" diff --git a/docker/gs64/launchpad-gem b/docker/gs64/launchpad-gem new file mode 100755 index 0000000..b18c24e --- /dev/null +++ b/docker/gs64/launchpad-gem @@ -0,0 +1,45 @@ +#!/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/docker/Dockerfile b/docker/pharo/Dockerfile similarity index 100% rename from docker/Dockerfile rename to docker/pharo/Dockerfile diff --git a/docker/launchpad b/docker/pharo/launchpad similarity index 100% rename from docker/launchpad rename to docker/pharo/launchpad diff --git a/docker/launchpad-explain b/docker/pharo/launchpad-explain similarity index 100% rename from docker/launchpad-explain rename to docker/pharo/launchpad-explain diff --git a/docker/launchpad-healthcheck b/docker/pharo/launchpad-healthcheck similarity index 100% rename from docker/launchpad-healthcheck rename to docker/pharo/launchpad-healthcheck diff --git a/docker/launchpad-list b/docker/pharo/launchpad-list similarity index 100% rename from docker/launchpad-list rename to docker/pharo/launchpad-list diff --git a/docker/launchpad-start b/docker/pharo/launchpad-start similarity index 100% rename from docker/launchpad-start rename to docker/pharo/launchpad-start diff --git a/docs/reference/CLI.md b/docs/reference/CLI.md index 72f0da0..cac3464 100644 --- a/docs/reference/CLI.md +++ b/docs/reference/CLI.md @@ -21,6 +21,20 @@ vast/bin/esnx \ launchpad ``` +For [GemStone/S 64](https://gemtalksystems.com/products/gs64/versions37x/) the +command must be passed after the topaz arguments: + +```bash +topaz -l -- launchpad +``` + +and starting the command line handler by evaluating: + +```smalltalk + LaunchpadCommandLineHandler activateWith: + (CommandLineArguments new copyAfter: '--') +``` + For the sake of simplicity, from now on we will omit in the examples the VM and image parameters: diff --git a/docs/reference/Docker.md b/docs/reference/Docker.md index d50409a..6eff11d 100644 --- a/docs/reference/Docker.md +++ b/docs/reference/Docker.md @@ -1,5 +1,7 @@ # Docker support +## Docker support for Pharo + Launchpad provides a Docker image that can be used as base for containerized applications. It's built on top of [pharo:v11.0.0](https://github.com/ba-st/docker-pharo-runtime), adding some useful scripts for Launchpad-based applications: @@ -11,7 +13,7 @@ adding some useful scripts for Launchpad-based applications: a `SIGTERM` handler for gracefully stopping the application. - `launchpad-healthcheck` is run as the default docker `HEALTHCHECK` -## How to use as base docker image +### How to use as base pharo docker image In your Dockerfile put something like: @@ -20,7 +22,7 @@ FROM ghcr.io/ba-st/pharo-loader:v11.0.0 AS loader # Load your own application RUN pharo metacello install github://owner/repo:branch BaselineOfProject -FROM ghcr.io/ba-st/launchpad:v4 +FROM ghcr.io/ba-st/launchpad:v5 COPY --from=loader /opt/pharo/Pharo.image ./ COPY --from=loader /opt/pharo/Pharo*.sources ./ @@ -29,8 +31,28 @@ COPY --from=loader /opt/pharo/Pharo*.sources ./ CMD [ "launchpad-start", "app-name" , "--parameter=value" ] ``` -## Environment variables +### Environment variables - `LAUNCHPAD__COMMAND_SERVER_PORT` defines in which port is listening the TCP command server. Defaults to 22222. - `LAUNCHPAD__LOG_FORMAT` can be set to `json` to enable structured logging + +## Docker support for GemStone/S 64 + +Launchpad provides a Docker image that can be used as base for containerized +gems. It's built on top of [gs64-gem:v3.7.0](https://github.com/ba-st/Docker-GemStone-64), +adding some useful scripts for Launchpad-based applications: + +- `launchpad` starts the CLI + +### How to use as base gem docker image + +In your Dockerfile put something like: + +```docker +FROM ghcr.io/ba-st/launchpad-gs64:v5 + +# Your own directives + +CMD [ "launchpad", "start", "app-name" , "--parameter=value" ] +``` diff --git a/docs/reference/Tracing.md b/docs/reference/Tracing.md index d02a084..49af17a 100644 --- a/docs/reference/Tracing.md +++ b/docs/reference/Tracing.md @@ -15,3 +15,12 @@ When using Launchpad in Pharo the following dumpers are available: opened in a Pharo image and debugged live using the familiar tooling. - `NullStackTraceDumper` emits a warning and doesn't produce any stack trace. Its usage is discouraged in production environments. + +## Stack tracing for GemStone/S 64 + +When using Launchpad in GemStone/S the following dumpers are available: + +- `StackTraceTextDumper` produces a textual stack trace written to the + configured stream. +- `NullStackTraceDumper` emits a warning and doesn't produce any stack trace. Its + usage is discouraged in production environments. diff --git a/source/Launchpad-GS64-Extensions/CommandLineArguments.class.st b/source/Launchpad-GS64-Extensions/CommandLineArguments.class.st index a523304..e314192 100644 --- a/source/Launchpad-GS64-Extensions/CommandLineArguments.class.st +++ b/source/Launchpad-GS64-Extensions/CommandLineArguments.class.st @@ -36,6 +36,12 @@ CommandLineArguments >> arguments [ ^ arguments ] +{ #category : #copying } +CommandLineArguments >> copyAfter: argument [ + + ^ self class withArguments: (arguments copyAfter: argument) +] + { #category : #copying } CommandLineArguments >> copySubcommand [