Skip to content

Commit

Permalink
Enable Cloud Deployment (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanseifert authored Jul 15, 2024
1 parent c102441 commit 45a0f55
Show file tree
Hide file tree
Showing 27 changed files with 777 additions and 419 deletions.
1 change: 1 addition & 0 deletions .cloudmanager/java-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
11
49 changes: 49 additions & 0 deletions build-deploy-author-and-publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash
# #%L
# wcm.io
# %%
# Copyright (C) 2021 wcm.io
# %%
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# #L%

# Builds the application, deploys it to local author, and then deploys it to local publish as well (without building it again)
# Deployment to author and publish runs in parallel

# Display a pause message (only when the script was executed via double-click on windows)
pause_message() {
if [ "$DISPLAY_PAUSE_MESSAGE_WRAPPER" = true ]; then
echo ""
read -n1 -r -p "Press any key to continue..."
fi
}

if [[ $0 == *":\\"* ]]; then
DISPLAY_PAUSE_MESSAGE_WRAPPER=true
fi

# Build application
./build-deploy.sh build --maven.profiles=fast "$@"
if [ "$?" -ne "0" ]; then
pause_message
exit $?
fi

# Deploy to author (in parallel)
./build-deploy.sh deploy --maven.profiles=fast --conga.node=aem-author "$@" &

# Deploy to publish (in parallel)
./build-deploy.sh deploy --maven.profiles=fast,publish --conga.node=aem-publish "$@" &

wait
pause_message
49 changes: 49 additions & 0 deletions build-deploy-author-and-publish_aem65.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash
# #%L
# wcm.io
# %%
# Copyright (C) 2022 wcm.io
# %%
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# #L%

# Builds the application, deploys it to local author, and then deploys it to local publish as well (without building it again)
# Deployment to author and publish runs in parallel

# Display a pause message (only when the script was executed via double-click on windows)
pause_message() {
if [ "$DISPLAY_PAUSE_MESSAGE_WRAPPER" = true ]; then
echo ""
read -n1 -r -p "Press any key to continue..."
fi
}

if [[ $0 == *":\\"* ]]; then
DISPLAY_PAUSE_MESSAGE_WRAPPER=true
fi

# Build application
./build-deploy.sh build --maven.profiles=fast,aem65 --conga.environment=local-aem65 "$@"
if [ "$?" -ne "0" ]; then
pause_message
exit $?
fi

# Deploy to author (in parallel)
./build-deploy.sh deploy --maven.profiles=fast,aem65 --conga.node=aem-author --conga.environment=local-aem65 "$@" &

# Deploy to publish (in parallel)
./build-deploy.sh deploy --maven.profiles=fast,publish,aem65 --conga.node=aem-publish --conga.environment=local-aem65 "$@" &

wait
pause_message
29 changes: 0 additions & 29 deletions build-deploy-defaultpersistence.sh

This file was deleted.

8 changes: 4 additions & 4 deletions build-deploy-publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# #%L
# wcm.io
# %%
# Copyright (C) 2017 wcm.io
# Copyright (C) 2017 - 2021 wcm.io
# %%
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -19,11 +19,11 @@

# Call with "help" parameter to display syntax information

SLING_URL="http://localhost:4503"
CONGA_NODE="aem-publish-aempage-persistence-strategy"
MAVEN_PROFILES="fast,publish"
CONGA_NODE="aem-publish"

if [[ $0 == *":\\"* ]]; then
DISPLAY_PAUSE_MESSAGE=true
fi

./build-deploy.sh --sling.url=${SLING_URL} --conga.node=${CONGA_NODE} --display.pause.message=${DISPLAY_PAUSE_MESSAGE} "$@"
./build-deploy.sh --maven.profiles=${MAVEN_PROFILES} --conga.node=${CONGA_NODE} --display.pause.message=${DISPLAY_PAUSE_MESSAGE} "$@"
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# #%L
# wcm.io
# %%
# Copyright (C) 2017 wcm.io
# Copyright (C) 2022 wcm.io
# %%
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -19,11 +19,12 @@

# Call with "help" parameter to display syntax information

SLING_URL="http://localhost:4503"
CONGA_NODE="aem-publish-default-persistence-strategy"
MAVEN_PROFILES="fast,publish,aem65"
CONGA_NODE="aem-publish"
CONGA_ENVIRONMENT="local-aem65"

if [[ $0 == *":\\"* ]]; then
DISPLAY_PAUSE_MESSAGE=true
fi

./build-deploy.sh --sling.url=${SLING_URL} --conga.node=${CONGA_NODE} --display.pause.message=${DISPLAY_PAUSE_MESSAGE} "$@"
./build-deploy.sh --maven.profiles=${MAVEN_PROFILES} --conga.node=${CONGA_NODE} --conga.environment=${CONGA_ENVIRONMENT} --display.pause.message=${DISPLAY_PAUSE_MESSAGE} "$@"
124 changes: 74 additions & 50 deletions build-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# #%L
# wcm.io
# %%
# Copyright (C) 2017 wcm.io
# Copyright (C) 2017 - 2022 wcm.io
# %%
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -20,11 +20,12 @@
# Call with "help" parameter to display syntax information

# defaults
SLING_URL="http://localhost:4502"
SLING_USER="admin"
SLING_PASSWORD="admin"
CONGA_ENVIRONMENT="development"
CONGA_NODE="aem-author-aempage-persistence-strategy"
MAVEN_PROFILES="fast"
SLING_URL=""
SLING_USER=""
SLING_PASSWORD=""
CONGA_ENVIRONMENT="local"
CONGA_NODE="aem-author"
JVM_ARGS=""

# display pause message only when script was executed via double-click on windows
Expand All @@ -36,19 +37,18 @@ DEPLOY=false
HELP=false
DEFAULT_COMMANDS=true

####

help_message_exit() {
echo ""
echo " Syntax <parameters> <commands>"
echo ""
echo " Parameters:"
echo " --sling.url=${SLING_URL}"
echo " --sling.user=${SLING_USER}"
echo " --sling.password=${SLING_PASSWORD}"
echo " --conga.environment=${CONGA_ENVIRONMENT}"
echo " --conga.node=${CONGA_NODE}"
echo " --jvm.args=${JVM_ARGS}"
echo " --maven.profiles=${MAVEN_PROFILES} or -P${MAVEN_PROFILES}"
echo " --sling.url=${SLING_URL} or -Dsling.url=${SLING_URL}"
echo " --sling.user=${SLING_USER} or -Dsling.user=${SLING_USER}"
echo " --sling.password=${SLING_PASSWORD} or -Dsling.password=${SLING_PASSWORD}"
echo " --conga.environment=${CONGA_ENVIRONMENT} or -Dconga.environment=${CONGA_ENVIRONMENT}"
echo " --conga.node=${CONGA_NODE} or -Dconga.node=${CONGA_NODE}"
echo " --jvm.args=${JVM_ARGS} or -Djvm.args=${JVM_ARGS}"
echo ""
echo " Commands:"
echo " build - Clean and install maven project"
Expand All @@ -64,6 +64,10 @@ parse_parameters() {
for i in "$@"
do
case $i in
--maven\.profiles=*|-P*)
MAVEN_PROFILES="${i#*=}"
shift # past argument=value
;;
--sling\.url=*|-Dsling\.url=*)
SLING_URL="${i#*=}"
shift # past argument=value
Expand Down Expand Up @@ -119,83 +123,102 @@ parse_parameters() {
}

welcome_message() {
echo -e "********************************************************************\e[96m"
echo "********************************************************************"
if ([ "$BUILD" = true ] && [ "$DEPLOY" = true ]) || [ "$HELP" = true ]; then
echo " ___ _ _ ___ _ ___ _ ___ ___ ___ _ _____ __"
echo " | _ ) | | |_ _| | | \ _| |_ | \| __| _ \ | / _ \ \ / /"
echo " | _ \ |_| || || |__| |) | |_ _| | |) | _|| _/ |_| (_) \ V /"
echo " |___/\___/|___|____|___/ |_| |___/|___|_| |____\___/ |_|"
echo -e "\e[96m ___ _ _ ___ _ ___ _ ___ ___ ___ _ _____ __\e[0m"
echo -e "\e[96m | _ ) | | |_ _| | | \ _| |_ | \| __| _ \ | / _ \ \ / /\e[0m"
echo -e "\e[96m | _ \ |_| || || |__| |) | |_ _| | |) | _|| _/ |_| (_) \ V /\e[0m"
echo -e "\e[96m |___/\___/|___|____|___/ |_| |___/|___|_| |____\___/ |_|\e[0m"
elif [ "$BUILD" = true ]; then
echo " ___ _ _ ___ _ ___ "
echo " | _ ) | | |_ _| | | \\"
echo " | _ \ |_| || || |__| |) |"
echo " |___/\___/|___|____|___/"
echo -e "\e[96m ___ _ _ ___ _ ___ \e[0m"
echo -e "\e[96m | _ ) | | |_ _| | | \\ \e[0m"
echo -e "\e[96m | _ \ |_| || || |__| |) |\e[0m"
echo -e "\e[96m |___/\___/|___|____|___/\e[0m"
elif [ "$DEPLOY" = true ]; then
echo " ___ ___ ___ _ _____ __"
echo " | \| __| _ \ | / _ \ \ / /"
echo " | |) | _|| _/ |_| (_) \ V /"
echo " |___/|___|_| |____\___/ |_|"
echo -e "\e[96m ___ ___ ___ _ _____ __\e[0m"
echo -e "\e[96m | \| __| _ \ | / _ \ \ / /\e[0m"
echo -e "\e[96m | |) | _|| _/ |_| (_) \ V /\e[0m"
echo -e "\e[96m |___/|___|_| |____\___/ |_|\e[0m"
fi
echo -e "\e[0m"
echo -e " Destination: \e[1m${SLING_URL}\e[0m (\e[1m${CONGA_NODE}\e[0m)"
echo ""
echo -e " Destination: \e[1m${CONGA_NODE}\e[0m (${MAVEN_PROFILES})"
echo ""
echo "********************************************************************"
}

completion_message() {
ELAPSED_TIME=$(($SECONDS - $START_TIME))
TOTAL_TIME="($(($ELAPSED_TIME/60)):$(printf "%02d" $(($ELAPSED_TIME%60))) min)"

echo ""
if [ "$BUILD" = true ] && [ "$DEPLOY" = true ]; then
echo -e "*** \e[1mBuild+Deploy complete\e[0m ***"
echo -e "*** \e[1mBuild+Deploy complete\e[0m $TOTAL_TIME ***"
elif [ "$BUILD" = true ]; then
echo -e "*** \e[1mBuild complete\e[0m ***"
echo -e "*** \e[1mBuild complete\e[0m $TOTAL_TIME ***"
elif [ "$DEPLOY" = true ]; then
echo -e "*** \e[1mDeploy complete\e[0m ***"
echo -e "*** \e[1mDeploy complete\e[0m $TOTAL_TIME ***"
fi
echo ""

pause_message
}

####

execute_build() {
echo ""
echo -e "*** \e[1mBuild application\e[0m ***"
echo ""

mvn ${JVM_ARGS} \
-Dconga.environments=${CONGA_ENVIRONMENT} \
-Pfast clean install eclipse:eclipse
MAVEN_ARGS=""
if [ -n "$JVM_ARGS" ]; then
MAVEN_ARGS+="${JVM_ARGS} "
fi
if [ -n "${MAVEN_PROFILES}" ]; then
MAVEN_ARGS+="--activate-profiles ${MAVEN_PROFILES} "
fi
if [ -n "${CONGA_ENVIRONMENT}" ]; then
MAVEN_ARGS+="-Dconga.environments=${CONGA_ENVIRONMENT} "
fi

mvn $MAVEN_ARGS clean install eclipse:eclipse

if [ "$?" -ne "0" ]; then
exit_with_error "*** BUILD FAILED ***"
fi
}

####

execute_deploy() {
echo ""
echo -e "*** \e[1mDeploy to AEM\e[0m ***"
echo ""

mvn -f config-definition \
${JVM_ARGS} \
-Dconga.environments=${CONGA_ENVIRONMENT} \
-Dconga.nodeDirectory=target/configuration/${CONGA_ENVIRONMENT}/${CONGA_NODE} \
-Dsling.url=${SLING_URL} \
-Dsling.user=${SLING_USER} \
-Dsling.password=${SLING_PASSWORD} \
conga-aem:package-install
MAVEN_ARGS=""
if [ -n "$JVM_ARGS" ]; then
MAVEN_ARGS+="${JVM_ARGS} "
fi
if [ -n "${MAVEN_PROFILES}" ]; then
MAVEN_ARGS+="--activate-profiles=${MAVEN_PROFILES} "
fi
if [ -n "${CONGA_ENVIRONMENT}" ]; then
MAVEN_ARGS+="-Dvault.file=target/${CONGA_ENVIRONMENT}.all.zip -Dvault.force=true"
fi
if [ -n "${SLING_URL}" ]; then
MAVEN_ARGS+="-Dsling.url=${SLING_URL} "
fi
if [ -n "${SLING_USER}" ]; then
MAVEN_ARGS+="-Dsling.user=${SLING_USER} "
fi
if [ -n "${SLING_PASSWORD}" ]; then
MAVEN_ARGS+="-Dsling.password=${SLING_PASSWORD} "
fi

mvn $MAVEN_ARGS -f config-definition wcmio-content-package:install

if [ "$?" -ne "0" ]; then
exit_with_error "*** DEPLOY FAILED ***"
fi

}

####

# Display a pause message (only when the script was executed via double-click on windows)
pause_message() {
if [ "$DISPLAY_PAUSE_MESSAGE" = true ]; then
Expand All @@ -212,7 +235,8 @@ exit_with_error() {
exit 1
}

####

START_TIME=$SECONDS

parse_parameters "$@"
welcome_message
Expand Down
Loading

0 comments on commit 45a0f55

Please sign in to comment.