Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preventing node-gyp rebuild on every cf push #31

Closed
charyorde opened this issue Sep 4, 2015 · 7 comments
Closed

Preventing node-gyp rebuild on every cf push #31

charyorde opened this issue Sep 4, 2015 · 7 comments

Comments

@charyorde
Copy link

Hi,

Some of my app deps require a rebuild of native modules as seen below:

-------> Buildpack version 1.5.0
-----> Creating runtime environment
       NPM_CONFIG_LOGLEVEL=error
       NPM_CONFIG_PRODUCTION=true
       NODE_MODULES_CACHE=true
-----> Installing binaries
       engines.node (package.json):  0.12.5
       engines.npm (package.json):   2.11.2
       Downloading and installing node 0.12.5...
       npm 2.11.2 already installed with node
-----> Restoring cache
       Loading 1 from cacheDirectories (default):
       - node_modules (exists - skipping)
-----> Building dependencies
       Prebuild detected (node_modules already exists)
       Rebuilding any native modules
       > [email protected] install /tmp/staged/app/node_modules/pm2/node_modules/chokidar/node_modules/fsevents
       > node-gyp rebuild

Is there any exposed flag to prevent this on every cf push?

@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this. You can view the current status of your issue at: https://www.pivotaltracker.com/story/show/102752516.

@jtarchie
Copy link
Contributor

jtarchie commented Sep 4, 2015

@charyorde it looks like it rebuilds each time. Are you experiencing a problem when they are rebuilt?

@jtarchie
Copy link
Contributor

jtarchie commented Sep 4, 2015

This probably won't change, too. It rebuilds each time to guarantee that security patches happen with the compile dependencies.

@charyorde
Copy link
Author

Yes I'm experiencing problems like app taking too long to stage. I had to increase timeout using cf push -t 180. With that said, during app health check (like one of the instances fails and tries to restart itself), it leaves the app in unstable state. Feels like it reduces the app performance.

@jtarchie
Copy link
Contributor

jtarchie commented Sep 4, 2015

To your original question, there is no exposed flag. You are free to fork the buildpack and add the support yourself.

If you are having app performance problems, please contact your CF provider for support.

@jtarchie jtarchie closed this as completed Sep 4, 2015
@flavorjones
Copy link
Contributor

@charyorde Worth noting is that we received PR #19 for something like what you're suggesting.

IMHO, it shouldn't be something that a user has to set, the buildpack (or maybe node-gyp) should be smart enough to see if artifacts are already compiled in the cache dir, and re-use them if so.

We're currently blocked on moving forward because we lack the expertise to know how to implement such a feature, and we're looking for someone from the node.js community who'd be willing to pair with us on this. Would you be interested in doing so?

@charyorde
Copy link
Author

Seems the newly released NodeJS v4.0.0 solves this problem.

Quoting from https://nodejs.org/en/blog/release/v4.0.0/

node-gyp: This release bundles an updated version of node-gyp that works with all versions of Node.js and io.js including nightly and release candidate builds. From io.js v3 and Node.js v4 onward, it will only download a headers tarball when building addons rather than the entire source. (Rod Vagg) nodejs/node#2700

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants