简体   繁体   中英

cloudControl: Failed to start container

I'm trying to set up a Node.js deployment on cloudControl , however my deployment fails and I have no idea why. The logs prompt me this error:

1/15/15 4:15 PM  Info Failed to start container

My Procfile seems just fine however:

web: node server.js

I get no further explanation or stacktrace on why the container failed to start. The exact code I'm trying to deploy is on github: https://github.com/dunnkers/roosters-api

I'm using mongoose to connect to an external MongoSoup database. I'm however not using the addon for this. Could this by what's failing the deployment?

All ideas are appreciated!

You have to start your server on the port provided in the PORT environment variable. A look in the repository shows that you are looking for the OPENSHIFT_NODEJS_PORT.

Also a look into the error log ( https://www.cloudcontrol.com/dev-center/Platform%20Documentation#logging ) could provide you with more information.

There is no need to use the provided addons, you can use whatever backend you prefer. Choosing one of the addons simplifies the integration process by providing the necessary credentials as environment variables and a single point of support. But this is completely up to you

Good find TooAngel - I changed it immediately. The server port however did not turn out to be the only problem.

I used environment variables to store my MongoDB connection url, using the config addon : cctrlapp APP_NAME/DEP_NAME config.add MONGODB_URL="X" , which I then tried accessing in my code using: creds.MONGODB_URL . (see the dev-center )

This however didn't work. After some slight debugging I found out that actually the correct way to access custom config is: creds.CONFIG.CONFIG_VARS.MONGODB_URL

After fixing this, everything deployed correctly!

1/17/15 1:13 AM Deploy ***** Deployed *****

After all, it turned out I didn't get a proper error message because I didn't properly catch it. The config access confusion however is something which can be improved in cloudControl documentation. I'll see if I can file an issue for this to help other people deal with this problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM