-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from HugoByte/hotfix/refactor-deploy-script
[Hotfix] Refactor deploy script
- Loading branch information
Showing
16 changed files
with
209 additions
and
368 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,46 +7,22 @@ openwhiskApiHost=${openwhiskApiHost:-https://localhost:31001} | |
openwhiskApiKey=${openwhiskApiKey:-23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP} | ||
openwhiskNamespace=${openwhiskNamespace:-guest} | ||
actionHome=${actionHome:-actions/balance-filter} | ||
WSK_CLI="wsk" | ||
DOCKER_IMAGE="hugobyte/openwhisk-runtime-rust:v0.2" | ||
if ! command -v $WSK_CLI &> /dev/null | ||
then | ||
echo "wsk cli not found in path. Please get the cli from https://github.com/apache/openwhisk-cli/releases" | ||
exit | ||
fi | ||
ACTION="balance-filter" | ||
PACKAGE_HOME="$PWD/${actionHome}/temp/$ACTION" | ||
|
||
while [ $# -gt 0 ]; do | ||
if [[ $1 == *"--"* ]]; then | ||
param="${1/--/}" | ||
declare $param="${2%/}" | ||
fi | ||
|
||
shift | ||
done | ||
|
||
set -e | ||
|
||
cd "$PWD/$actionHome" | ||
ACTION="balance-filter" | ||
ACTION_TYPE="rust" | ||
SCRIPTS_DIR="$PWD/scripts" | ||
SRC_DIR="$PWD/${actionHome}" | ||
TEMP_DIR="$PWD/${actionHome}/temp" | ||
|
||
if [ -e ./temp/${ACTION} ]; then | ||
echo "Clearing previously packed action file." | ||
rm -rf ./temp/${ACTION} | ||
fi | ||
source "$SCRIPTS_DIR/accept_params.sh" | ||
source "$SCRIPTS_DIR/check_dependencies.sh" | ||
source "$SCRIPTS_DIR/build_action.sh" | ||
|
||
mkdir -p ./temp/${ACTION} | ||
echo "Creating temporary directory" | ||
echo "$PACKAGE_HOME/main.zip" | ||
echo "Building Source" | ||
zip -r - Cargo.toml src | docker run -i --rm ${DOCKER_IMAGE} -compile main > "$PACKAGE_HOME/main.zip" | ||
check wsk | ||
|
||
cd ./temp/${ACTION} | ||
build | ||
|
||
$WSK_CLI -i --apihost "$openwhiskApiHost" action update ${ACTION} "$PACKAGE_HOME/main.zip" --docker "$DOCKER_IMAGE" \ | ||
--auth "$openwhiskApiKey" --param push_notification_trigger "send-push-notification" --param db_url "http://admin:p@[email protected]:5984" --param db_name "balance_filter_db" -a provide-api-key true | ||
$WSK_CLI -i --apihost "$openwhiskApiHost" action update ${ACTION} "$TEMP_DIR/main.zip" --docker "$DOCKER_IMAGE" \ | ||
--auth "$openwhiskApiKey" --param push_notification_trigger "send-push-notification" --param db_url "http://admin:p@[email protected]:5984" --param db_name "balance_filter_db" -a provide-api-key true | ||
|
||
if [ -e ./temp/${ACTION} ]; then | ||
echo "Clearing temporary packed action file." | ||
rm -rf ./temp/${ACTION} | ||
fi | ||
clear_temp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,46 +7,22 @@ openwhiskApiHost=${openwhiskApiHost:-https://localhost:31001} | |
openwhiskApiKey=${openwhiskApiKey:-23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP} | ||
openwhiskNamespace=${openwhiskNamespace:-guest} | ||
actionHome=${actionHome:-actions/balance-notification-registration} | ||
WSK_CLI="wsk" | ||
DOCKER_IMAGE="hugobyte/openwhisk-runtime-rust:v0.2" | ||
if ! command -v $WSK_CLI &> /dev/null | ||
then | ||
echo "wsk cli not found in path. Please get the cli from https://github.com/apache/openwhisk-cli/releases" | ||
exit | ||
fi | ||
ACTION="balance-notification-registration" | ||
PACKAGE_HOME="$PWD/${actionHome}/temp/$ACTION" | ||
|
||
while [ $# -gt 0 ]; do | ||
if [[ $1 == *"--"* ]]; then | ||
param="${1/--/}" | ||
declare $param="${2%/}" | ||
fi | ||
|
||
shift | ||
done | ||
|
||
set -e | ||
|
||
cd "$PWD/$actionHome" | ||
ACTION="balance-notification-registration" | ||
ACTION_TYPE="rust" | ||
SCRIPTS_DIR="$PWD/scripts" | ||
SRC_DIR="$PWD/${actionHome}" | ||
TEMP_DIR="$PWD/${actionHome}/temp" | ||
|
||
if [ -e ./temp/${ACTION} ]; then | ||
echo "Clearing previously packed action file." | ||
rm -rf ./temp/${ACTION} | ||
fi | ||
source "$SCRIPTS_DIR/accept_params.sh" | ||
source "$SCRIPTS_DIR/check_dependencies.sh" | ||
source "$SCRIPTS_DIR/build_action.sh" | ||
|
||
mkdir -p ./temp/${ACTION} | ||
echo "Creating temporary directory" | ||
echo "$PACKAGE_HOME/main.zip" | ||
echo "Building Source" | ||
zip -r - Cargo.toml src | docker run -e RELEASE=true -i --rm ${DOCKER_IMAGE} -compile main > "$PACKAGE_HOME/main.zip" | ||
check wsk | ||
|
||
cd ./temp/${ACTION} | ||
build | ||
|
||
$WSK_CLI -i --apihost "$openwhiskApiHost" action update ${ACTION} "$PACKAGE_HOME/main.zip" --docker "$DOCKER_IMAGE" \ | ||
--auth "$openwhiskApiKey" --param event_registration_db "event_registration_db" --param balance_filter_db "balance_filter_db" --param db_name "balance_notification_registration_db" --param db_url "http://admin:p@[email protected]:5984" --web true | ||
$WSK_CLI -i --apihost "$openwhiskApiHost" action update ${ACTION} "$TEMP_DIR/main.zip" --docker "$DOCKER_IMAGE" \ | ||
--auth "$openwhiskApiKey" --param event_registration_db "event_registration_db" --param balance_filter_db "balance_filter_db" --param db_name "balance_notification_registration_db" --param db_url "http://admin:p@[email protected]:5984" --web true | ||
|
||
if [ -e ./temp/${ACTION} ]; then | ||
echo "Clearing temporary packed action file." | ||
rm -rf ./temp/${ACTION} | ||
fi | ||
clear_temp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,46 +7,22 @@ openwhiskApiHost=${openwhiskApiHost:-https://localhost:31001} | |
openwhiskApiKey=${openwhiskApiKey:-23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP} | ||
openwhiskNamespace=${openwhiskNamespace:-guest} | ||
actionHome=${actionHome:-actions/event-registration} | ||
WSK_CLI="wsk" | ||
DOCKER_IMAGE="hugobyte/openwhisk-runtime-rust:v0.2" | ||
if ! command -v $WSK_CLI &> /dev/null | ||
then | ||
echo "wsk cli not found in path. Please get the cli from https://github.com/apache/openwhisk-cli/releases" | ||
exit | ||
fi | ||
ACTION="event-registration" | ||
PACKAGE_HOME="$PWD/${actionHome}/temp/$ACTION" | ||
|
||
while [ $# -gt 0 ]; do | ||
if [[ $1 == *"--"* ]]; then | ||
param="${1/--/}" | ||
declare $param="${2%/}" | ||
fi | ||
|
||
shift | ||
done | ||
|
||
set -e | ||
|
||
cd "$PWD/$actionHome" | ||
ACTION="event-registration" | ||
ACTION_TYPE="rust" | ||
SCRIPTS_DIR="$PWD/scripts" | ||
SRC_DIR="$PWD/${actionHome}" | ||
TEMP_DIR="$PWD/${actionHome}/temp" | ||
|
||
if [ -e ./temp/${ACTION} ]; then | ||
echo "Clearing previously packed action file." | ||
rm -rf ./temp/${ACTION} | ||
fi | ||
source "$SCRIPTS_DIR/accept_params.sh" | ||
source "$SCRIPTS_DIR/check_dependencies.sh" | ||
source "$SCRIPTS_DIR/build_action.sh" | ||
|
||
mkdir -p ./temp/${ACTION} | ||
echo "Creating temporary directory" | ||
echo "$PACKAGE_HOME/main.zip" | ||
echo "Building Source" | ||
zip -r - Cargo.toml src | docker run -e RELEASE=true -i --rm ${DOCKER_IMAGE} -compile main > "$PACKAGE_HOME/main.zip" | ||
check wsk | ||
|
||
cd ./temp/${ACTION} | ||
build | ||
|
||
$WSK_CLI -i --apihost "$openwhiskApiHost" action update ${ACTION} "$PACKAGE_HOME/main.zip" --docker "$DOCKER_IMAGE" \ | ||
--auth "$openwhiskApiKey" --param db_name "event_registration_db" --param db_url "http://admin:p@[email protected]:5984" --param feed "kafka-provider-feed" --param brokers "[\"172.17.0.1:9092\"]" -a provide-api-key true | ||
$WSK_CLI -i --apihost "$openwhiskApiHost" action update ${ACTION} "$TEMP_DIR/main.zip" --docker "$DOCKER_IMAGE" \ | ||
--auth "$openwhiskApiKey" --param db_name "event_registration_db" --param db_url "http://admin:p@[email protected]:5984" --param feed "kafka-provider-feed" --param brokers "[\"172.17.0.1:9092\"]" -a provide-api-key true | ||
|
||
if [ -e ./temp/${ACTION} ]; then | ||
echo "Clearing temporary packed action file." | ||
rm -rf ./temp/${ACTION} | ||
fi | ||
clear_temp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.