question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[🤔] Proposal: Download Compiled Assets on Local Install instead of Compiling them Locally

See original GitHub issue

I’m marking this as a proposal as I’d be very interested in what you all think about this and to see if there are other downsides to this then the ones listed below.

Description

The local Juice Shop install currently takes a long amount of time. This time is basically spent on two tasks:

  1. Downloading Dependencies via npm (for both backend & frontend)
  2. Compiling the Angular frontend

Solution ideas

Instead of compiling assets locally, Juice Shop could download the compiled frontend assets, as these are identical for every install of a specific Juice Shop version, even when a customized config.

To download the assets every (future) JuiceShop release could have these assets attached as a Zip on the GitHub Release.

The download could happen at two possible steps:

  1. postInstall. Basically where the compilation is happening now, using a postInstall npm hook to download the Zip and unzipping it to the frontend/dist/ folder.
  2. On startup, similar to other steps, e.g. lib/customizeApplication.js

This download should only happen if the frontend/dist/ folder doesn’t already contain the compiled assets for the current juice-shop version. If it contains the assets for a different version, frontend/dist/ should be deleted and replaced with the assets matching the released version.

🐳 How about Docker?

The docker image build should be updated to still compile the assets locally, so that the container don’t need to download the assets on startup.

🔙 Backwards Compatibility

This should not interfere with older versions as these would still compile their assets locally.

👍 Benefits

  • Allows to completely skip the frontend npm install for most users (Saves a ~500MB download of npm dependencies, compared to the ~30MB of compiled assets)
  • Allows to skip resource intensive frontend compilation
  • Would enable to also improve the npm install for the server dependencies as they could more easily download only the production dependencies
  • All in all this should improve the "git clone to running Juice Shop time dramatically by skipping / optimizing the most time consuming parts.

👎 Downsides

  • Local install isn’t “ready” to start developing, as they are missing development dependencies
  • Requires additional CI config to compile and publish assets to GitHub Releases
  • What to do when asset download is failing?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
J12934commented, Sep 27, 2020

Okay nice 👍 I’ll try to prototype this in my personal Juice Shop fork.

0reactions
github-actions[bot]commented, Sep 11, 2022

This thread has been automatically locked because it has not had recent activity after it was closed. 🔒 Please open a new issue for regressions or related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Guide to precompile assets in local environment before ...
This is a problem for me because I can no longer deploy to heroku without precompiling locally because I get Java heap out...
Read more >
Assets won't precompile when deploying with capistrano to ...
Precompiled assets locally, pushed to github repo, cap deployed from local machines to ec2. cap deploy is local, the code being pushed to...
Read more >
The Asset Pipeline - Ruby on Rails Guides
The asset pipeline provides a framework to concatenate and minify or compress JavaScript and CSS assets. It also adds the ability to write...
Read more >
juice-shop - Bountysource
Downloading Dependencies via npm (for both backend & frontend); Compiling the Angular frontend. Solution ideas. Instead of compiling assets locally, Juice Shop ...
Read more >
Rails Asset Pipeline on Heroku
To compile your assets locally, run the assets:precompile task locally on your app. Make sure to use the production environment so that the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found