Skip to content

Commit c38172c

Browse files
committed
Improvement for deployment script
Relocate deployment scripts in a single scripts/ location.
1 parent 39cc6a5 commit c38172c

13 files changed

Lines changed: 112 additions & 35 deletions

.idea/runConfigurations/Deploy_CLI_Wiki__production_.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/Deploy_CLI_Wiki__staging_.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/Deploy_CLI__staging_.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/Deploy__dev_.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/Deploy__staging_.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/Generate_DWR_client.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.jenkins/Jenkinsfile

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -267,17 +267,7 @@ pipeline {
267267
}
268268
}
269269
steps {
270-
sh 'mvn -B site-deploy -DskipWebpack'
271-
script {
272-
// maven site-deploy changes permission on the parent site directory (pavlab-starter-parent),
273-
// but the Gemma site directory is not a subdirectory of it.
274-
// This is replicating what the plugin is doing https://maven.apache.org/plugins/maven-site-plugin/deploy-mojo.html
275-
sh "chmod -Rf g+w,a+rX ${params.MAVEN_SITES_DIR}/gemma/gemma-${gemmaVersion} || true"
276-
if (dataDir != null) {
277-
sh "ln -Tsf ${params.MAVEN_SITES_DIR}/gemma/gemma-${gemmaVersion} ${dataDir}/gemma-devsite"
278-
sh "ln -Tsf ${params.MAVEN_SITES_DIR}/baseCode/baseCode-${baseCodeVersion} ${dataDir}/baseCode-site"
279-
}
280-
}
270+
sh "./scripts/deploy-maven-site.sh"
281271
}
282272
}
283273
stage('Deploy Gemma Web') {
@@ -291,7 +281,7 @@ pipeline {
291281
}
292282
}
293283
steps {
294-
sh "env GEMMA_WEB_DEPLOY_SERVER=${deployServer} GEMMA_WEB_PREFIX=${params.DEPLOY_DIR_PREFIX} ./gemma-web/deploy.sh ${deployRef}"
284+
sh "env GEMMA_WEB_DEPLOY_SERVER=${deployServer} GEMMA_WEB_PREFIX=${params.DEPLOY_DIR_PREFIX} ./scripts/deploy-web.sh ${deployRef}"
295285
}
296286
}
297287
stage('Deploy Gemma CLI') {
@@ -305,8 +295,8 @@ pipeline {
305295
}
306296
}
307297
steps {
308-
sh "env GEMMA_CLI_PREFIX=${params.CLI_DIR_PREFIX} ./gemma-cli/deploy.sh ${cliRef}"
309-
sh "env GEMMA_CLI_WIKI_PAGE_SUFFIX='${cliWikiPageSuffix}' ./gemma-cli/deploy-wiki.sh 'pavlab-wiki:Global/gemma/Gemma Landing Page/Gemma Curation/List of Gemma CLI Tools${cliWikiPageSuffix}'"
298+
sh "env GEMMA_CLI_PREFIX=${params.CLI_DIR_PREFIX} ./scripts/deploy-cli.sh ${cliRef}"
299+
sh "env GEMMA_CLI_WIKI_PAGE_SUFFIX='${cliWikiPageSuffix}' ./scripts/deploy-cli-wiki.sh 'pavlab-wiki:Global/gemma/Gemma Landing Page/Gemma Curation/List of Gemma CLI Tools${cliWikiPageSuffix}'"
310300
}
311301
}
312302
}

justfile

Lines changed: 50 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
MAVEN := env("MAVEN", "mvn")
22
MAVEN_ARGS := "-am -Prelease -DskipTests"
33

4-
export GEMMA_CLI_DEPLOY_SERVER := "pavlab"
4+
# This is the general deployment server
5+
DEPLOY_SERVER := "frink.pavlab.msl.ubc.ca"
6+
PRODUCTION_DEPLOY_SERVER := "moe.pavlab.msl.ubc.ca"
7+
DEVELOPMENT_DEPLOY_SERVER := "chalmers.pavlab.msl.ubc.ca"
8+
9+
export GEMMA_CLI_DEPLOY_SERVER := DEPLOY_SERVER
510
export GEMMA_CLI_PREFIX := "/space/opt/gemma-cli"
611
export GEMMA_CLI_WIKI_PAGE_SUFFIX := " (generated)"
712
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}}/"
813

9-
export GEMMA_WEB_DEPLOY_SERVER := "chalmers"
14+
export GEMMA_WEB_DEPLOY_SERVER := DEVELOPMENT_DEPLOY_SERVER
1015
export GEMMA_WEB_PREFIX := "/var/local/tomcat"
1116

17+
export GEMMA_APPDATA_DIR := "/space/gemmaData"
18+
19+
export MAVEN_SITES_DEPLOY_SERVER := DEPLOY_SERVER
20+
1221
default: build
1322

1423
build:
@@ -17,34 +26,48 @@ build:
1726
build-web:
1827
{{MAVEN}} {{MAVEN_ARGS}} package -pl gemma-web
1928

29+
generate-dwr-client:
30+
/scripts/generate-dwr-client.py
31+
2032
build-cli:
2133
{{MAVEN}} {{MAVEN_ARGS}} package -pl gemma-cli
2234

