Skip to content

Commit 4aa59df

Browse files
Merge pull request #10 from AnthonyAmanse/update-readme
Add alternative deployments to README
2 parents 5f1a717 + aaa207b commit 4aa59df

File tree

8 files changed

+97
-2
lines changed

8 files changed

+97
-2
lines changed

README-Deploy-UI.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Deploy through the IBM Cloud Functions console user interface
2+
3+
* Create a Trigger
4+
Click on `Create Trigger` then choose `Cloudant`. At the **Cloudant Instance** section, choose to "Input your own credentials". Enter your Cloudant's **Username**, **Password**, **Host**. Enter `images` as your **Database** if you have created that name of the database at the previous step. Name the Trigger "update-trigger".
5+
6+
![create-trigger](docs/create-trigger.png)
7+
8+
* Then click on `Add +` on the **Connected Actions section** then choose `Create Action` with a `Node.js 8` as the **Runtime**. Name the action "update-document-with-watson".
9+
10+
![connected-action](docs/connected-action.png)
11+
12+
![create-action](docs/create-action.png)
13+
14+
* Then click on the action and copy and paste the code in [`actions/updateDocumentWithWatson.js`](actions/updateDocumentWithWatson.js) to the editor in the browser.
15+
16+
![action](docs/action.png)
17+
18+
![code-action](docs/code-action.png)
19+
20+
* Then go to the `Parameters` section and add these parameters with the values of your own.
21+
22+
![parameters](docs/parameters.png)
23+
24+
You may now proceed to [Step 4 in the main README](README.md#4-launch-application)

README.md

Lines changed: 73 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,26 @@ Create a [**Cloudant**](https://console.bluemix.net/catalog/services/cloudant) i
5959
Create a [Watson Visual Recognition](https://console.bluemix.net/catalog/services/visual-recognition) instance.
6060
* Copy the API Key in the Credentials section and paste it in the `local.env` file in the value of `WATSON_VISUAL_APIKEY`
6161

62-
### 3. Create Cloud Functions
62+
### 3. Deploy Cloud Functions
63+
> Choose one of the deployment methods
6364
64-
Make sure you have the right environment variables in the `local.env` file. Export them in your terminal then deploy the Cloud Functions using `wskdeploy`:
65+
## Deploy through the IBM Cloud Functions console user interface
66+
67+
Choose ["Start Creating"](https://console.bluemix.net/openwhisk/create) in the IBM Cloud Functions Dashboard. [Then proceed to this deployment instructions using the UI](README-Deploy-UI.md).
68+
69+
You can also deploy them directly from the CLI by following the steps in the next section.
70+
71+
## Deploy using the wskdeploy command line tool
72+
73+
Make sure you have the right environment variables in the `local.env` file. Export them in your terminal then deploy the Cloud Functions using `wskdeploy`. This uses the `manifest.yaml` file in this root directory.
6574

6675
```
6776
$ source local.env
6877
$ wskdeploy
6978
```
7079

80+
> You may want to undeploy them later with `wskdeploy undeploy`
81+
7182
### 4. Launch Application
7283

7384
Configure `web/scripts/upload.js`. Modify the lines for your Cloudant credentials.
@@ -91,6 +102,66 @@ $ npm start
91102

92103
![sample-output](docs/screenshot.png)
93104

105+
# Alternative Deployment Methods
106+
107+
### Deploy manually with the `ibmcloud wsk` command line tool
108+
109+
This approach shows you how to deploy individual the packages, actions, triggers, and rules with CLI commands. It helps you understand and control the underlying deployment artifacts.
110+
111+
* Export credentials
112+
```
113+
$ source local.env
114+
```
115+
116+
* Create Cloudant Binding
117+
118+
```
119+
$ ibmcloud wsk package bind /whisk.system/cloudant serverless-pattern-cloudant-package \
120+
-p username $CLOUDANT_USERNAME \
121+
-p password $CLOUDANT_PASSWORD \
122+
-p host ${CLOUDANT_USERNAME}.cloudant.com
123+
```
124+
125+
* Create the Cloudant Trigger
126+
127+
The trigger will listen to changes in the `images` database.
128+
129+
```
130+
$ ibmcloud wsk trigger create update-trigger --feed serverless-pattern-cloudant-package/changes \
131+
--param dbname images
132+
```
133+
134+
* Create the Action
135+
136+
The action executes your code. The code is already configured to use the Watson SDK.
137+
138+
```
139+
$ ibmcloud wsk action create update-document-with-watson actions/updateDocumentWithWatson.js \
140+
--kind nodejs:8 \
141+
--param USERNAME $CLOUDANT_USERNAME \
142+
--param PASSWORD $CLOUDANT_PASSWORD \
143+
--param DBNAME $CLOUDANT_IMAGE_DATABASE \
144+
--param DBNAME_PROCESSED $CLOUDANT_TAGS_DATABASE \
145+
--param WATSON_VR_APIKEY $WATSON_VISUAL_APIKEY
146+
```
147+
148+
* Create the Rule
149+
150+
The rule will connect invoke the action when the trigger receives an event.
151+
152+
```
153+
$ ibmcloud wsk rule create update-trigger-rule update-trigger update-document-with-watson
154+
```
155+
156+
* To delete them
157+
158+
```
159+
$ ibmcloud wsk package delete serverless-pattern-cloudant-package
160+
$ ibmcloud wsk trigger delete update-trigger
161+
$ ibmcloud wsk action delete update-document-with-watson
162+
$ ibmcloud wsk rule delete update-trigger-rule
163+
```
164+
94165
# Links
95166

96167
* [Apache OpenWhisk](http://openwhisk.incubator.apache.org/): Open source cloud platform that executes functions in response to events at any scale.

docs/action.png

241 KB
Loading

docs/code-action.png

561 KB
Loading

docs/connected-action.png

228 KB
Loading

docs/create-action.png

352 KB
Loading

docs/create-trigger.png

349 KB
Loading

docs/parameters.png

338 KB
Loading

0 commit comments

Comments
 (0)