-
Notifications
You must be signed in to change notification settings - Fork 6
Improvement for deployment script #1614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: hotfix-1.32.6
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,23 @@ | ||
| MAVEN := env("MAVEN", "mvn") | ||
| MAVEN_ARGS := "-am -Prelease -DskipTests" | ||
|
|
||
| export GEMMA_CLI_DEPLOY_SERVER := "pavlab" | ||
| # This is the general deployment server | ||
| DEPLOY_SERVER := "frink.pavlab.msl.ubc.ca" | ||
| PRODUCTION_DEPLOY_SERVER := "moe.pavlab.msl.ubc.ca" | ||
| DEVELOPMENT_DEPLOY_SERVER := "chalmers.pavlab.msl.ubc.ca" | ||
|
|
||
| export GEMMA_CLI_DEPLOY_SERVER := DEPLOY_SERVER | ||
| export GEMMA_CLI_PREFIX := "/space/opt/gemma-cli" | ||
| export GEMMA_CLI_WIKI_PAGE_SUFFIX := " (generated)" | ||
| export GEMMA_CLI_WIKI_DEPLOY_DEST := f"pavlab-wiki:Global/gemma/Gemma Landing Page/Gemma Curation/List of Gemma CLI Tools{{GEMMA_CLI_WIKI_PAGE_SUFFIX}}/" | ||
|
|
||
| export GEMMA_WEB_DEPLOY_SERVER := "chalmers" | ||
| export GEMMA_WEB_DEPLOY_SERVER := DEVELOPMENT_DEPLOY_SERVER | ||
| export GEMMA_WEB_PREFIX := "/var/local/tomcat" | ||
|
|
||
| export GEMMA_APPDATA_DIR := "/space/gemmaData" | ||
|
|
||
| export MAVEN_SITES_DEPLOY_SERVER := DEPLOY_SERVER | ||
|
|
||
| default: build | ||
|
|
||
| build: | ||
|
|
@@ -17,34 +26,48 @@ build: | |
| build-web: | ||
| {{MAVEN}} {{MAVEN_ARGS}} package -pl gemma-web | ||
|
|
||
| generate-dwr-client: | ||
| /scripts/generate-dwr-client.py | ||
|
|
||
| build-cli: | ||
| {{MAVEN}} {{MAVEN_ARGS}} package -pl gemma-cli | ||
|
|
||
| update-completion-scripts: build-cli | ||
| env GEMMA_CLI_ALIAS=gemma-cli ./gemma-cli/update-completion-scripts.sh | ||
| env GEMMA_CLI_ALIAS=gemma-cli-staging ./gemma-cli/update-completion-scripts.sh | ||
|
|
||
| generate-wiki: build-cli | ||
| generate-wiki page_suffix=" (generated)": build-cli | ||
| ./gemma-cli/target/appassembler/bin/gemma-cli --completion --completion-wiki --completion-wiki-output-dir gemma-cli/target/wiki --completion-wiki-page-suffix "{{GEMMA_CLI_WIKI_PAGE_SUFFIX}}" | ||
|
|
||
| deploy-wiki: generate-wiki | ||
| ./gemma-cli/deploy-wiki.sh "{{GEMMA_CLI_WIKI_DEPLOY_DEST}}" | ||
| deploy-wiki page_suffix: (generate-wiki page_suffix) | ||
| env GEMMA_CLI_WIKI_PAGE_SUFFIX="{{page_suffix}}" ./scripts/deploy-cli-wiki.sh "{{GEMMA_CLI_WIKI_DEPLOY_DEST}}" | ||
|
|
||
| deploy-wiki-staging: | ||
| just --justfile "{{justfile()}}" --set GEMMA_CLI_WIKI_PAGE_SUFFIX " (staging)" deploy-wiki | ||
| [confirm('Deploying to production manually is very dangerous. Proceed?')] | ||
| deploy-wiki-production: (deploy-wiki " (generated)") | ||
|
|
||
| deploy-wiki-dev: | ||
| just --justfile "{{justfile()}}" --set GEMMA_CLI_WIKI_PAGE_SUFFIX " (development)" deploy-wiki | ||
| deploy-wiki-staging: (deploy-wiki " (staging)") | ||
|
|
||
| deploy-wiki-dev: (deploy-wiki " (development)") | ||
|
|
||
| deploy-web ref: build-web | ||
| ./gemma-web/deploy.sh "{{ref}}" | ||
| ./scripts/deploy-web.sh "{{ref}}" | ||
|
|
||
| [confirm('Deploying to production manually is very dangerous. Proceed?')] | ||
| deploy-web-production: | ||
| just --justfile "{{justfile()}}" --set GEMMA_WEB_DEPLOY_SERVER {{PRODUCTION_DEPLOY_SERVER}} deploy-web 'gemma' | ||
|
|
||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @oganm I've added some tasks with confirmation in case you need to deploy to production manually.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A deployment to production should probably include a call to |
||
| deploy-web-staging: (deploy-web 'gemma-staging') | ||
|
|
||
| deploy-web-dev: (deploy-web 'gemma') | ||
|
|
||
| deploy-cli ref: build-cli update-completion-scripts | ||
| ./gemma-cli/deploy.sh "{{ref}}" | ||
| deploy-maven-site: | ||
| ./deploy-maven-site.sh | ||
|
|
||
| deploy-cli ref: build-cli | ||
| ./scripts/deploy-cli.sh "{{ref}}" | ||
|
|
||
| [confirm('Deploying to production manually is very dangerous. Proceed?')] | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Include a |
||
| deploy-cli-production: (deploy-cli 'production') | ||
|
|
||
| deploy-cli-staging: (deploy-cli 'staging') | ||
|
|
||
|
|
@@ -56,3 +79,18 @@ clean-cli: | |
|
|
||
| clean-web: | ||
| {{MAVEN}} {{MAVEN_ARGS}} clean -pl gemma-web | ||
|
|
||
| hotfix-start: | ||
| {{MAVEN}} gitflow:hotfix-start | ||
|
|
||
| hotfix-finish: | ||
| {{MAVEN}} gitflow:hotfix-finish | ||
|
|
||
| release-start: | ||
| {{MAVEN}} gitflow:release-start | ||
|
|
||
| release-finish: | ||
| {{MAVEN}} gitflow:release-finish | ||
|
|
||
| support-start: | ||
| {{MAVEN}} gitflow:support-start | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| #!/bin/sh | ||
|
|
||
| set -e | ||
|
|
||
| # | ||
| # Environment variables: | ||
| # MAVEN: Executable to use for Maven commands (defaults to mvn). | ||
| # GEMMA_APPDATA_HOME: Directory where Gemma data is stored on the deployment server. This will be used to create | ||
| # symbolic links to specific Maven websites that are then accessible at https://gemma.msl.ubc.ca/resources/. | ||
| # | ||
|
|
||
| MAVEN=mvn | ||
|
|
||
| # TODO: check for local deployment | ||
| if "$($MAVEN help:evaluate -Dexpression=local-deploy -q -DforceStdout)" ]; then | ||
| deploy_server= | ||
| else | ||
| deploy_server=$($MAVEN help:evaluate -Dexpression=pavlab.server -q -DforceStdout) | ||
| fi | ||
| maven_site_dir=$($MAVEN help:evaluate -Dexpression=pavlab.siteDir -q -DforceStdout) | ||
| gemma_version=$($MAVEN help:evaluate -Dexpression=project.version -q -DforceStdout) | ||
| basecode_version=$($MAVEN help:evaluate -Dartifact=baseCode:baseCode -Dexpression=project.version -q -DforceStdout) | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One important caveat here, |
||
|
|
||
| if [ -n "$deploy_server" ]; then | ||
| echo "Deploying Maven site to $deploy_server:$maven_site_dir..." | ||
| else | ||
| echo "Deploying Maven site to $maven_site_dir..." | ||
| fi | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To mimic what maven does, we need to check if a local deployment is performed and then only use the |
||
| mvn -B site-deploy -DskipWebpack | ||
| ([ -n "$deploy_server" ] && ssh "$deploy_server" || eval) <EOF | ||
| # maven site-deploy changes permission on the parent site directory (pavlab-starter-parent), | ||
| # but the Gemma site directory is not a subdirectory of it. | ||
| # This is replicating what the plugin is doing https://maven.apache.org/plugins/maven-site-plugin/deploy-mojo.html | ||
| chmod -Rf g+w,a+rX "$maven_site_dir/gemma/gemma-$gemma_version" || true | ||
|
|
||
| # create symbolic links | ||
| if [ -n "$GEMMA_APPDATA_HOME" ]; then | ||
| echo "Creating symbolic links for Gemma and baseCode in $GEMMA_APPDATA_HOME..." | ||
| mkdir -p "$GEMMA_APPDATA_HOME" | ||
| ln -Tsf "$maven_site_dir/gemma/gemma-$gemma_version" "$GEMMA_APPDATA_HOME/gemma-devsite" | ||
| ln -Tsf "$maven_site_dir/baseCode/baseCode-$basecode_version" "$GEMMA_APPDATA_HOME/baseCode-site" | ||
| fi | ||
| EOF | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be defined externally.