I switched my project (node.js + mongodb) from Openshift v2 to v3. Also I'm using Starter version of v3 for my project and web console for all configurations.
Deploy results in failed status with following error:
--> Scaling tmo-9 to 1
error: update acceptor rejected tmo-9: pods for rc 'tmoolympus/tmo-9' took longer than 600 seconds to become available
Pod's log:
Environment:
DEV_MODE=false
NODE_ENV=production
DEBUG_PORT=5858
Launching via npm...
npm info it worked if it ends with ok
npm info using npm@3.10.9
npm info using node@v6.11.3
npm info lifecycle TMOOLYMPUS@1.0.0~prestart: TMOOLYMPUS@1.0.0
npm info lifecycle TMOOLYMPUS@1.0.0~start: TMOOLYMPUS@1.0.0
> TMOOLYMPUS@1.0.0 start /opt/app-root/src
> node server.js
production
trying to connect..
after connect..
Initalizing db..
Checking roles..
in counter gen seq
in counter gen seq
Checking news category..
in counter gen seq
Fnished initalizing db..
tmoolympus is running, listening on 127.0.0.1:8080
all dirs donee
in counter gen seq
in counter gen seq
Checking admin user
in counter gen seq
[ { _id: 5a900dc3b52e58ddd9a57cac, roleid: 1, __v: 0 },
{ _id: 5a900dc3b52e58ddd9a57caf, roleid: 3, __v: 0 },
{ _id: 5a900dc3b52e58ddd9a57cb0, roleid: 4, __v: 0 } ]
Checking tmo team..
in counter gen seq
npm info lifecycle TMOOLYMPUS@1.0.0~poststart: TMOOLYMPUS@1.0.0
npm info ok
Second log shows that server is up and running, however application isn't available and it tries recreating deployment for few more times before stopping - The container nodejs-mongo-persistent is crashing frequently. It must wait before it will be restarted again.
.
Question: Is it fault on my side or Openshift v3?
There are 2 issues going on. First, I'm assuming you deployed the nodejs-mongo-persistent
template, which defines a readinessProbe
and livenessProbe
that look for a /pagecount
URL and will not consider your pod healthy until it finds that page. I would recommend either removing those probes, or adjusting them to look at a URL in your codebase.
Second, your application seems to be listening to 127.0.0.1
which won't allow your application to be externally accessible. Seeing as this was based on v2, I would recommend creating an environment variable in v3, OPENSHIFT_NODEJS_IP
, and set it to 0.0.0.0
. These environment variables are no longer necessary in v3, as you can just set any application to 0.0.0.0
and have it be accessible (with an appropriate route).