diff --git a/.github/workflows/site_deploy.yml b/.github/workflows/site_deploy.yml index 0254ae6209..95138910f3 100644 --- a/.github/workflows/site_deploy.yml +++ b/.github/workflows/site_deploy.yml @@ -39,7 +39,6 @@ jobs: echo "VCELL_TAG=`git rev-parse --short HEAD`" >> $GITHUB_ENV echo "VCELL_REPO_NAMESPACE=ghcr.io/virtualcell" >> $GITHUB_ENV echo "VCELL_DEPLOY_REMOTE_DIR=/share/apps/vcell3/deployed_github" >> $GITHUB_ENV - echo "VCELL_WEBHELP_REMOTE_DIR=/share/apps/vcell3/apache_webroot/htdocs/webstart/VCell_Tutorials/VCell_Help" >> $GITHUB_ENV if [ "${{ github.event.inputs.vcell_site }}" == "rel" ]; then\ echo "VCELL_MANAGER_NODE=vcellapi.cam.uchc.edu" >> $GITHUB_ENV;\ echo "VCELL_INSTALLER_REMOTE_DIR="/share/apps/vcell3/apache_webroot/htdocs/webstart/Rel"" >> $GITHUB_ENV;\ @@ -182,30 +181,16 @@ jobs: ssh-keyscan $VCELL_MANAGER_NODE >> ~/.ssh/known_hosts cd docker/swarm scp ${{ secrets.CD_FULL_USER }}@${VCELL_MANAGER_NODE}:${VCELL_DEPLOY_REMOTE_DIR}/${VCELL_CONFIG_FILE_NAME} . - - name: setup java 17 with maven cache (for documentation build) - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: '17' - cache: 'maven' - - name: build documentation for web help - if: ${{ github.event.inputs.server_only != 'true' }} - run: | - set -ux - mvn clean install -DskipTests - - name: deploy installers and web help to vcell.org + - name: deploy installers to vcell.org run: | set -ux cd docker/swarm ssh -t ${{ secrets.CD_FULL_USER }}@${VCELL_MANAGER_NODE} sudo docker login -u ${{ github.actor }} -p "${{ secrets.GITHUB_TOKEN }}" ghcr.io if ${{ github.event.inputs.server_only != 'true' }}; then - # build and install the client installers, and the web help (kubernetes cluster deployments are separate) - ./deploy-action-kubernetes.sh \ + # build and install the client installers (kubernetes cluster deployments are separate) + ./deploy-installers.sh \ --ssh-user ${{ secrets.CD_FULL_USER }} \ - --build-installers \ --installer-deploy-dir $VCELL_INSTALLER_REMOTE_DIR \ - --webhelp-local-dir ../../vcell-client/target/classes/vcellDoc \ - --webhelp-deploy-dir $VCELL_WEBHELP_REMOTE_DIR \ ${VCELL_MANAGER_NODE} \ ./${VCELL_CONFIG_FILE_NAME} export VCELL_SITE_CAMEL=`cat $VCELL_CONFIG_FILE_NAME | grep VCELL_SITE_CAMEL | cut -d"=" -f2` diff --git a/.github/workflows/webhelp-deploy.yml b/.github/workflows/webhelp-deploy.yml new file mode 100644 index 0000000000..66748850b2 --- /dev/null +++ b/.github/workflows/webhelp-deploy.yml @@ -0,0 +1,60 @@ +name: webhelp-deploy.yml +on: + workflow_dispatch: +jobs: + deploy: + name: Deploy Web Help Documentation + runs-on: ubuntu-20.04 + steps: + - name: checkout tag + uses: actions/checkout@v4 + + - name: setup global environment variables + run: | + echo "VCELL_REPO_NAMESPACE=ghcr.io/virtualcell" >> $GITHUB_ENV + echo "VCELL_DEPLOY_REMOTE_DIR=/share/apps/vcell3/deployed_github" >> $GITHUB_ENV + echo "VCELL_WEBHELP_REMOTE_DIR=/share/apps/vcell3/apache_webroot/htdocs/webstart/VCell_Tutorials/VCell_Help" >> $GITHUB_ENV + echo "VCELL_MANAGER_NODE=vcellapi.cam.uchc.edu" >> $GITHUB_ENV + + - name: setup ssh-agent + uses: webfactory/ssh-agent@v0.8.0 + with: + ssh-private-key: ${{ secrets.VC_KEY }} + + - name: setup java 17 with maven cache (for documentation build) + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '17' + cache: 'maven' + + - name: build documentation for web help + run: | + mvn clean install -DskipTests + + - name: Deploy Web Help + run: | + set -ux + webhelp_local_dir="~/work/vcell/vcell/vcell-client/target/classes/vcellDoc" + ssh_user=${{ secrets.CD_FULL_USER }} + webhelp_deploy_dir="${VCELL_WEBHELP_REMOTE_DIR}" + manager_node="${VCELL_MANAGER_NODE}" + if [[ -z "${webhelp_deploy_dir}" || -z "${manager_node}" ]]; then + echo "Error: VCELL_WEBHELP_REMOTE_DIR or manager_node is not set." + exit 1; + fi + if ! rsync -a -vvv "${webhelp_local_dir}/topics" "$ssh_user@$manager_node:${webhelp_deploy_dir}"; + then + echo "failed to copy html files in topic directory to webhelp deploy directory"; + fi + if ! scp "${webhelp_local_dir}/VCellHelpTOC.html" "$ssh_user@$manager_node:${webhelp_deploy_dir}/index.html"; + then + echo "failed to index.html to webhelp deploy directory"; + fi + + - name: Setup tmate session 3 + uses: mxschmitt/action-tmate@v3 + if: ${{ failure() }} + with: + limit-access-to-actor: false + diff --git a/docker/swarm/deploy-action-kubernetes.sh b/docker/swarm/deploy-action-kubernetes.sh deleted file mode 100755 index 0d9ffd258a..0000000000 --- a/docker/swarm/deploy-action-kubernetes.sh +++ /dev/null @@ -1,158 +0,0 @@ -#!/usr/bin/env bash - -set -ux - -show_help() { - echo "Deploys vcell client installers and webhelp for a Kubernetes deploy" - echo "" - echo "usage: deploy-action-kubernetes.sh [OPTIONS] REQUIRED-ARGUMENTS" - echo "" - echo " REQUIRED-ARGUMENTS" - echo " manager-node any node for ssh access (e.g. vcellapi.cam.uchc.edu)" - echo "" - echo " local-config-file local config file for setting environment" - echo "" - echo " [OPTIONS]" - echo " -h | --help show this message" - echo "" - echo " --ssh-user user user for ssh to node [defaults to current user id using whoami]" - echo " (user must have passwordless sudo for docker commands on manager-node)" - echo "" - echo " --build-installers optionally build client installers and place in ./generated_installers dir" - echo "" - echo " --installer-deploy-dir /path/to/installer/dir" - echo " directory for installers accessible to users" - echo " typically a web-accessible location to download the client installers for each platform" - echo "" - echo " --webhelp-local-dir /local/path/to/vcellDoc" - echo " directory for VCell java help including html files" - echo "" - echo " --webhelp-deploy-dir /remote/path/to/web/VCell_Help" - echo " directory for deployed html webhelp published on web server" - echo "" - echo "" - echo "example:" - echo "" - echo "deploy-action-kubernetes.sh \\" - echo " --ssh-user vcell \\" - echo " --build_installers --installer_deploy_dir /share/apps/vcell3/apache_webroot/htdocs/webstart/Alpha \\" - echo " --webhelp_local_dir ../../vcell-client/target/classes/vcellDoc \\" - echo " --webhelp_deploy_dir /share/apps/vcell3/apache_webroot/htdocs/webstart/VCell_Tutorials/VCell_Help \\" - echo " vcellapi.cam.uchc.edu \\" - echo " ./server.config" - exit 1 -} - -if [[ $# -lt 2 ]]; then - show_help -fi - -ssh_user=$(whoami) -installer_deploy_dir= -webhelp_local_dir= -webhelp_deploy_dir= -build_installers=false -while :; do - case $1 in - -h|--help) - show_help - exit - ;; - --ssh-user) - shift - ssh_user=$1 - ;; - --installer-deploy-dir) - shift - installer_deploy_dir=$1 - ;; - --webhelp-local-dir) - shift - webhelp_local_dir=$1 - ;; - --webhelp-deploy-dir) - shift - webhelp_deploy_dir=$1 - ;; - --build-installers) - build_installers=true - ;; - -?*) - printf 'ERROR: Unknown option: %s\n' "$1" >&2 - echo "" - show_help - ;; - *) # Default case: No more options, so break out of the loop. - break - esac - shift -done - -if [[ $# -ne 2 ]] ; then - show_help -fi - -manager_node=$1 -local_config_file=$2 - -# get settings from config file -vcell_siteCamel=$(grep VCELL_SITE_CAMEL "$local_config_file" | cut -d"=" -f2) -vcell_version=$(grep VCELL_VERSION_NUMBER "$local_config_file" | cut -d"=" -f2) -vcell_build=$(grep VCELL_BUILD_NUMBER "$local_config_file" | cut -d"=" -f2) - -# -# if --build-installers, then generate client installers, placing then in ./generated_installers -# if --installer-deploy-dir, then also copy installers to $installer_deploy_dir -# *** unimplemented *** (if --link-installers, then also link installers to version independent installer names for each platform) -# -if [ "$build_installers" == "true" ]; then - # - # if --installer-deploy-dir, then copy the installers from ./generated_installers directory to the installer deploy directory - # - if [ ! -z "$installer_deploy_dir" ]; then - # vcell_siteCamel=Alpha - # vcell_version=7.0.0 - # vcell_build=19 - # version=7_0_0_19 - version=$(echo "${vcell_version}_${vcell_build}" | tr '.' _) - if ! scp "./generated_installers/VCell_${vcell_siteCamel}_windows-x64_${version}_64bit.exe" \ - "./generated_installers/VCell_${vcell_siteCamel}_unix_${version}_32bit.sh" \ - "./generated_installers/VCell_${vcell_siteCamel}_macos_${version}_64bit.dmg" \ - "./generated_installers/VCell_${vcell_siteCamel}_windows-x32_${version}_32bit.exe" \ - "./generated_installers/VCell_${vcell_siteCamel}_unix_${version}_64bit.sh" \ - "./generated_installers/updates.xml" \ - "./generated_installers/updates_linux32.xml" \ - "./generated_installers/updates_linux64.xml" \ - "./generated_installers/updates_mac64.xml" \ - "./generated_installers/updates_win32.xml" \ - "./generated_installers/updates_win64.xml" \ - "./generated_installers/output.txt" \ - "./generated_installers/md5sums" \ - "./generated_installers/sha256sums" \ - "$ssh_user@$manager_node:${installer_deploy_dir}"; - then - echo "failed to copy installers"; - exit 1; - fi - fi -fi - -# -# if --webhelp_deploy_dir, then copy the help html files from vcell-client/target/classes/vcellDoc/topics to the webhelp deploy directory -# -if [ ! -z "$webhelp_deploy_dir" ]; then - if ! scp -r "${webhelp_local_dir}/topics" "$ssh_user@$manager_node:${webhelp_deploy_dir}/topics"; - then - echo "failed to copy html files in topic directory to webhelp deploy directory"; - exit 1; - fi - if ! scp "${webhelp_local_dir}/VCellHelpTOC.html" "$ssh_user@$manager_node:${webhelp_deploy_dir}/index.html"; - then - echo "failed to index.html to webhelp deploy directory"; - exit 1; - fi -fi - -echo "exited normally" - -exit 0 diff --git a/docker/swarm/deploy-installers.sh b/docker/swarm/deploy-installers.sh new file mode 100755 index 0000000000..929c49f359 --- /dev/null +++ b/docker/swarm/deploy-installers.sh @@ -0,0 +1,113 @@ +#!/usr/bin/env bash + +set -ux + +show_help() { + echo "Deploys vcell client installers." + echo "" + echo "usage: deploy-installers.sh [OPTIONS] REQUIRED-ARGUMENTS" + echo "" + echo " REQUIRED-ARGUMENTS" + echo " manager-node any node for ssh access (e.g. vcellapi.cam.uchc.edu)" + echo "" + echo " local-config-file local config file for setting environment" + echo "" + echo " [OPTIONS]" + echo " -h | --help show this message" + echo "" + echo " --ssh-user user user for ssh to node [defaults to current user id using whoami]" + echo " (user must have passwordless sudo for docker commands on manager-node)" + echo "" + echo " --installer-deploy-dir /path/to/installer/dir" + echo " directory for installers accessible to users" + echo " typically a web-accessible location to download the client installers for each platform" + echo "" + echo "" + echo "" + echo "example:" + echo "" + echo "deploy-installers.sh \\" + echo " --ssh-user vcell \\" + echo " --installer_deploy_dir /share/apps/vcell3/apache_webroot/htdocs/webstart/Alpha \\" + echo " vcellapi.cam.uchc.edu \\" + echo " ./server.config" + exit 1 +} + +if [[ $# -lt 2 ]]; then + show_help +fi + +ssh_user=$(whoami) +installer_deploy_dir= +while :; do + case $1 in + -h|--help) + show_help + exit + ;; + --ssh-user) + shift + ssh_user=$1 + ;; + --installer-deploy-dir) + shift + installer_deploy_dir=$1 + ;; + -?*) + printf 'ERROR: Unknown option: %s\n' "$1" >&2 + echo "" + show_help + ;; + *) # Default case: No more options, so break out of the loop. + break + esac + shift +done + +if [[ $# -ne 2 ]] ; then + show_help +fi + +manager_node=$1 +local_config_file=$2 + +# get settings from config file +vcell_siteCamel=$(grep VCELL_SITE_CAMEL "$local_config_file" | cut -d"=" -f2) +vcell_version=$(grep VCELL_VERSION_NUMBER "$local_config_file" | cut -d"=" -f2) +vcell_build=$(grep VCELL_BUILD_NUMBER "$local_config_file" | cut -d"=" -f2) + + +# +# if --installer-deploy-dir, then copy the installers from ./generated_installers directory to the installer deploy directory +# +if [ ! -z "$installer_deploy_dir" ]; then + # vcell_siteCamel=Alpha + # vcell_version=7.0.0 + # vcell_build=19 + # version=7_0_0_19 + version=$(echo "${vcell_version}_${vcell_build}" | tr '.' _) + if ! scp "./generated_installers/VCell_${vcell_siteCamel}_windows-x64_${version}_64bit.exe" \ + "./generated_installers/VCell_${vcell_siteCamel}_unix_${version}_32bit.sh" \ + "./generated_installers/VCell_${vcell_siteCamel}_macos_${version}_64bit.dmg" \ + "./generated_installers/VCell_${vcell_siteCamel}_windows-x32_${version}_32bit.exe" \ + "./generated_installers/VCell_${vcell_siteCamel}_unix_${version}_64bit.sh" \ + "./generated_installers/updates.xml" \ + "./generated_installers/updates_linux32.xml" \ + "./generated_installers/updates_linux64.xml" \ + "./generated_installers/updates_mac64.xml" \ + "./generated_installers/updates_win32.xml" \ + "./generated_installers/updates_win64.xml" \ + "./generated_installers/output.txt" \ + "./generated_installers/md5sums" \ + "./generated_installers/sha256sums" \ + "$ssh_user@$manager_node:${installer_deploy_dir}"; + then + echo "failed to copy installers"; + exit 1; + fi +fi + +echo "exited normally" + +exit 0 diff --git a/docker/swarm/serverconfig-uch.sh b/docker/swarm/serverconfig-uch.sh index f15e7f4612..3f5c75e002 100755 --- a/docker/swarm/serverconfig-uch.sh +++ b/docker/swarm/serverconfig-uch.sh @@ -115,7 +115,7 @@ VCELL_SSH_CMD_RESTORE_TIMEOUT=5 # # write out the environment file to be for: -# 1. deployment actions (e.g. deploy-action-kubernetes.sh) +# 1. deployment actions (e.g. deploy-installers.sh) # 2. runtime environment for the docker stack run command (kubernetes uses ConfigMaps in vcell-fluxcd repo), what about VCell Installers? # cat <"$_outputfile"