ryanj / nodejs-custom-version-openshift

Node.js quickstart application to run the latest or any custom Node.js version on OpenShift
63 stars 23 forks source link

App is still started with node 0.10.25 after fresh deployment #2

Open juodumas opened 9 years ago

juodumas commented 9 years ago

Looks like there is a problem with PATH. App starts with 0.10.25, but node --version via SSH reports 0.12.0... Maybe OpenShift has changed something?

To reproduce:

  1. rhc app create nodeapp nodejs --from-code=git://github.com/ryanj/nodejs-custom-version-openshift.git
  2. Add console.log('VERSIONS', process.versions); to server.js, git push.
  3. Here is rhc tail output after pushing:
VERSIONS { http_parser: '2.0', node: '0.10.25', v8: '3.14.5.10', ares: '1.9.1', uv: '0.10.23', zlib: '1.2.3',   modules: '11', openssl: '1.0.0-fips' }
Behukob commented 9 years ago

i have same issue

hipek commented 9 years ago

Hi,

I have the same problem. Any idea or workaround?

Thanks.

icflorescu commented 9 years ago

Until this is solved, have a look at this auto-updating Node.js cartridge.

hipek commented 9 years ago

Thanks Icflorescu. It works for me.

jonface commented 9 years ago

I'd be interested in getting this fixed if possible, thanks.

Spouwny commented 9 years ago

I found a workaround.

the cartridge is calling a nodjs_context() function before launching node. This function checks $OPENSHIFT_NODEJS_VERSION and if it is 0.10 make a call that ends up adding the path to node v0.10 before everything else.

My workaround was to edit .openshift\lib\utils and add export OPENSHIFT_NODEJS_VERSION=0.6 in the setup_path_for_custom_node_version() function.

How it looks after the edit:

.openshift\lib\utils

   #  Add the node binary path to the PATH.
   export OPENSHIFT_NODEJS_VERSION=0.6
   export PATH="$node_bin_path:${PATH}"

I can't assure that there is no side effects, but my app is now running on node v0.12

oddmouse commented 8 years ago

Thanks @Spouwny. That did the trick for me. I'm running v5.1.0 just fine now.

jorgecolonconsulting commented 8 years ago

@Spouwny worked for me too. I mistakenly set OPENSHIFT_NODEJS_VERSION to 4.2.4 in the utils script. It's important, like you mentioned, that it's set to 0.6, EVEN IF YOU'RE NOT RUNNING 0.6. Wasted almost a day on this.

jonface commented 8 years ago

@Spouwny - works for me, cheers.

juandav commented 8 years ago

I need to install the latest version of nodejs and mongodb

ryanj commented 8 years ago

Thanks All! I've added @Spouwny's fix to .openshift\lib\utils and bumped the default nodejs version to 5.9.0.

I had originally posted this content as a quick hack to demonstrate how someone could provide their own custom runtime on OpenShift (V2) using the .openshift application startup hooks. However, the nodejs runtime should ideally be provided by the platform (or by a cartridge).

I'd recommend trying @icflorescu's openshift-cartridge-nodejs in the future, since it offers a cleaner separation between the application sources and the javascript runtime.