Hosting Ionic Web App on IBM Bluemix - ibm-mobilefirst

How do I host a publicly accessible web app on IBM Bluemix?
The app is built with Ionic framework and an IBM Cloudant DB. The app and Cloudant communicate through managed APIs. I could register the app on mobile foundation and run it locally on Xcode simulator, as well as Chrome locally. But I could not find a way on Bluemix to host app as a pure web app living in the browser.
I expect that my app to be available on a link like someapp.mybluemix.net. I do not prefer launching this prototype version of my app through the App Store in the near future.
I found it very easy with AWS - I only needed to upload the content in my build folder to S3 - and the index page is my public web app. But I prefer to use purely Bluemix services.
PS: I managed to upload a web version of the app alongside iOS version to mobile foundation. The steps were:
add browser to the Cordova platform locally
register the app and push the app again to the mobile foundation server
But I still could not find the link to which the app is available publicly.
screenshot from IBM mobile foundation console
Error from Bluemix Deploy stage (partial):
! This app may not specify any way to start a node process
http://docs.cloudfoundry.org/buildpacks/node
Exit status 0
Uploading droplet, build artifacts cache...
Staging complete
Uploading droplet...
Uploading build artifacts cache...
Uploaded build artifacts cache (52.7M)
Uploaded droplet (75.9M)
Uploading complete
Stopping instance f714f8a4-ff4d-4a59-9a3e-5d418926
Destroying container
Successfully destroyed container
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 crashed
FAILED
Error restarting application: Start unsuccessful
TIP: use 'cf logs testApp --recent' for more information
Finished: FAILED
I built the app again on continuous delivery and it crashed. This time I got the additional logs:
2018-04-04T10:08:04.49+0800 [APP/PROC/WEB/0] ERR npm ERR! Linux 4.4.0-109-generic
2018-04-04T10:08:04.50+0800 [APP/PROC/WEB/0] ERR npm ERR! argv "/home/vcap/app/vendor/node/bin/node" "/home/vcap/app/vendor/node/bin/npm" "start"
2018-04-04T10:08:04.50+0800 [APP/PROC/WEB/0] ERR npm ERR! node v6.13.0
2018-04-04T10:08:04.50+0800 [APP/PROC/WEB/0] ERR npm ERR! npm v3.10.10
2018-04-04T10:08:04.50+0800 [APP/PROC/WEB/0] ERR npm ERR! missing script: start
2018-04-04T10:08:04.50+0800 [APP/PROC/WEB/0] ERR npm ERR!
2018-04-04T10:08:04.50+0800 [APP/PROC/WEB/0] ERR npm ERR! If you need help, you may report this error at:
2018-04-04T10:08:04.50+0800 [APP/PROC/WEB/0] ERR npm ERR! <https://github.com/npm/npm/issues>
2018-04-04T10:08:04.51+0800 [APP/PROC/WEB/0] ERR npm ERR! Please include the following file with any support request:
2018-04-04T10:08:04.51+0800 [APP/PROC/WEB/0] ERR npm ERR! /home/vcap/app/npm-debug.log

You can use the IBM cloud Cloud Foundary Apps boilerplates to create webapps for nodejs,java,python,ruby,go etc. You can then use the Continuous Delivery Service to create code pipeline and for source control.
Documentation can be found here. This link talks about hosting a nodejs webapp. Hope this helps.

Related

Failed to fully start Android device Emulator on a windows 11 machine to run a react native application