2335
update-completion-scripts: build-cli
2436
env GEMMA_CLI_ALIAS=gemma-cli ./gemma-cli/update-completion-scripts.sh
2537
env GEMMA_CLI_ALIAS=gemma-cli-staging ./gemma-cli/update-completion-scripts.sh
2638

27-
generate-wiki: build-cli
39+
generate-wiki page_suffix=" (generated)": build-cli
2840
./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}}"
2941

30-
deploy-wiki: generate-wiki
31-
./gemma-cli/deploy-wiki.sh "{{GEMMA_CLI_WIKI_DEPLOY_DEST}}"
42+
deploy-wiki page_suffix: (generate-wiki page_suffix)
43+
env GEMMA_CLI_WIKI_PAGE_SUFFIX="{{page_suffix}}" ./scripts/deploy-cli-wiki.sh "{{GEMMA_CLI_WIKI_DEPLOY_DEST}}"
3244

33-
deploy-wiki-staging:
34-
just --justfile "{{justfile()}}" --set GEMMA_CLI_WIKI_PAGE_SUFFIX " (staging)" deploy-wiki
45+
[confirm('Deploying to production manually is very dangerous. Proceed?')]
46+
deploy-wiki-production: (deploy-wiki " (generated)")
3547

36-
deploy-wiki-dev:
37-
just --justfile "{{justfile()}}" --set GEMMA_CLI_WIKI_PAGE_SUFFIX " (development)" deploy-wiki
48+
deploy-wiki-staging: (deploy-wiki " (staging)")
49+
50+
deploy-wiki-dev: (deploy-wiki " (development)")
3851

3952
deploy-web ref: build-web
40-
./gemma-web/deploy.sh "{{ref}}"
53+
./scripts/deploy-web.sh "{{ref}}"
54+
55+
[confirm('Deploying to production manually is very dangerous. Proceed?')]
56+
deploy-web-production:
57+
just --justfile "{{justfile()}}" --set GEMMA_WEB_DEPLOY_SERVER {{PRODUCTION_DEPLOY_SERVER}} deploy-web 'gemma'
4158

4259
deploy-web-staging: (deploy-web 'gemma-staging')
4360

4461
deploy-web-dev: (deploy-web 'gemma')
4562

46-
deploy-cli ref: build-cli update-completion-scripts
47-
./gemma-cli/deploy.sh "{{ref}}"
63+
deploy-maven-site:
64+
./deploy-maven-site.sh
65+
66+
deploy-cli ref: build-cli
67+
./scripts/deploy-cli.sh "{{ref}}"
68+
69+
[confirm('Deploying to production manually is very dangerous. Proceed?')]
70+
deploy-cli-production: (deploy-cli 'production')
4871

4972
deploy-cli-staging: (deploy-cli 'staging')
5073

@@ -56,3 +79,18 @@ clean-cli:
5679

5780
clean-web:
5881
{{MAVEN}} {{MAVEN_ARGS}} clean -pl gemma-web
82+
83+
hotfix-start:
84+
{{MAVEN}} gitflow:hotfix-start
85+
86+
hotfix-finish:
87+
{{MAVEN}} gitflow:hotfix-finish
88+
89+
release-start:
90+
{{MAVEN}} gitflow:release-start
91+
92+
release-finish:
93+
{{MAVEN}} gitflow:release-finish
94+
95+
support-start:
96+
{{MAVEN}} gitflow:support-start
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ if [ ! -d "$gemma_cli_dir" ]; then
5353
fi
5454

5555
echo "Generating Gemma CLI Wiki pages under $gemma_cli_wiki_dir..."
56-
./gemma-cli/target/appassembler/bin/gemma-cli --completion --completion-wiki --completion-wiki-output-dir "$gemma_cli_wiki_dir" --completion-wiki-page-suffix "$gemma_cli_wiki_page_suffix"
56+
"$gemma_cli_dir/bin/gemma-cli --completion --completion-wiki --completion-wiki-output-dir "$gemma_cli_wiki_dir" --completion-wiki-page-suffix "$gemma_cli_wiki_page_suffix"
5757
5858
echo "Deploying Gemma CLI Wiki to $wiki_dest..."
5959
rclone "$rclone_command" "$gemma_cli_wiki_dir/List of Gemma CLI Tools$gemma_cli_wiki_page_suffix/" "$wiki_dest" --exclude '@*/**' --exclude '*.url'
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
# GEMMA_CLI_DEPLOY_SERVER: The server to deploy the Gemma CLI to.
1414
# GEMMA_CLI_PREFIX: The prefix for the Gemma CLI deployment directory (defaults to /space/opt/gemma-cli).
1515
#
16+
# Note: you need a recent version of rsync with the --mkpath option.
17+
#
1618

1719
set -e
1820

@@ -78,8 +80,10 @@ if [ -z "$deploy_server" ]; then
7880
mkdir -p "$gemma_cli_prefix/refs"
7981
ln -sTf "$build_dir" "$build_ref_dir"
8082
else
81-
ssh "$deploy_server" mkdir -p "$gemma_cli_prefix/refs"
82-
ssh "$deploy_server" ln -sTf "$build_dir" "$build_ref_dir"
83+
ssh "$deploy_server" <EOF
84+
mkdir -p "$gemma_cli_prefix/refs"
85+
ln -sTf "$build_dir" "$build_ref_dir"
86+
EOF
8387
fi
8488

8589
echo "Deployment completed!"

0 commit comments

Comments
 (0)