Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions actions/balance-filter/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,3 @@ build

$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@ssw0rd@172.17.0.1:5984" --param db_name "balance_filter_db" -a provide-api-key true

clear_temp
2 changes: 0 additions & 2 deletions actions/balance-notification-registration/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,3 @@ build

$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@ssw0rd@172.17.0.1:5984" --web true

clear_temp
2 changes: 0 additions & 2 deletions actions/event-receiver/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,3 @@ build

$WSK_CLI -i --apihost "$openwhiskApiHost" action update ${ACTION} "$TEMP_DIR/main.zip" --docker "$DOCKER_IMAGE" \
--auth "$openwhiskApiKey" -a provide-api-key true

clear_temp
2 changes: 0 additions & 2 deletions actions/event-registration/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,3 @@ build

$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@ssw0rd@172.17.0.1:5984" --param feed "kafka-provider-feed" --param brokers "[\"172.17.0.1:9092\"]" -a provide-api-key true

clear_temp
2 changes: 0 additions & 2 deletions actions/kafka-provider-feed/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,3 @@ build

$WSK_CLI -i --apihost "$openwhiskApiHost" action update ${ACTION} "$TEMP_DIR/main.zip" --kind nodejs:default \
--auth "$openwhiskApiKey" -a feed true --param endpoint "http://172.17.0.1:8888" --param web_action "kafka-provider-web" -a provide-api-key true

clear_temp
2 changes: 0 additions & 2 deletions actions/kafka-provider-web/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,3 @@ build

$WSK_CLI -i --apihost "$openwhiskApiHost" action update ${ACTION} "$TEMP_DIR/main.zip" --kind nodejs:default \
--auth "$openwhiskApiKey" --param endpoint "http://172.17.0.1:8888" --param db_url "http://admin:p@ssw0rd@172.17.0.1:5984" --param db_name "ow_kafka_triggers" -a provide-api-key true --web true

clear_temp
2 changes: 0 additions & 2 deletions actions/push-notification/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,3 @@ $WSK_CLI -i --apihost "$openwhiskApiHost" action update ${ACTION} "$TEMP_DIR/mai

$WSK_CLI -i --apihost "$openwhiskApiHost" trigger update "send-${ACTION}" --auth "$openwhiskApiKey"
$WSK_CLI -i --apihost "$openwhiskApiHost" rule update "${ACTION}-rule" "send-${ACTION}" ${ACTION} --auth "$openwhiskApiKey"

clear_temp
2 changes: 0 additions & 2 deletions actions/substrate-event-processor/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,3 @@ $WSK_CLI -i --apihost "$openwhiskApiHost" action update ${ACTION} "$TEMP_DIR/mai

$WSK_CLI -i --apihost "$openwhiskApiHost" trigger update "produce-event" --auth "$openwhiskApiKey"
$WSK_CLI -i --apihost "$openwhiskApiHost" rule update "produce-event-rule" "produce-event" "event-producer" --auth "$openwhiskApiKey"

clear_temp
13 changes: 11 additions & 2 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,22 @@
openwhiskApiHost=${openwhiskApiHost:-https://localhost:31001}
openwhiskApiKey=${openwhiskApiKey:-23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP}
openwhiskNamespace=${openwhiskNamespace:-guest}
build=${build:-push-notification,balance-filter,event-receiver,event-registration,balance-notification-registration,event-producer,kafka-provider-feed,kafka-provider-web,substrate-event-processor}
skip=${skip:-}

actions=("actions/push-notification" "actions/balance-filter" "actions/event-receiver" "actions/event-registration" "actions/balance-notification-registration" "actions/event-producer" "actions/kafka-provider-feed" "actions/kafka-provider-web" "actions/substrate-event-processor")

source ./scripts/accept_params.sh
source ./scripts/util.sh

build_array=(${build//,/ })
skip_array=(${skip//,/ })

for index in ${!actions[@]};
do
chmod +x "$PWD/${actions[$index]}/deploy.sh"
"$PWD/${actions[$index]}/deploy.sh" --openwhiskApiHost "$openwhiskApiHost" --openwhiskApiKey "$openwhiskApiKey" --openwhiskNamespace "$openwhiskNamespace"
array_contains "${actions[$index]//actions\//}" "${skip_array[@]}" && true || {
array_contains "${actions[$index]//actions\//}" "${build_array[@]}" && should_build=true || should_build=false
chmod +x "$PWD/${actions[$index]}/deploy.sh"
"$PWD/${actions[$index]}/deploy.sh" --openwhiskApiHost "$openwhiskApiHost" --openwhiskApiKey "$openwhiskApiKey" --openwhiskNamespace "$openwhiskNamespace" --build $should_build
}
done
29 changes: 29 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,32 @@ Organization space where the actions to be deployed
./deploy.sh --openwhiskNamespace guest
```

###

### Build Action

Provide actions to be build, Accepts `none` or name of the actions separated by `,` to be build

| Parameter | Default Value |
| :--- | :--- |
| --build | push-notification,balance-filter,event-receiver,event-registration,balance-notification-registration,event-producer,kafka-provider-feed,kafka-provider-web,substrate-event-processor |

#### usage

```text
./deploy.sh --build push-notification
```

### Skip Build and Deploy Action

Provide actions to be skip, Accepts name of the available actions separated by `,`

| Parameter | Default Value |
| :--- | :--- |
| --skip | none |

#### usage

```text
./deploy.sh --skip push-notification,balance-filter
```
32 changes: 17 additions & 15 deletions scripts/build_js_action.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
if [ -e $TEMP_DIR ]; then
echo "Clearing previously packed action files."
rm -rf $TEMP_DIR
if [ "$build" = true ]; then
if [ -e $TEMP_DIR ]; then
echo "Clearing previously packed action files."
rm -rf $TEMP_DIR
fi

mkdir -p $TEMP_DIR
echo "Creating temporary directory"

echo "Copying files to temporary directory"
cp -r "$SRC_DIR/package.json" "$SRC_DIR/lib" "$SRC_DIR/main.js" $TEMP_DIR

cd $TEMP_DIR

yarn install --production=true

zip -r "$TEMP_DIR/main.zip" *
fi

mkdir -p $TEMP_DIR
echo "Creating temporary directory"

echo "Copying files to temporary directory"
cp -r "$SRC_DIR/package.json" "$SRC_DIR/lib" "$SRC_DIR/main.js" $TEMP_DIR

cd $TEMP_DIR

yarn install --production=true

zip -r "$TEMP_DIR/main.zip" *
28 changes: 14 additions & 14 deletions scripts/build_rust_action.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
DOCKER_IMAGE="hugobyte/openwhisk-runtime-rust:v0.2"

if [ -e $TEMP_DIR ]; then
echo "Clearing previously packed action files."
rm -rf $TEMP_DIR
if [ "$build" = true ]; then
if [ -e $TEMP_DIR ]; then
echo "Clearing previously packed action files."
rm -rf $TEMP_DIR
fi

mkdir -p $TEMP_DIR
echo "Creating temporary directory"

echo "Building Source to $TEMP_DIR/main.zip"

cd $SRC_DIR

zip -r - Cargo.toml src | docker run -e RELEASE=true -i --rm $DOCKER_IMAGE -compile main > "$TEMP_DIR/main.zip"
fi

mkdir -p $TEMP_DIR
echo "Creating temporary directory"

echo "Building Source to $TEMP_DIR/main.zip"

cd $SRC_DIR

zip -r - Cargo.toml src | docker run -e RELEASE=true -i --rm $DOCKER_IMAGE -compile main > "$TEMP_DIR/main.zip"

cd $TEMP_DIR
11 changes: 11 additions & 0 deletions scripts/util.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
array_contains () {
local seeking=$1; shift
local in=1
for element; do
if [[ $element == "$seeking" ]]; then
in=0
break
fi
done
return $in
}