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

[#136] Bump default tarball_max_size from 8 MiB to 16 MiB #137

Conversation

onno-vos-dev
Copy link

I opted for the 2nd option as per described in the issue as it's the quickest and easiest to resolve my issue and allow me to publish docs again. I'll open a separate issue on rebar3_hex to discuss the option of moving to create_docs/2.

src/hex_core.erl Outdated Show resolved Hide resolved
@ericmj ericmj changed the title [#136] Bump default tarball_max_size from 8MiB to 64 MiB [#136] Bump default tarball_max_size from 8 MiB to 16 MiB Jan 30, 2023
@ericmj ericmj requested a review from wojtekmach January 30, 2023 15:53
@wojtekmach
Copy link
Member

Thank you for the PR. This change will up the limit of package tarballs too which I'm not opposed to in general but I'd wait for a concrete use case. If all you need is bigger docs tarball size, I'd rather focus on that.

Changing rebar3_hex is the way to go. In the meantime you can manually publish the docs using this elixir script:

Mix.install([:req])

path = "docs.tar.gz"
{_, 0} = System.cmd("rebar3", ~w(ex_doc), into: IO.stream())
{_, 0} = System.cmd("tar", ~w(-czf #{path} --cd doc .), into: IO.stream())
tarball = File.read!(path)
File.rm_rf!(path)

# $ mix hex.user key generate --permission api:write
token = "..."
package = "hex_core"
version = "0.9.0"

Req.post!("https://hex.pm/api/packages/#{package}/releases/#{version}/docs",
  body: tarball,
  headers: [authorization: token]
)
|> dbg()

It's not a fantastic solution but hopefully it unblocks you in the meantime?

@starbelly
Copy link
Contributor

@wojtekmach What's the limit for doc tarballs on the server side? I believe saw 10MB, can you confirm that is correct?

@onno-vos-dev
Copy link
Author

onno-vos-dev commented Jan 31, 2023

@wojtekmach I can try out the Elixir script you posted later, thanks for that <3

I'd still argue for upping the limit as I'm fairly sure aws_erlang will breach the 8MiB limit fairly soon-ish. It currently sits at around 6.8 MiB and considering that each time AWS opens a new API or expands on existing API's/docs, aws_erlang simply automatically generates the code for it, aws_erlang is essentially only getting bigger and rarely shrinks (AWS rarely deprecates services). So it's mostly a matter of time before we reach the limit.

Is there any chance you can re-consider? :-) Otherwise I'll push for the change in rebar3_hex and try and spend some time on the weekend to make a PR there :-)

Copy link
Member

@wojtekmach wojtekmach left a comment

Choose a reason for hiding this comment

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

I'd still argue for upping the limit as I'm fairly sure aws_erlang will breach the 8MiB limit fairly soon-ish. It currently sits at around 6.8 MiB

oh, ok, thanks for letting us know!

@wojtekmach
Copy link
Member

@starbelly yes at the moment hexpm only allows request bodies with ~10mb.

@onno-vos-dev
Copy link
Author

onno-vos-dev commented Feb 8, 2023

@wojtekmach What would be required to have this merged? 😄 Is there anything I can do? 🙂

@@ -84,6 +84,8 @@ format_error({invalid_gnu_0_1_sparsemap, Format}) ->
lists:flatten(io_lib:format("Invalid GNU sparse map (version ~s)", [Format]));
format_error(unsafe_path) ->
"The path points above the current working directory";
format_error(too_big) ->
"The tar exceeds tarball_max_size or tarball_max_uncompressed_size";
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is the right place for this error since it's error is raised in hex_erl_tarball.

This file is vendored from Erlang's erl_tar module.

Copy link
Contributor

Choose a reason for hiding this comment

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

The error should be handled inside rebar3_hex, but I see a gotcha with it, I'll do a fixup there, the error there would look like :

===> Error building package : package exceeds max compressed size 8.388608 MB

Copy link
Author

Choose a reason for hiding this comment

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

I will revert the error from this PR 👍

@ericmj
Copy link
Member

ericmj commented Feb 8, 2023

hex.pm has been updated to allow docs tarballs up to 16MiB size.

@onno-vos-dev onno-vos-dev force-pushed the issue-136-bump-default-tarball_max_size branch from f6e9ed6 to 6650869 Compare February 17, 2023 10:11
@starbelly
Copy link
Contributor

@ericmj To unblock @onno-vos-dev should I just precede with cutting a version of rebar3_hex passing in the new size for docs tarball?

src/hex_core.erl Outdated Show resolved Hide resolved
@ericmj
Copy link
Member

ericmj commented Feb 29, 2024

Closing in favor of #143. Thanks for the PR @onno-vos-dev!

@ericmj ericmj closed this Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants