Error when deploying nodeBB application on Bluemix. How to fix it and deploy successfully? - ibm-cloud

I want to deploy NodeBB on Bluemix using Compose for Redis service. I follow the setup instructions at https://docs.nodebb.org/en/latest/installing/os/osx-mavericks.html
But when I push the app to Bluemix the application fails to start. I get an error. Please refer to link below.
Error on pushing nodeBB on Bluemix
However the nodeBB application runs fine on my local macbook.
How to resolve this error.Please let me know how to deploy nodeBB on Bluemix successfully?

The error indicates the public/uploads/sounds folder is not found on the staged application. It is not getting pushed along with the other application files.
This folder is used by the nodeBB application to copy sound files at runtime. To make sure that the empty public folder is pushed to Bluemix create a .cfignore file. Add the following line to it
!/public

The following errors can prevent the nodeBB application to run on Bluemix.
1) If the credential to Compose for Redis is not setup correctly OR the Compose of Redis is unavailable in Bluemix
For the Redis connection to setup properly create a Compose for Redis service in Bluemix. Then Copy the Redis credentials from the service credentials as shown below.
{
"db_type": "redis",
"name": "bmix_dal_yp_94747ceb_7c86_4319_b7be_88c2e9c829eb",
"uri_cli": "redis-cli -h sl-us-dal-9-portal.0.dblayer.com -p PORT -a PASSWORD”,
"deployment_id": "583e1bea52de460017000124",
"uri": "redis://admin: PASSWORD#sl-us-dal-9-portal.0.dblayer.com:PORT”
}
PORT represents Redis port number and PASSWORD represents Redis password
Use the credentials to update the config.json correctly when you run command ./nodebb setup [ on Unix or Mac]
Make sure Compose for Redis service is up and running. Otherwise you will get connection errors from the nodebb application when you start it.
2) If the port that the nodebb application can listen on Bluemix is not updated to app.js before pushing the application to Bluemix then it will cause the application to fail to start on Bluemix.
Update
nconf.set('port', urlObject.port || nconf.get('port') || nconf.get('PORT') || (nconf.get('PORT_ENV_VAR') ? nconf.get(nconf.get('PORT_ENV_VAR')) : false) || 4567);
TO
nconf.set('port', process.env.VCAP_APP_PORT || urlObject.port || nconf.get('port') || nconf.get('PORT') || (nconf.get('PORT_ENV_VAR') ? nconf.get(nconf.get('PORT_ENV_VAR')) : false) || 4567);
3) Make sure that the application runs on the local machine without any errors before pushing it to the Bluemix. Command : ./nodebb start OR node app.js
The instruction to setup and run nodeBB on local can be found here ttps://docs.nodebb.org/en/latest/installing/os/osx-mavericks.html

Related

Connect Cloud SQL for MySql from Cloud Run

I'm trying to connect to Google Cloud SQL for MySql through Google Cloud Run. I've been through many posts at SO and also the Google documentation. But doesn't seem to get it working for myself. I admit that I have never containerized any application and I am predominantly a data person.
Note: I already have Cloud SQL instance created which I can connect through Cloud shell.
1) My code is based on Google documentation at
https://cloud.google.com/sql/docs/mysql/connect-run
and the github code at
https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/cloud-sql/mysql/sqlalchemy/main.py
2) Build the image
gcloud builds submit --tag gcr.io/my-project/my-test-image
3) Deploy the image
gcloud run deploy --image gcr.io/my-project/my-test-image
4) When I try to invoke the service in Cloud Shell using the following, I get output as "Service Unavailable"
curl -H "Authorization: Bearer $(gcloud auth print-identity-token)" https://my-service.run.app
Can anyone please help me to resolve this?
Changes -
I had not provided the mysql instance name. I corrected it and now I'm getting error as below -
[INFO] Listening at: http://0.0.0.0:8080 (1)"
"Traceback (most recent call last): File
"/usr/local/lib/python3.8/site-packages/pymysql/connections.py", line
571, in connect
sock.connect(self.unix_socket) FileNotFoundError: [Errno 2] No such file or directory"
I don't understand why it's listening at 0.0.0.0:8080. I removed the host and port from my code and I still get this "info" and the error I get is that "FileNotFoundError". I'm not sure which file it needs. Does it need some kind of connections file? If yes what's the format of the file?
I wrote a tutorial on how to Connect Cloud SQL(MySql) from Cloud Run (Java), but the flow is the same. link
Please make sure you understand the point 13, where you have to pass the instance connection name with the flag --add-cloudsql-instances, this will start the cloud sql proxi for you.
13.Configure the service for use with Cloud Run
gcloud run services update run-mysql --add-cloudsql-instances run-to-sql:europe-west2:database-external --set-env-vars CLOUD_SQL_CONNECTION_NAME=run-to-sql:europe-west2:database-external DB_USER=user_name,DB_PASS=user_password,DB_NAME=user_database
SO link

