existentialmutt
existentialmutt

Reputation: 470

Speeding up Deployment for a Rails 5.1 / Webpacker app

I just upgraded our app to Rails 5.1 app and used webpacker to include React and some custom components. It was so easy! Thank you!

I've noticed that this added about 100 MB to the node_modules directory. That's cool, I get that this comes with NPM territory, and the folder is gitignored by default in a new rails project so it won't clutter up the repo. That's great!

The thing that I'd like to be better is that deploys now take a long time, because the server has to download all those packages from NPM every time we deploy. We're deploying to AWS using capistrano 3. Is there a safe way to store the NPM packages somewhere on the server that persists across deploys, so that they don't have to be downloaded each time?

Upvotes: 2

Views: 651

Answers (1)

Matt Brictson
Matt Brictson

Reputation: 11102

Sure! Just add node_modules to your linked_dirs.

# deploy.rb
append :linked_dirs, "node_modules"

Upvotes: 6

Related Questions