I am building a react-native application and I have been testing the application on an android device simulator. However after running the npm run eject command to stop using the expo-cli; I have failed to run the project/app in my android emulator anymore.
Initially I was opening the android emulator within VSCode but after it failed I tried to open the android emulator in command propmt directly; outside the code editor. Below is the output I received.
INFO | Android emulator version 31.2.7.0 (build_id 8135630) (CL:N/A)
INFO | added library vulkan-1.dll
INFO | configAndStartRenderer: setting vsync to 60 hz
ERROR | Failed to open /qemu.conf, err: 2
WHPX on Windows 10.0.22000 detected.
Windows Hypervisor Platform accelerator is operational
INFO | Started GRPC server at 127.0.0.1:8554, security: Local
INFO | Advertising in: C:\Users\Were\AppData\Local\Temp\avd\running\pid_8104.ini
C:\Users\Were\AppData\Local\Android\Sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: WHPX: Unexpected VP exit code 4
INFO | Shutting down gRPC endpoint
INFO | Shutting down gRPC endpoint
I need someone to help me make sense of the statement/error log so I can be able to run my app in the android emulator again.
[EDIT]
This is the error log i received within VisualStudio Code before trying to open the emulator in command prompt
› Press ? │ show all commands
› Opening on Android...
› Opening emulator My_Pixel_Emulator
Couldn't start project on Android: The emulator (My_Pixel_Emulator) quit before it finished opening. You can try starting the emulator manually from the terminal with: C:\Users\Were\AppData\Local\Android\Sdk/emulator/emulator #My_Pixel_Emulator
› Press ? │ show all commands
C:\Users\Were\Desktop\Demo\DoneWithIt\node_modules\metro-hermes-compiler\src\emhermesc.js:81
throw ex;
^
RuntimeError: abort(Error: could not connect to TCP port 5554: cannot connect to 127.0.0.1:5554: No connection could be made because the target machine actively refused it. (10061)). Build with -s ASSERTIONS=1 for more info.
at process.abort (C:\Users\Were\Desktop\Demo\DoneWithIt\node_modules\metro-hermes-compiler\src\emhermesc.js:796:13)
at process.emit (events.js:315:20)
at process.emit (C:\Users\Were\AppData\Roaming\npm\node_modules\expo-cli\node_modules\source-map-support\source-map-support.js:439:21)
at processPromiseRejections (internal/process/promises.js:245:33)
at processTicksAndRejections (internal/process/task_queues.js:94:32)
error Command failed with exit code 7.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Errors when Pushing Vue.js app with IBM Cloud+Cloud Foundry Node Buildpack

I am really new (this is my first time) to using IBM Cloud.I have a Vue.js app that I would like to deploy on IBM Cloud with continuous delivery. I have my Vue project in a GitHub repository, and I would like to be able to deploy the project automatically upon changes to the master branch of the repository. I have successfully set up the tool chain so that the "Delivery Pipeline" runs upon changes to the master branch. See screenshot:
Within the Delivery Pipeline, I have two stages: Build and Deploy. See screenshot 2:
I (think) I have successfully set up the Build Stage, where I install npm, then proceed to run the command "npm run build" to create a deployable bundle, with this script:
bash
#!/bin/bash
export NODE_VERSION=8
export NVM_VERSION=0.33.11
npm config delete prefix \
&& curl -o-
https://raw.githubusercontent.com/creationix/nvm/v${NVM_VERSION}
/install.sh | bash \
&& export NVM_DIR="$HOME/.nvm" \
&& . $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default \
&& node -v \
&& npm -v
echo "Installing NPM"
npm install
echo "NPM install successful"
echo "Attempting npm run build"
npm run build
echo "NPM run build successful"
This is where the uncertainty arises. I want to deploy the project, which after npm run build should just require index.hmtl and build.js, which is in the 'dist' folder.
I don't know if this is necessary, but following the npm install and npm run build stage, I added this stage, which I really don't know what does. I have only added it because the boilerplate SDK for Node.js™
had this stage prior to the deploy stage, see screenshot 3:
After this, I have the Deploy stage set to take the 'Simple Build' stage as its input. It deploys it with a simple cloud foundry push command. However, I get these errors in the log, after it downloads the various buildpacks:
Staging...
-----> IBM SDK for Node.js Buildpack v3.25.1-20190115-1637
Based on Cloud Foundry Node.js Buildpack v1.5.24
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NPM_CONFIG_PRODUCTION=true
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
Resolving node version (latest stable) via 'node-version-resolver'
Installing Node.js (6.16.0) from cache
Using default npm version: 3.10.10
-----> Restoring cache
Loading 2 from cacheDirectories (default):
- node_modules
- bower_components (not cached - skipping)
-----> Building dependencies
Installing node modules (package.json)
-----> Installing App Management
WARN: App Management cannot be installed because the start script cannot be found.
To install App Management utilities, specify your 'node' start script in 'package.json' or 'Procfile'.
Checking for Dynatrace credentials
No Dynatrace Service Found (service with substring dynatrace not found in VCAP_SERVICES)
-----> Caching build
Clearing previous node cache
Saving 2 cacheDirectories (default):
- node_modules
- bower_components (nothing to cache)
-----> Build succeeded!
└── vue#2.6.10
! This app may not specify any way to start a node process
http://docs.cloudfoundry.org/buildpacks/node
Exit status 0
Staging complete
Uploading droplet, build artifacts cache...
Uploading build artifacts cache...
Uploading droplet...
Uploaded build artifacts cache (15.3M)
Uploaded droplet (29.4M)
Uploading complete
Stopping instance 64ed3f5f-71eb-477b-afc1-0e07e2e74fdb
Destroying container
Successfully destroyed container
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 crashed
FAILED
Error restarting application: Start unsuccessful
Any ideas? Where am I going wrong? Any help would be greatly appreciated!
Got it working. I just needed to add the dependencies/require statements in the app.js file (some Express stuff), and then I removed that extra 'Simple build" stage

