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

Symlink app archive to apps instead of expanding #330

Merged
merged 1 commit into from
Dec 14, 2022

Conversation

hibell
Copy link
Contributor

@hibell hibell commented Dec 9, 2022

Summary

Skip expanding app archive and just symlink it to reduce image size.

Use Cases

Decreases image size to reduce costs to store, transfer, etc. the image.

Checklist

  • I have viewed, signed, and submitted the Contributor License Agreement.
  • I have linked issue(s) that this PR should close using keywords or the Github UI (See docs)
  • I have added an integration test, if necessary.
  • I have reviewed the styleguide for guidance on my code quality.
  • I'm happy with the commit history on this PR (I have rebased/squashed as needed).

@hibell hibell requested a review from a team December 9, 2022 05:24
@dmikusa dmikusa added semver:minor A change requiring a minor version bump type:enhancement A general enhancement labels Dec 10, 2022
@dmikusa
Copy link
Contributor

dmikusa commented Dec 10, 2022

@hibell - Hi, thanks for this! A couple of questions.

  1. The present implementation looks to be extracting the WAR file but not deleting the WAR file. Would it be possible to just extract and delete the WAR file to keep space low? It'll be slightly more space as the WAR is compressed, but I can't imagine it's a huge difference.

  2. I'm trying to recall why we were extracting the files. Presumably, Liberty has to extract the files before it can run the app so I think there might be a slight performance boost by extracting them in advance. However, I'm guessing it was probably a file system permissions fix. Again, if Liberty has to extract the app first, then it has to write those files somewhere. It won't be able to write to the app directly at runtime in a lot of cases (just to /tmp). Would Liberty still be able to run the app if it could only write to /tmp?

@hibell
Copy link
Contributor Author

hibell commented Dec 12, 2022

@dmikusa Thanks for the comment.

I like your idea of deleting the compiled artifact after expansion to remove the duplicate file and I've made the changes. The only concern that was reported to us was that it was duplicated so this solution should meet the requirements.

I'm trying to recall why we were extracting the files. Presumably, Liberty has to extract the files before it can run the app so I think there might be a slight performance boost by extracting them in advance. However, I'm guessing it was probably a file system permissions fix. Again, if Liberty has to extract the app first, then it has to write those files somewhere. It won't be able to write to the app directly at runtime in a lot of cases (just to /tmp). Would Liberty still be able to run the app if it could only write to /tmp?

The original motivation for the expansion was to keep the app directory consistent. For the Liberty buildpack, we create an output directory with g+wx permissions and set WLP_OUTPUT_DIR to the directory we created so that Liberty can use it to write any files at runtime that it needs. I think this was added after the app expansion stuff.

Copy link
Contributor

@dmikusa dmikusa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked before and after this PR. Before, I can see the additional WAR file in the /workspace. After, the WAR file is extracted to the layer and the WAR file is no longer in the /workspace. I can also see the image size drop by roughly the same size as the WAR. LGTM.

@dmikusa dmikusa merged commit a8f51b2 into paketo-buildpacks:main Dec 14, 2022
@hibell hibell deleted the skip-app-artifact-expansion branch December 14, 2022 05:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver:minor A change requiring a minor version bump type:enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants