-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·25 lines (20 loc) · 1.28 KB
/
deploy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
if [ -z "$COUCH_HOST" ]; then echo "COUCH_HOST is required"; exit 1; fi
if [ -z "$COUCH_DATABASE" ]; then echo "COUCH_DATABASE is required"; exit 1; fi
# deploy to OpenWhisk
bx wsk package update proxy --param COUCH_HOST $COUCH_HOST --param COUCH_DATABASE $COUCH_DATABASE
# create actions
cd actions
ls *.js | tr '\n' '\0' | xargs -0 -n1 ./deploy_action.sh
cd ..
# create API
bx wsk api create /proxy "/$COUCH_DATABASE" get proxy/get_db --response-type http
bx wsk api create /proxy "/$COUCH_DATABASE" put proxy/put_db --response-type http
bx wsk api create /proxy "/$COUCH_DATABASE" delete proxy/del_db --response-type http
bx wsk api create /proxy "/$COUCH_DATABASE/_all_docs" get proxy/all_docs --response-type http
bx wsk api create /proxy "/$COUCH_DATABASE/_all_docs" post proxy/all_docs --response-type http
bx wsk api create /proxy "/$COUCH_DATABASE/_bulk_docs" post proxy/bulk_docs --response-type http
bx wsk api create /proxy "/$COUCH_DATABASE/_bulk_get" get proxy/get_bulk_get --response-type http
bx wsk api create /proxy "/$COUCH_DATABASE/_bulk_get" post proxy/post_bulk_get --response-type http
bx wsk api create /proxy "/$COUCH_DATABASE/_revs_diff" post proxy/revs_diff --response-type http
bx wsk api create /proxy "/$COUCH_DATABASE/_changes" get proxy/changes --response-type http