Deploy API REST IBM Hyperledger Composer Blockchain (bad flag in substitute command: 'U' ERROR)

I'm getting this error trying to deploy a card to a working blockchain on cloud, any idea? Thanks in advance. I'm using a mac, following the guide (Kubernetes installed/configured well, I think):
https://ibm-blockchain.github.io/interacting/
./create/create_composer-rest-server.sh --paid --business-network-card /Users/sm/jsblock/tutorial-network/PeerAdmin#fabric-network.card
Configured to setup a paid storage on ibm-cs
Preparing yaml file for create composer-rest-server
sed: 1: "s/%COMPOSER_CARD%//User ...": bad flag in substitute command: 'U'
Creating composer-rest-server pod
Running: kubectl create -f /Users/sm/jsblock/ibm-container-service/cs-offerings/scripts/../kube-configs/composer-rest-server.yaml
error: no objects passed to create
Composer rest server created successfully
There is an error in that document. And you are also specifying the Peer Admin card when you need to use a Network Admin Card.
There are 2 sets of 'parallel' documents for paid and free clusters. The command you are using has --paid in it in error. If you remove --paid and use the Network Admin Card I think it will solve the problem.
Your command will look something like this: ./create/create_composer-rest-server.sh --business-network-card admin#YOUR-network
I tried again with the install proccess (deployed blockchain instance seemed to work weall): https://ibm-blockchain.github.io/simple/
But I noticed that the script:
./create_all.sh
...never ended (mostly an internal kubernetes problems I guess). And I reset the installation:
./delete_all.sh
./create_all.sh
I tried again, now everything Ok. I could get my awesome API REST talking with my Hyperledger Blockchain, deployed on IBM Cloud. Ready to develop something amazing.

Issue connecting composer to Blockchain on Bluemix - identity or token does not match

