germanattanasio / nycschoolfinder

:pencil2: NYC School Finder using Watson APIs - Watson Hackathon Project
http://nyc-school-finder.mybluemix.net/
MIT License
12 stars 22 forks source link

Issues with getting the nycschoolfinder app up and running locally #2

Closed carolineoconnor closed 8 years ago

carolineoconnor commented 8 years ago

Hi,

I am having a few issues with trying to setup the nycschoolfinder app which is one of the example application which was built using the Tradeoff analytics Watson service.

Issue 1:

  1. From Github, select Download ZIP to download the nycschoolfinder source code locally e.g. C:\IBM\Watson\nycschoolfinder-master https://github.com/germanattanasio/nycschoolfinder
  2. Open a command prompt and change to the directory cd C:\IBM\Watson\nycschoolfinder-master
  3. Specify the Bluemix external Watson service APIs cf api http://api.ng.bluemix.net
  4. Login to Bluemix cf login -u username -p password e.g. cf login -u coconnor@ie.ibm.com -p password
  5. Create the following Watson services • tradeoff analytics • personality insights • cloudant Open the manifest.yml file to see the service-name, service-plan and service-instance-name details. cf create-service service-name service-plan service-instance-name Commands to create tradeoff analytics services: cf create-service tradeoff_analytics standard tradeoff-analytics-standard-service Create personality insights service: cf create-service personality_insights standard personality-insights-service Create cloudant service: cf create-service cloudantNoSQLDB shared cloudant
  6. Deploy and run the application on Bluemix The application-name is specified in the manifest.yml file. cf push application-name e.g. cf push nycschoolfinder2
  7. Login to Bluemix to view the application and the services deployed. https://console.ng.bluemix.net/
  8. Select the Cloudant NoSQL DB service and click Launch.
  9. Click Add New Database and create 2 new databases called schools and tradeoffs. 10 From Bluemix>Cloudant, select Service Credentials and click Add Credentials. These credentials can also be used to login through https://cloudant.com/
  10. Select the application and the route URL is displayed. application-name.mybluemix.net nycschoolfinder2.mybluemix.net
  11. Click on the Doing a demo link and copy some content from one of the txt files. Paste it in the input box and click Analyse.
  12. I am currently getting the following error which I am investigating. Error: Data supplied is missing critical information. no options found issue

The NYC School Finder example seems to be missing the instructions on deploying the app to Bluemix, or what prerequisites are required before trying to run locally.

Issue 2:

  1. I followed the running locally instructions specified in https://github.com/germanattanasio/nycschoolfinder.
  2. When I try to run 'node app.js analyze' I get the following error:

C:\IBM\Watson\nycschoolfinder-master\node_modules\watson-developer-cloud\lib\index.js:65
throw new Error('Argument error: api_key or username and password Error: Argument error: api_key or username and password were not specified at Object.personality_insights (C:\IBM\Watson\nycschoolfinder-master\node_mo dules\watson-developer-cloud\lib\index.js:65:19) at Object. (C:\IBM\Watson\nycschoolfinder-master\app.js:28:27) at Module._compile (module.js:460:26) at Object.Module._extensions..js (module.js:478:10) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) at Function.Module.runMain (module.js:501:10) at startup (node.js:129:16) at node.js:814:3

Thanks,

Caroline

germanattanasio commented 8 years ago

@carolineoconnor error is because you don't have the credentials in place when running locally.

Running locally

  1. Copy the content of the VCAP_SERVICES environment variable from bluemix into a VCAP_SERVICES.json file you have locally.
  2. Run
    $ sh run.sh

You can also update the app.js with username and password for each service including cloudant

germanattanasio commented 8 years ago

I just double check and this is also mentioned in the README.md. See Running Locally

carolineoconnor commented 8 years ago

Thanks for your response. I did copy the the content of the VCAP_SERVICES environment variable from bluemix into a VCAP_SERVICES.json file which I have locally. I understand now why this wont work for me as I am currently trying to get this example up and running using Windows not UNIX therefore the run.sh file will not work.

Would it be possible for you to include a run.bat file as well so this example will work on Windows otherwise specify this limitation in the documentation.

Do you have an example for updating the app.js with the username and password for a service?

germanattanasio commented 8 years ago

If you have git-bash or cygwin, you can execute sh run.sh; otherwise, you can use something like:

set /P PATH=< VCAP_SERVICES.json

I'm not a windows guy but if none of those things work go to app.js and in the line 11 add

process.env.VCAP_SERVICES = fs.readFileSync('VCAP_SERVICES.json');