volta
volta copied to clipboard
Statically link to Rustls instead of using OpenSSL
Info
- Implements the changes described in https://github.com/volta-cli/rfcs/pull/47
- As discussed in the RFC, while using a statically-linked TLS implementation reduces our need to build for the unique CentOS flavor of OpenSSL, we still need to use an older version of Linux to link against an older
glibcversion. - However, the build tools on CentOS 6 (the baseline for the
glibcsupport that we've maintained) are too old to support buildingring(a dependency ofrustls). - To work around that, I discovered a docker image for Scientific Linux CERN 6, which is based off of RHEL 6 (the same as CentOS).
- The CERN distro includes its own mirror of the package repositories (in fact, we are already using the cern mirrors for CentOS 6 in our CI right now)
- It also includes the ability to install more recent build tools, which allows us to compile
ring
Changes
- Updated the dependency on
attohttpcto enable the use ofrustlsinstead ofnative-tls(OpenSSL on Linux) - Created a
Dockerfilethat builds off of Scientific Linux CERN 6, installing updated build tools - Updated the
releaseCI workflow to build a single Linux version using the above Docker container. - Updated the install script to look for the new single version in the case of Linux
Tested
- Confirmed locally using this Docker image that we are able to compile and run Volta
- Verified that the single Linux build artifact from CI runs correctly works on old CentOS Linux, recent Ubuntu, and latest Ubuntu (3 different OpenSSL versions).
Notes
- This PR changes the file name for the
linuxbuild artifact to bevolta-{version}-linux.tar.gz, without theopenssl-Xsuffix. This means we probably will need to roll it out in stages:- Pin the redirect for
get.volta.shto a commit hash, so that it isn't affected when this is merged. - Merge this and prepare the release (along with any other features that we might want to include)
- Test by fetching the new script directly to confirm that it works as expected.
- Cut the release, then un-pin the
get.volta.shredirect so that it points at the updated script.
- Pin the redirect for
- We'll also need to update the "Installing Old Versions" section of the Installers docs to include another special-cased version of the install script, for people who want to install versions prior to the install script change.
- For all of the above reasons, leaving this as a draft for now, as we definitely do not want to merge as-is.
Would this mean that you wouldn't need openssl to install volta?
@alvarlagerlof Yes, exactly! That's actually one of the main motivations for this suggested change (see the linked RFC): Dealing with all of the different OpenSSL versions—trying to detect the appropriate one, fetch the correct binary, etc.—is a major pain point in our Linux installer. This would simplify all of that by statically linking to a Rust-based TLS/SSL implementation and avoiding all of the headaches that come with dynamically-linked OpenSSL.
@charlespierce I guess this PR would also allow https://github.com/volta-cli/volta/issues/1049 to move forward, right? I'm using volta on an EC2 with the Graviton2 ARM CPU and at the moment have to compile it myself, but would much prefer volta to release prebuilt binaries.
@ZauberNerd Yes, I believe this would allow that change to move forward as well, since it would remove the OpenSSL issues that ran into. The shift to Scientific Linux CERN 6 may also help alleviate the toolchain issues.
@charlespierce that's awesome! Is there something I could do to help get this PR out of the draft state?
@ZauberNerd I don't think there's anything left on this PR directly (other than resolving the merge conflicts). I'm leaving this in draft for now mostly to make sure that we don't accidentally merge it :smile: There's some infrastructure work we'll need to do before merging to make sure we don't break existing installs while we work towards the actual release of this change.
@charlespierce what (if anything) can I do to unblock this over this coming week? Would love to help get it landed!
@chriskrycho I think the only thing remaining is landing this PR (and then some testing when we cut the release). My initial thoughts were being a little wary of version churn with the in-progress pnpm implementation, but I think there's enough significant changes between this and Yarn 3 support, plus there are some follow-ups needed for pnpm, so I'd lean towards getting this merged (along with any smaller outstanding PRs), and then cutting it all as version 1.1.
I'll update this to resolve the merge conflicts and also put out a PR to clean up some additional warnings we seem to be getting.
That seems reasonable to me! Let's do it!
itshappening.gif
Wow this is huge! Thanks to everyone involved who helped to solve those openSSL linking issues with this PR.
Is it possible to get an "official" v1.1.0 release after the merge?
That's precisely the plan—this and Yarn 3 support will be the headliner features! (With, hopefully, a 1.2 with pnpm support landing relatively soon after that. 🤞🏼)