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

Save/restore yarn cache #654

Open
swrobel opened this Issue Feb 1, 2018 · 8 comments

Comments

Projects
None yet
5 participants
@swrobel
Copy link

swrobel commented Feb 1, 2018

Every single one of our deploys is taking ~50s to install packages via yarn. This should be near-instantaneous when yarn.lock hasn't changed. It appears that the nodejs buildpack already takes care of saving/restoring the yarn cache.

@schneems

This comment has been minimized.

Copy link
Contributor

schneems commented Mar 22, 2018

You can get caching by using the official node buildpack

$ heroku buildpacks:add heroku/nodejs -i 1
@grk

This comment has been minimized.

Copy link

grk commented Mar 22, 2018

This makes yarn install run twice on each deploy though.

@schneems

This comment has been minimized.

Copy link
Contributor

schneems commented Mar 22, 2018

It should be cached on the second run and nearly instantaneous. Much better than only running once but having to install from scratch.

@swrobel

This comment has been minimized.

Copy link

swrobel commented Mar 23, 2018

@schneems alas, not really, since yarn will still wipe node_modules & re-symlink everything from the cache every time it's run, it's still a 10-15s process

@swrobel

This comment has been minimized.

Copy link

swrobel commented Mar 29, 2018

Aaaaand it turns out it's even worse than I thought: yarnpkg/yarn#932

Yarn now runs 3x with both buildpacks, building native packages each time:

  1. nodejs: dependencies + devDependencies
  2. nodejs: prune devDependencies
  3. ruby

Deploy times are now officially insane with both buildpacks

@schneems

This comment has been minimized.

Copy link
Contributor

schneems commented May 7, 2018

One option is to use the heroku/nodejs buildpack which does caching and all that fun stuff and then manually disable the yarn:install task in your Rakefile. I think it's something like this:

Rake::Task["yarn:install"].clear
task "yarn:install" do
end
@voter101

This comment has been minimized.

Copy link

voter101 commented May 31, 2018

One possible solution is to build with flag YARN_PRODUCTION set to true. That does not prevent yarn to run three times, but they don't reinstall dev dependencies all the time.

@joevandyk

This comment has been minimized.

Copy link

joevandyk commented Nov 13, 2018

We are running into this as well. Deploy times for us are approaching 7 minutes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment