-
Notifications
You must be signed in to change notification settings - Fork 386
Add env var to stop rebuilding dependencies when compile #19
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
Conversation
Hey ArthurHlt! Thanks for submitting this pull request! I'm here to inform the recipients of the pull request that you've already signed the CLA. |
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/93895964. |
Hey @ArthurHlt, Thanks so much for sending this contribution! Ideally I'd like to see some tests around this behavior before we merge it in. I'll schedule some time from the core Buildpacks team to take a look at this PR and possibly put some tests around it. Thanks again! |
Yep that's could be good, let me know when it will be done |
Further context from another CF user:
|
@ArthurHlt, could you give us the reproducible instructions that shows the pushing of an app fail with the example application? Like: git clone https://github.com/cloudfoundry-community/etherpad-lite-cf
cd etherpad-lite-cf
npm .....
cf push
cf set-env ....
# etc... |
Simply follow instructions (Only 5 in installation) from the repo and push the app inside a cloud foundry which have not internet connection, You should see what's going wrong. |
OK, so let me re-state what I understand the issue to be here. If I've vendored (that is, all my npm dependencies are within my project directory, and getting If I'm right, then I'm not convinced that working around this behavior by forcing the developer to set an environment variable. I'd like to do some research into how npm behaves, and if possible have the buildpack just Do The Right Thing™. If you have knowledge of how npm behaves, I'd love to better understand what our options are here. Could it be as easy as comparing the contents of package.json to what's on disk? |
@ArthurHlt do you have any thoughts on the above? |
Oh I didn't see, for your first question is close to be correct. I think this change is a big chunk for this buildpack and maybe a correction should be made on NPM. I can't help you so much on understand what actually do NPM, I'm not really an expert and in add, I feel that NPM is a mess to understand. About the env var, it's just a litle and ephemeral fix, I've made it to give a quick solution for this usecase a better solution should be found. |
Hi @ArthurHlt would you say this is still relevant or can this be closed? |
Closing due to inactivity. @ArthurHlt feel free to comment on the pr if you think it is still relevant. |
Please reopen this. This is a massive headache when deploying behind firewalls. IIUC, the native modules have already been built, so in many cases there's no point in rebuilding. Rebuilding can also greatly increase deployment time, depending on the number of native modules. |
@0x1mason do you want to pick up this pull request/change? Pull requests are welcome. |
@0x1mason the issue was originally, there were too many use cases for knobs to turn on and off. We had one client ask only to rebuild certain modules because they had not compile all of them. The issue is the If this get's reopened, a environment feature flag is not the way to solve it. Because it goes against what I've seen are the best practices of deploying NodeJS applications. If another workflow can be proposed, where |
Sure, I can own it. Do you want that I should submit at new PR? Here's the problem:
@jtarchie I agree that the env var isn't ideal. I'm no CF expert, but from a naive perspective, the Right Way appears to be allowing deployers to customize the |
It's not actually |
As the original requester i will give you my feelings about that. I didn't answer back about this PR only cause I think it's something which should be fix on npm (for example add an option to rebuild to not trying download source code from repository for rebuild). It could be nice to have an ugly (yes it's ugly) workaround for this but it will just postpone the problem. So, my guess is that we should (I mean the community) report this issue to npm and why not directly fix it with PR even if i think that it might be difficult cause of the way npm took. |
@ArthurHlt I don't think It could be that we're talking about 2 different problems, in which case I can create a new issue. |
@0x1mason I believe you are talking about the same problem. The original PR tried to disable
We researched this before. It would be great if |
@jtarchie The point of What about changing |
On second thought, My preference would be the ability to customize the cmd, since it puts more control in the hands of deployers. What is the best vehicle for that type of customization? |
@0x1mason Well it's actually what buildpack wants, guarantees compatibility. In many case container used to run your app is under linux 64 OS, you will need to have binaries inside which is compatible with this OS. @jtarchie good idea for verification when npm rebuild, maybe it's not too hard to propose a PR for this on npm or node-gyp. I will take a look. |
@jtarchie Sorry, I glossed over where you said "compiled for the targeted system". @ArthurHlt Unless I misunderstand, a NPM/node-gyp change would mean you would have to have access to the latest version of NPM to take advantage of the feature. For many people that would mean waiting months or even years before before having access to it. |
@0x1mason, not if the buildpack had the latest one. |
Your approach isn't going to work for us, but I appreciate the dialog. I'll
|
You can see discussions from here: #11 and here #6
It's just to fix the rebuild problem by let's the possibility for the user to no rebuild (by default buildpack will rebuild dependencies).
For no rebuild you have to set an en var:
NO_REBUILD
totrue
.Your nodejs app should be build and install dependencies before pushing to Cloud Foundry you can do it with travis for example.
A good usecase is to try to install https://github.com/cloudfoundry-community/etherpad-lite-cf in offline mode (follow the README) and set NO_REBUILD.
This fix is also to have an option before something better will be made.