I have fabric composer 0.72 installed on my mac, and I was able to follow this thread to get it connected to my Blockchain (v.61 of Fabric) on Bluemix.
fabric-composer-integration-with-bluemix-blockchain-service
Now I am trying to build an ubuntu (16.04) docker container and run composer-rest-server there. When I try to connect to my blockchain service from my docker container (using the same id, WebAppAdmin, that I used on my mac) I get an error:
Discovering types from business network definition ...
Connection fails: Error: Identity or token does not match.
It will be retried for the next request.
{ Error: Identity or token does not match.
at /home/composer/.nvm/versions/node/v6.10.3/lib/node_modules /composer-rest-server/node_modules/grpc/src/node/src/client.js:417:17 code: 2, metadata: Metadata { _internal_repr: {} } }
I tried copying the cert from my mac to my docker container:
/home/composer/.composer-credentials/member.WebAppAdmin
but when I did that I got a different error that says "signature does not verify". I did some additional testing, and I discovered that if I used an id that I had not previously used with composer (i.e. user_type1_0) then I could connect, and I could see a new cert in my .composer-credentials directory.
I tried deleting that container and building a new one (I dorked something else up) I could not use that same userid again.
Does anybody know how security and these certs are supposed to work? It would seem as though something to do with certificate generation/validation is tied to the client (i.e. hardware address), such that if I try to re-use an id on a different machine, the certs or keys or something don't match. I have a way to make things work, but it doesn't seem like it's the right way if I can't use the same id from different machines.
Thanks!
Hi i tried to recreate this by having blockchain running on a unix machine and then i copied my connection profile and certificate to my mac and then edited my connection profile to update the ip address and key store. I then did a composer network ping and it worked fine.
I am using composer v0.7.4 so you could try that?
I have also faced this issue, and concluded that
There is inconsistent behavior while deploying network using composer on Cloud environment includeing Bluemix. Problem is not with composer, but with fabric 0.6.
I am assuming that this issue is also indirectly related to following known bugs into fabric 0.6, which will not be fixed in fabric 0.6.
ERROR:
"
throw er; // Unhandled 'error' event
^
Error
at ClientDuplexStream._emitStatusIfDone (/home/ubuntu/.nvm/versions/node/v6.9.5/lib/node_modules/composer-cli/node_modules/grpc/src/node/src/client.js:189:19)
at ClientDuplexStream._readsDone (/home/ubuntu/.nvm/versions/node/v6.9.5/lib/node_modules/composer-cli/node_modules/grpc/src/node/src/client.js:158:8)
at readCallback (/home/ubuntu/.nvm/versions/node/v6.9.5/lib/node_modules/composer-cli/node_modules/grpc/src/node/src/client.js:217:12)
"
So far, We have understood that following three JIRA are root cause , where essentially the cloud networking layer ends up killing the idle event hub connection after a period of inactivity and the fabric SDK cannot handle this.
https://jira.hyperledger.org/browse/FAB-4002 FAB-3310
https://jira.hyperledger.org/browse/FAB-3310
or FAB-2787
Conclusion:
There is no alternative way of fixing this issue with Bluemix or any cloud environment with fabric 0.6
You may not experience this issue with Fabric 1.0, but there is still possibilities as all above mentioned defects are not fixed yet.

deploying a liberty war file to bluemix liberty gives error 400

After creating a WAR file using maven successfully, I tried uploading the WAR file to Liberty on Bluemix. I used the following command:
cf push wallet -p ./wallet-service/target/wallet-service-1.1-SNAPSHOT.war
Creating app wallet in org irazabal#us.ibm.com / space jax-rs as irazabal#us.ibm.com...
Got following response:
"OK
Creating route wallet.mybluemix.net...
FAILED
Server error, status code: 400, error code: 210003, message: The host is taken: wallet"
What does that mean and more importantly, how do you fix it?
The above error message means the hostname wallet is taken. You are assigned a hostname on a shared domain of mybluemix.net. You can fix this issue by choosing a unique name. You can keep the name of the app to be wallet but choose a unique hostname with the following command.
cf push wallet -n somethingunique -p ./wallet-service/target/wallet-service-1.1-SNAPSHOT.war
The -n argument allows to give a hostname to the app.
Additionally, you can point your own domain to Bluemix and use that with your app.

Deploy managed services into CloudFoundry

I installed Cloud Foundry v2 Nise Installer (with cf-release ea61ec6f8f, VirtualBox)
and successfully pushed 'hello' application with 2 built-in services(mysql and postgresql).
1) How can I add more managed services, e.g. 'echo', 'mongodb' (existing under cf-release/src/services)?
2) I also installed cf_nise_services on the different VM (VirtualBox) but I do not understand how to connect both VMs to deploy services.
I tried to add my service via (on VM1)
create-service-plan/create-plan/create-service-auth-token
I got an error after (at the very end)
cf create-service
CFoundry::MessageParseError: 1001: Request invalid due to parse error: Decoded JSON cannot be nil
Or
HTTP 404
My service does not respond correctly?
Thank you!
The branch ea61ec6f8f is too old and not maintained any longer.
cf_nise_installer_services is, unfortunately, not maintained now. I'll delete it from the README later.
Please try cf-mysql-broker.
Iwasaki Yudai