在IBM Bluemix上托管Ionic Web App

时间:2018-03-20 08:22:18

标签: ibm-mobilefirst ibm-cloud ibm-mobile-services

如何在IBM Bluemix上托管可公开访问的Web应用程序?

该应用程序使用Ionic框架和IBM Cloudant DB构建。应用和Cloudant通过托管API进行通信。我可以在移动基础上注册该应用程序,并在Xcode模拟器上本地运行,以及本地Chrome。但我无法在Bluemix上找到一种方法来将应用程序托管为生活在浏览器中的纯Web应用程序。

我希望我的应用可以在someapp.mybluemix.net这样的链接上使用。我不喜欢在不久的将来通过App Store推出我的应用程序的原型版本。

我发现使用AWS非常容易 - 我只需要将构建文件夹中的内容上传到S3 - 索引页面就是我的公共网络应用程序。但我更喜欢使用纯粹的Bluemix服务。

PS:我设法将iOS版本的网络版本上传到移动版基础版。步骤是:

  1. 浏览器添加到本地Cordova平台
  2. 注册应用并再次将应用推送到移动基础服务器
  3. 但我仍无法找到应用程序公开的链接。

    screenshot from IBM mobile foundation console

    Bluemix Deploy阶段(部分)出错:

     !     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
    

    我在持续交付时再次构建应用程序并且崩溃了。这次我得到了额外的日志:

    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
    

1 个答案:

答案 0 :(得分:1)

您可以使用IBM cloud Cloud Foundary Apps样板来为nodejs,java,python,ruby,go等创建webapp。然后,您可以使用Continuous Delivery Service创建代码管道和源代码管理。< / p>

可以找到文档here。此链接讨论托管nodejs webapp。希望这会有所帮助。