openpai k8s cluster deploying rest-server failed

failed to deploy rest-server latest on k8s cluster
/usr/src/app/src/config/launcher.js: 144
throw new Error('cannot connect to framework launcher');
npm ERR! code ELIFECYCLE
npm ERR! errno 1
python paictl.py service start -n rest-server
I tried v0.12.0 and latest, both failed with the same error. Anybody in OpenPai team could help?
Please check whether framework launcher has been deployed successfully

Unable to start hyperledger fabric network with hyperledger composer

I am currently working on HyperLedger composer v1.1 on Ubuntu Virtual Machine (16.04 LTS) hosted in remote server and using VMWare Vsphere client to connect to that host machine. My PC (Windows 7) and the hosting server are in the same LAN.
In fact, I am following the tutorial (https://hyperledger.github.io/composer/latest/tutorials/developer-tutorial).
I managed to install the chaincode onto the network but when I tried to start the business network using the command :
composer network start --networkName tutorial-network --networkVersion 0.0.1 --networkAdmin admin --networkAdminEnrollSecret adminpw --card PeerAdmin#hlfv1 --file networkadmin.card
I got this error :
✖ Starting business network definition. This may take a minute...
Error: Error trying to start business network. Error: No valid responses from any peers.
Response from attempted peer comms was an error: Error: 2 UNKNOWN: error starting container: Failed to generate platform-specific docker build: Error returned from build: 1 "npm ERR! code EAI_AGAIN
npm ERR! errno EAI_AGAIN
npm ERR! request to https://registry.npmjs.org/composer-runtime-hlfv1 failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org:443 ...."
Then, when I saw the suggestion of #PaulO'Mahony at "hyperledger-composer v1.1:unable to instantiate chaincode"
I tried to locate the npmrc file but it was not there then I did as #oligofren suggested at Node .npmrc file.
After that, I have executed this command :
composer network install --c PeerAdmin#hlfv1 --a tutorial-network#0.0.1.bna -o npmrcFile=/home/user1/.npmrc"
where ".npmrc" file is generated after I have logged in (using npm login).
Finally, when try to execute the above command "composer network start...." the same error is still exist !!!
Note that : I have executed "./stopFabric.sh", "./teardownFabric.sh" and then "./startFabric.sh" before I did each solution!

Error in starting hyperledger fabric network with hyperledger composer

I am trying to set up a network using hyper ledger composer, for which I followed the
Developer tutorial for creating a Hyperledger Composer solution
but when I use the command
composer network start --networkName tutorial-network --networkVersion
0.0.1 --networkAdmin admin --networkAdminEnrollSecret adminpw --card PeerAdmin#hlfv1 --file networkadmin.card
It is giving the following error :
Starting business network tutorial-network at version 0.0.1
Processing these Network Admins: userName: admin
✖ Starting business network definition. This may take a minute...
**Error: Error trying to start business network. Error: No valid responses from any peers.** Response from attempted peer comms was an error: **Error: 2 UNKNOWN: error starting container: Failed to generate platform-specific docker build: Error returned from build: 1 "npm ERR!** code EAI_AGAIN npm ERR! errno EAI_AGAIN npm ERR! request to https://registry.npmjs.org/composer-runtime-hlfv1 failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org:443
npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2018-04-10T10_10_13_361Z-debug.log " Command failed
I have tried tearing down the fabric and starting the fabric again but it didn't help.
Are you behind a proxy / firewall ? If so in the composer network install command you require a -o npmrcFile parameter, to resolve the NPM registry. eg registry=https://mycompanynpmregistry.com:4873 (or the resolved IP address) as in composer network install -c PeerAdmin#hlfv1 -a digitalproperty-network.bna -o npmrcFile=/tmp/npmrcFile . See https://hyperledger.github.io/composer/latest/managing/connector-information
If you are finding that you get a REQUEST_TIMEOUT on a start or upgrade request, you could try increasing the timeout of the fabric default for startup timeout.
If you are using our simple Hyperledger Composer development server environment from composer-tools github repo, then you can add the following to the peer definition to see if it addresses the problem:
CORE_CHAINCODE_STARTUPTIMEOUT=1200s
in the file ~/fabric-tools/fabric-scripts/hlfv11/composer/docker-compose.yml
eg, the above is a snippet from the peer definition. You would have to do a docker-compose stop - then docker-compose start from that directory location to take effect.
Footnote:
In addition to CORE_CHAINCODE_STARTUPTIMEOUT change above - you MUST ALSO UPDATE the timeout values to match (ie CORE_CHAINCODE_STARTUPTIMEOUT), in the connection.json file for the card(s) that performs the composer network start command (eg. PeerAdmin card in $HOME/.composer). You will see 4 timeouts (3 for a Peer and 1 for the Order) in the 'client' section, under the stanza "connection". By default, these are set to 300 seconds - Increase the value to 1200 for each. Do note that CORE_CHAINCODE_STARTUPTIMEOUT must have the 'trailing s' , whereas these 4 timeouts defined above - don't have this.
1) I had the same error while starting the network. This solution helped me: https://github.com/hyperledger/composer/issues/3591#issuecomment-386718739
It states the following:
There is an extra character when you copy the string from hyperledger
composer website.
Try copy pasting the following line to a notepad and paste in the
command line. It will work.
composer network start --networkName tutorial-network
--networkVersion 0.0.1 --networkAdmin admin --networkAdminEnrollSecret adminpw --card PeerAdmin#hlfv1 --file networkadmin.card
2) If it doesn't help, then try to kill any stale or active docker containers.
Run the following command to kill any stale or active containers:
docker rm -f $(docker ps -aq)
Clear any cached networks:
Press y when prompted by the command
docker network prune
Then, go to ~/fabric-dev-servers folder and run the commands:
cd ~/fabric-dev-servers
./teardownFabric.sh
./startFabric.sh
./createPeerAdminCard.sh
After that, run the composer network install command:
composer network start --networkName tutorial-network --networkVersion 0.0.1 --networkAdmin admin --networkAdminEnrollSecret adminpw --card PeerAdmin#hlfv1 --file networkadmin.card
I had same error, I found out that the pre-requisities that I have already installed in my system didnot matched the versions. So I uninstalled the pre-requisities and reinstalled them. In my case the version of docker was creating a problem.