Node-Red on Bluemix - how to access the Node server files? - ibm-cloud

I created a Node-Red flow on Bluemix, did some development and it was working ok for a few weeks. Suddenly the server won't start and logs "[Error: No cloudant service found]". The cloudant db credentials in VCAP look ok to me. How can I look at other files which are used by the Node server to setup and run? I don't see any way to access them in Bluemix or via cf.

Node-RED looks for a cloudant instance with the name <your-app-name>.cloudantNoSQLDB as that is what the boilerplate/quick-start deploy processes uses when deploying your instance.
One explanation for it not finding the bound cloundant instance is if you have renamed your app.
The specific code deployed is available: https://github.com/node-red/node-red-bluemix-starter
The expected name of the cloudant instance is generated here: https://github.com/node-red/node-red-bluemix-starter/blob/25f216a61fba182c4f8d2594124e2e4bbbebc3a6/bluemix-settings.js#L80

Related

How to Connect to Cloud SQL Through Kubernetes

This is driving me crazy, been trying to get this to work for 3 days now: I'm trying to connect a kubernetes deployment to my Cloud SQL database in GCP.
Here's what I've done so far:
Set up the cloud SQL proxy to work as a sidecar in my deployment
Created a GKE service account and attached it to my deployment
Bound the GKE service account to my GCP service account
Edited to the service account (to what I can tell) is owner permission
Yet what I run the deployment in GKE I still get:
the default Compute Engine service account is not configured with sufficient permissions to access the Cloud SQL API from this VM. Please create a new VM with Cloud SQL access (scope) enabled under "Identity and API access". Alternatively, create a new "service account key" and specify it using the -credential_file parameter
How can I fix this? I can't find any documentation on how to set up the service account to have the correct permissions with Cloud SQL or how to debug this issue. Every single tutorial I can find ends with "bind your service account" and then stops. Nothing that describes what permissions are needed, and nothing about how to actually connect to the DB from my code (how would my code talk to the proxy?).
Please help
FINALLY got it to work!
Two major pieces that the main article on this (cloud.google.com/sql/docs/mysql/connect-kubernetes-engine) glosses over:
Properly setting up workload identity, for which I found these links to be very helpful:
a) https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity
b) https://www.youtube.com/watch?v=l-nws1e4B8M
To connect to the DB you have to have your code use the DB host 127.0.0.1

How to invoke chaincode that was deployed with fabric composer in Bluemix?

I'm using Fabric v0.6 on Bluemix and composer-ui on my local machine. I was able to make my model and logic files and deployed them to my Blockchain network on Bluemix. Now I want to invoke the chaincode I deployed with composer from an app that is already running on Bluemix (node.js), not from the composer-ui. How would I approach this?
I have seen a sample app here: https://github.com/hyperledger/composer-sample-applications/tree/master/packages/getting-started
But it requires this configuration file: https://github.com/hyperledger/composer-sample-applications/blob/master/packages/getting-started/config/default.json
And that configuration file specifies the connectionProfile, which I guess is the connection profile I created on composer-ui to connect to my Blockchain service on Bluemix.
Do I need to have Fabric Composer running in order to invoke the chaincode? Or is there anyway to invoke my chaincode completely independent from the composer runtime?
Couple of options:
Use the composer-rest-server and write your front-end application against a domain specific REST API
Pass the connection profile information into the Composer JS composer-client API using an environment variable. See: https://github.com/hyperledger/composer/issues/602

Node-RED seems to fail to connect to Cloudant

An existing Node-RED App failed to start on Bluemix.
I'm getting the following errors:
DEA/2 Starting app instance (index 0) with guid ----
App/0 Failed to find Cloudant service
App/0 Error loading settings file: /home/vcap/app/bluemix-settings.js
The Cloudant service is working and accessible via the Bluemix Web interface.
The VCAP_Services variable is visible in the web interface and seems to be OK.
The only recent change is the name of the App in Bluemix.
Solved by renaming the App with it's original name.
Lesson: Never change an Node-RED application display name (not the route) other you may end in trouble.

Connection error with cloudant db dedicated service on CIO Bluemix

I have created an app on CIO bluemix platform under my org. Then I added cloudant DB dedicated service and did a bind of the service with the app. The hello world Node JS starter works for the app. However, when I try to connect to the cloudant db by extending the starter app downloaded as the starter kit and cloud foundry cli, then it give 'connect ECONNREFUSED ' error. I have used the proper credentials. I also tried to launch the db using the web console that comes by clicking on the cloudant service icon, but it times out. Can you suggest what could be the issue? Thanks.
You need to take the hostname in your cloduant credentials file and add to your PC's host file:
windows sample:
9.45.69.22 23199ddc-775f-4ca5-91aa-XXXXXXXXXXXXXX-bluemix.cloudant.com # DEV MOOC

Can't delete Cloudant service - Error 400

I am taking the DWC001 Bluemix Intro course exercise 3b. After creating a node.js app and binding a new Cloudant database, then deleted my app from dashboard, checked delete for Cloudant, my Cloudant service remains and I cannot delete it.
This error from Dashboard & cmdline:
Service instance RLCCloudant: Service broker error:
{"description"=>"Error 400 received from broker url
https://cloudantbroker.ng.bluemix.net/v2/service_instances/40791045-620f-
4fda-b9d4-eabe50c4783c?plan_id=cloudant-shared&service_id=cloudant"}
As you can see in the Bluemix Status Page we are currently experiencing some issues provisioning and managing Cloudant service instances in Bluemix. Bluemix users attempting to provision/unprovision/bind/unbind Cloudant service instances may see errors during these operations. The operations team has restored the service to allow provisioning, binding and unbinding. Issues may still be experienced when unprovisioning a service (as in your case).
Please visit that status page to see when the issues are resolved.
The service has been restored by Cloudant team as announced at https://developer.ibm.com/bluemix/support/#status.
Now the deletion action is working as normal.
"Service Broker Error" usually means that something went wrong communicating with the service side. Please send a request to delete the service to Bluemix Support.