cloudfoundry 创建新的app 成功,但是启动老是失败,求大神帮忙看看什么原因.
发布于 3年前 作者 shaman 2056 次浏览

创建过程:

Shaman[[[[[[[[[[[[[[[[[@SHAMAN-PC](/user/SHAMAN-PC)](/user/SHAMAN-PC)](/user/SHAMAN-PC)](/user/SHAMAN-PC)](/user/SHAMAN-PC)](/user/SHAMAN-PC)](/user/SHAMAN-PC)](/user/SHAMAN-PC)](/user/SHAMAN-PC)](/user/SHAMAN-PC)](/user/SHAMAN-PC)](/user/SHAMAN-PC)](/user/SHAMAN-PC)](/user/SHAMAN-PC)](/user/SHAMAN-PC)](/user/SHAMAN-PC)](/user/SHAMAN-PC) /e/cloudfoundry/testapp

$ vmc push

Would you like to deploy from the current directory? [Yn]: y

Application Name: testapp

Detected a Node.js Application, is this correct? [Yn]: y

Application Deployed URL [testapp.cloudfoundry.com]: shaman.cloudfoundry.com

Memory reservation (128M, 256M, 512M, 1G, 2G) [64M]: 1G

How many instances? 1:

Create services to bind to 'testapp’? [yN]: y

1: mongodb

2: mysql

3: postgresql

4: rabbitmq

5: redis

What kind of service?: 2

Specify the name of the service [mysql-a8398]:

Create another? [yN]: n

Would you like to save this configuration? [yN]: y

Manifest written to manifest.yml.

Creating Application: OK

Creating Service [mysql-a8398]: OK

Binding Service [mysql-a8398]: OK

Uploading Application:

Checking for available resources: OK

Processing resources: OK

Packing application: OK

Uploading (11K): OK

Push Status: OK

Staging Application 'testapp’: OK

Starting Application 'testapp’: …

Error: Application [testapp] failed to start, logs information below.

====> /logs/stdout.log <====

Express server listening on port 3000 in development mode

Delete the application? [Yn]: n

最后在 start 出错了 , 然后我重新启动的时候提示 already started , 查看了app状态 如下:

enter image description here

什么原因 , 初学nodejs 和使用cloudfoundry ,请教什么原因

21 回复

换掉端口 update 后,还是启动失败 :

enter image description here

好蛋疼啊,就差最后一步 郁闷

port = (process.env.VMC_APP_PORT || 3000); host = (process.env.VCAP_APP_HOST || ‘localhost’);

入口一定是 server.js

本地先跑跑看 能不能起来

将node_modules下的.bin目录删掉 试试~~~

我testapp是用的express安装的一个默认应用啥也没改,入口是app.js,本地能跑起来

还是不行,删掉后的更新重启 enter image description here

这个 /logs/stdout.log 到哪里去查看呢

同遇到这个问题~晚上回来解决一下!

不过我的是连接不上数据库,想问下lz,数据库的密码和帐号在哪里查看,并且在哪里管理的!

我还没开始连接数据库,就是用express安装了一个默认的testapp来测试一下能否启动

至于配置,可以参考下我的 config

多谢,是端口的原因。不能指定端口号,应该使用环境变量来取得相应的端口。

3Q,问题找到了,应该使用环境变量取得端口号

木有邀请码 :(

@blue5tar 3Q ,但是激活账号的时候,激活的链接提示:

NAE - 错误

Error: 无效的激活链接,请重新发送邮件

@shaman email 多少 ,我发给你

@shaman 那就是可以了~~

@shaman 具体怎么实现的呢,最近我也遇到相同的问题,怎么使用环境变量取得端口和IP?请指点,谢谢哈

回到顶部