Search code examples
ibm-mobilefirstibm-cloudibm-mobile-services

Hosting Ionic Web App on IBM Bluemix


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:

  1. add browser to the Cordova platform locally
  2. 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

Solution

  • 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.