You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 24, 2020. It is now read-only.
Use the IBM Watson [Discovery][service_url] service to add a cognitive search and content analytics engine to your applications to identify patterns, trends and actionable insights that drive better decision-making.
<h3align="center">Use the IBM Watson Discovery service to add a cognitive search and content analytics engine to your applications to identify patterns, trends and actionable insights that drive better decision-making.</h3>
To deploy this repository as-is, click the "Deploy to IBM Cloud" button
19
+
1. Sign up for an [IBM Cloud account](https://console.bluemix.net/registration/).
20
+
1. Download the [IBM Cloud CLI](https://console.bluemix.net/docs/cli/index.html#overview).
21
+
1. Create an instance of the Discovery service and get your credentials:
22
+
- Go to the [Discovery](https://console.bluemix.net/catalog/services/discovery) page in the IBM Cloud Catalog.
23
+
- Log in to your IBM Cloud account.
24
+
- Click **Create**.
25
+
- Click **Show** to view the service credentials.
26
+
- Copy the `apikey` value, or copy the `username` and `password` values if your service instance doesn't provide an `apikey`.
27
+
- Copy the `url` value.
13
28
14
-
[![Deploy to IBM Cloud][deploy_button_url]][deploy_url]
29
+
## Configuring the application
15
30
16
-
When this button is clicked, it will begin the process of creating a deployment toolchain based on the master branch of the repo into Bluemix and you will have to modify the application name to the name of the host you want to put it at. The default will get mapped to {organization/user}-{repo_name}-{timestamp}.
31
+
1. In the application folder, copy the *.env.example* file and create a file called *.env*
17
32
18
-
After creating the toolchain, you must either run the deployment script as part of the [Continuous Delivery](https://www.ibm.com/devops/method/content/deliver/practice_continuous_delivery/) which will create the service for you, or refer to the [Setup a IBM Watson Discovery Service](#setup-a-ibm-watson-discovery-service) section below to create it manually.
33
+
```
34
+
cp .env.example .env
35
+
```
19
36
20
-
For more details about developing applications that use Watson Developer Cloud services in Bluemix, see [Getting started with Watson Developer Cloud and Bluemix][getting_started].
37
+
2. Open the *.env* file and add the service credentials that you obtained in the previous step.
21
38
22
-
## Development
39
+
Example *.env* file that configures the `apikey` and `url` for a Discovery service instance hosted in the US East region:
1. You need a Bluemix account. If you don't have one, [sign up][sign_up].
46
+
- If your service instance uses `username` and `password` credentials, add the `DISCOVERY_USERNAME` and `DISCOVERY_PASSWORD` variables to the *.env* file.
27
47
28
-
1. Download and install the [Cloud-foundry CLI][cloud_foundry] tool if you haven't already.
48
+
Example *.env* file that configures the `username`, `password`, and `url` for a Discovery service instance hosted in the Sydney region:
<!-- **ADD ANY APP-SPECIFIC CONFIGURATION INSTRUCTIONS HERE** -->
36
57
37
-
1. Create and retrieve service keys to access the [Discovery][service_url] service:
58
+
## Running locally
38
59
39
-
```none
40
-
cf create-service discovery standard Discovery-Demo
41
-
cf create-service-key Discovery-Demo myKey
42
-
cf service-key Discovery-Demo myKey
43
-
```
60
+
1. Install the dependencies
44
61
45
-
1. Create an `.env` file in the root directory by copying the sample `.env.example` file using the following command:
62
+
```
63
+
npm install
64
+
```
46
65
47
-
```none
48
-
cp .env.example .env
49
-
```
50
-
Update the `.env` with your service instance information from step 4
66
+
1. Run the application
51
67
52
-
The `.env` file will look something like the following:
68
+
```
69
+
npm start
70
+
```
53
71
54
-
```none
55
-
DISCOVERY_USERNAME=<username>
56
-
DISCOVERY_PASSWORD=<password>
57
-
```
72
+
1. View the application in a browser at `localhost:3000`
58
73
59
-
### Run the demo locally
74
+
## Deploying to IBM Cloud as a Cloud Foundry Application
60
75
61
-
1.Install the needed application dependencies with this command:
76
+
1. Login to IBM Cloud with the [IBM Cloud CLI](https://console.bluemix.net/docs/cli/index.html#overview)
62
77
63
-
```none
64
-
npm install
65
-
```
78
+
```
79
+
ibmcloud login
80
+
```
66
81
67
-
1.Start the application locally:
82
+
1. Target a Cloud Foundry organization and space.
68
83
69
-
```none
70
-
npm start
71
-
```
84
+
```
85
+
ibmcloud target --cf
86
+
```
72
87
88
+
1. Edit the *manifest.yml* file. Change the **name** field to something unique. For example, `- name: my-app-name`.
89
+
1. Deploy the application
73
90
74
-
1. Point your browser to [http://localhost:3000](http://localhost:3000).
91
+
```
92
+
ibmcloud app push
93
+
```
75
94
76
-
You may build the optimized production build by running `npm run build`. Then you only require to run the `node server.js` to see your code hosted at [http://localhost:5000](http://localhost:5000)
95
+
1. View the application online at the app URL, for example: https://my-app-name.mybluemix.net
77
96
78
-
### Run tests
97
+
98
+
## Tests
79
99
80
100
#### Unit tests
81
101
Run unit tests with `npm run test-unit`, then `a` to run all tests. See the output for more info.
@@ -85,19 +105,7 @@ First you have to make sure your code is built: `npm run build`
85
105
86
106
Then run integration tests with: `npm run test-integration-runner`
87
107
88
-
## Troubleshooting
89
-
90
-
* The main source of troubleshooting and recovery information is the Bluemix log. To view the log, run this command:
91
-
92
-
```sh
93
-
cf logs <your application name> --recent
94
-
```
95
-
96
-
* For more details about the service, see the [documentation][docs] for the Discovery service.
97
-
98
-
----
99
-
100
-
### Directory structure
108
+
## Directory structure
101
109
102
110
```none
103
111
.
@@ -126,7 +134,7 @@ Then run integration tests with: `npm run test-integration-runner`
126
134
## Open Source @ IBM
127
135
Find more open source projects on the [IBM Github Page](http://ibm.github.io/)
128
136
129
-
# Privacy Notice
137
+
##Privacy Notice
130
138
131
139
Sample web applications that include this package may be configured to track deployments to [IBM Cloud](https://www.bluemix.net/) and other Cloud Foundry platforms. The following information is sent to a [Deployment Tracker](https://github.com/IBM/metrics-collector-service) service on each deployment:
132
140
@@ -150,9 +158,7 @@ If you want to disable deployment tracking, follow these steps:
150
158
- Set the environment variable `DEMO_DEPLOY` to `1` OR
151
159
- remove the `tracker.track();` line in the `./server.js` file
0 commit comments