Closed ssoloff closed 6 years ago
We pay for bandwidth from Linode server, a 350 MB download per build could add up.
Is git LFS an option? I've no personal objection as well to doing history re-writes in assets repo to reduce repo size.
a 350 MB download per build could add up
I'll have to double-check, but I don't think the bundled JREs are actually required during the build. Despite the adjective, they aren't actually "bundled" with the installer (the installer only contains their URLs). AFAIK, they are only downloaded when a user running the installer does not have a local JRE installed.
If it turns out they are required during the build, I'll ask forgiveness for opening this issue. :smile: In that case, the history re-write is probably the right solution.
Nevermind. Even though install4j doesn't include the JREs with the installer, it still wants to examine them at build time (I guess to verify that they are in its required format). So at least three JREs (Mac, Windows x86, and Windows x64) need to be downloaded per build. :-1:
@ssoloff From my experience install4j checks if the files exists, and not much more. When we upgraded to install4j7, I temporarily "fixed" the installer generation by simply creating zip files and naming them like the JRE files IIRC. That being said, it seems like a bug that the generator actually requires the files offline.
@RoiEXLab Thanks for the suggestion. While an empty file or an empty gzipped tar archive result in the following exceptions:
install4j: compilation failed. Reason: java.io.IOException: The JRE bundle /home/ssoloff/Projects/triplea-game/triplea/build/assets/install4j/windows-x86-1.8.0_144.tar.gz is damaged and cannot be read.
install4j: compilation failed. Reason: JRE bundle does not contain readable tar entries.
A gzipped tar archive with at least one entry apparently makes install4j happy.
So, it looks like we could keep dummy files in the Git repo and the actual files someplace else. In that case, I'm going to re-open this issue as there are some viable alternatives.
a 350 MB download per build could add up.
BTW, my eyes weren't working properly when I wrote up this issue. :smile: The bundled JREs are ~35 MiB in size, not ~350 MiB. That order of magnitude probably makes a huge difference.
Is git LFS an option?
Possibly. It looks like it will work for devs pretty easily because it integrates with the Git client. However, I'm not sure how one can retrieve the large file from a plain URL, which is how users would actually download the JRE.
I'll set up a test repo and play around with the dev and user workflows.
@ssoloff Perhaps you should report this as some sort of bug to the install4j guys, because I really don't think it's intended to check the JRe if it's not actually bundling it.
@RoiEXLab Good idea. I'll fire off an email to Ingo asking if there is a way around it, or at least what is the reasoning for it.
So removing the bundled JREs from the build process is probably not possible. Per Ingo:
I just had a look if I could add a VM parameter to disable the check, but there is some more logic associated with it. The compiler scans the bundle to see if there are any packed files in it, if you provide empty bundles or if the check is disabled, the Windows installer will not work.
I verified the Windows x86 installer I built with a dummy bundled JRE works just fine. However, that simply means the current JRE bundle contains no packed files. I don't think there's any guarantee one or more packed files won't be introduced in the future.
I finally got around to trying out Git LFS, and it appears this will work.
I set up a test repo at https://github.com/ssoloff/git-lfs-test, which contains both regular files and files tracked by LFS. I confirmed the bare repository does not actually contain the large files I set up to be tracked by LFS. Manipulating these tracked files in a non-bare repository is seamless, as LFS hides all the gory details from you.
I also confirmed trying to download one of the tracked files through a direct HTTP call to GitHub works as expected. Using wget
, I was able to download a tracked file. The only difference I saw from a non-LFS file is that GitHub redirects the request to a different URL (presumably to the server where the large files are actually stored). For example:
$ wget https://github.com/ssoloff/git-lfs-test/raw/master/macosx-amd64-1.8.0_144.tar.gz
is redirected to
https://media.githubusercontent.com/media/ssoloff/git-lfs-test/master/macosx-amd64-1.8.0_144.tar.gz
So the only thing we would have to verify is that the install4j installer follows these redirects when it attempts to download a bundled JRE (I see no reason why it wouldn't).
That just leaves some logistics for the dev team. Git LFS requires an external tool, so everyone would have to install it in order to work with an LFS-enabled repository. I used the RPM package, but they have binaries for all platforms. You can find installation instructions here and play around with your own LFS-enabled repo (or fork my test repo) to see if there are any issues for your platform.
We also need to keep in mind the possibility of installing the LFS client on Travis. Right now, we do a direct HTTP download of the assets we need, but if we ever attempt to clone an LFS-enabled repo, the LFS client must be present. (From travis-ci/travis-ci#3634, it seems that the LFS client may already be pre-installed in the latest Travis images.)
@DanVanAtta @RoiEXLab @ron-murhammer Are there any objections to enabling Git LFS the next time we have to add a large file to the assets
repo?
@ssoloff No objections from my side.
@DanVanAtta @ron-murhammer Bumping this comment.
@DanVanAtta @RoiEXLab @ron-murhammer Are there any objections to enabling Git LFS the next time we have to add a large file to the assets repo?
No objections at all so long as developer workflow instructions are updated on dev docs readme
@DanVanAtta Roger that. I'll submit a PR to update the README with the Git LFS client installation instructions.
Noting here that, after a brief run with LFS enabled in the triplea repo, it has been disabled because we quickly (~7 days) exhausted our monthly LFS bandwidth quota. See #2921 for more information.
We bundle JREs with our installer for users that do not have a Java 8 JRE installed on their machine. We currently host these bundled JREs in the triplea-game/assets repo, and the installer downloads them, if needed, directly from GitHub.
There are a few problems hosting these files on GitHub:
HEAD
in the repo (we currently have two versions for three platforms). Each JRE is approximately 350 MiB.HEAD
, it stays in the repo history unless we rewrite history.A static file server is probably a better place to host these resources rather than using a Git repo. The purpose of this issue is to discuss possibly moving the bundled JREs to one of our Linode servers and serve them from there using Nginx (or something equivalent).
Some issues with self-hosting include:
@DanVanAtta @prastle @RoiEXLab @ron-murhammer Thoughts?