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

Allow all external download URLs to be aliased #1067

Open
8 tasks done
rarkins opened this issue Jun 16, 2023 · 17 comments · Fixed by #1210
Open
8 tasks done

Allow all external download URLs to be aliased #1067

rarkins opened this issue Jun 16, 2023 · 17 comments · Fixed by #1210
Assignees
Labels
priority-1-critical A bad bug or work that is holding up a lot of other important features or fixes status:in-progress Someone is working on implementation type:feature Feature (new functionality)

Comments

@rarkins
Copy link
Member

rarkins commented Jun 16, 2023

Some users need to build their own containerbase-derived images in their product environments which do not have direct internet access. Instead, they need to set up generic proxies on Artifactory for each distinct external host which is approved, such as github.com, nodejs.org, etc.

Here's some examples used by containerbase:

Host Tool(s)
https://nodejs.org node
https://api.adoptium.net java
https://downloads.lightbend.com scala
https://github.com sbt, python, php,
https://dot.net dotnet
https://cache.ruby-lang.org/ ruby

We can assume for now that such users can already redirect common registries like apt, npm, pip, etc - the primary concern is on arbitrary URLs like the above.

The best way to test this would be to have a build environment with external URLs blocked by default and then try to build a "full" image with all tools and find the missing URLs one by one.

The next thing we'd want is a simple way of defining alternative URLs using env.

One possibility would be to have a syntax where the full from/to is specified in separate, related variables. e.g.

URL_REPLACE_0_FROM=https://node.org
URL_REPLACE_0_TO=https://artifactory.company.com/something/nested

Such a syntax is verbose but then at least should cover every case.

A higher level approach would be like JAVA_BASE_URL=https://artifactory.company.com/something/java but has the downsides:

  • One tool might try multiple hosts, and
  • Multiple tools might use the same host (e.g. github.com)

Missing Tools

@viceice
Copy link
Member

viceice commented Jun 16, 2023

will do this after conversation to higher level, as it's much easier to implement in typescript.

@viceice viceice added type:feature Feature (new functionality) priority-3-normal Default priority, "should be done" but isn't prioritised ahead of others status:blocked Issue is blocked by another issue or external requirement labels Jun 16, 2023
@rarkins
Copy link
Member Author

rarkins commented Jun 16, 2023

I need this within maximum 4 weeks :-/

I think longer term we should take all these URLs and proxy them ourselves through our own CDN/host so that the user only needs to alias one or a few URLs and not 10+

@viceice

This comment was marked as resolved.

@viceice
Copy link
Member

viceice commented Jun 16, 2023

working

  • npm can be configured via npm_config_registry env or ~/.npmrc
  • pip can be configured via PIP_INDEX_URL env or ~/.config/pip/pip.conf
  • gem can be configured via RUBYGEMS_HOST env or ~/.gemrc 1 2

Footnotes

  1. https://docs.inedo.com/docs/proget-feeds-rubygem

  2. https://guides.rubygems.org/command-reference/#gem-environment

@viceice
Copy link
Member

viceice commented Jun 16, 2023

@viceice viceice added priority-1-critical A bad bug or work that is holding up a lot of other important features or fixes status:in-progress Someone is working on implementation and removed status:blocked Issue is blocked by another issue or external requirement priority-3-normal Default priority, "should be done" but isn't prioritised ahead of others labels Jun 16, 2023
@viceice viceice mentioned this issue Jun 16, 2023
3 tasks
@randygeyer-ws
Copy link

Is it sufficient to replace just base urls or will the entire url path need to be set, perhaps minus the artifact file name/ext?

An alternate/simple way to test this is to add /etc/hosts entries for each default hostname to point back to localhost, vs actually blocking the outbound traffic.

@rarkins
Copy link
Member Author

rarkins commented Jun 21, 2023

Is it sufficient to replace just base urls or will the entire url path need to be set, perhaps minus the artifact file name/ext?

By base URL I'm not meaning only the host, I mean it could be like https://host.com/some/path too. Is that what you're worried about?

@viceice viceice self-assigned this Jun 21, 2023
@randygeyer-ws
Copy link

randygeyer-ws commented Jun 21, 2023 via email

@viceice
Copy link
Member

viceice commented Jul 18, 2023

The linked PR above will fix this issue for all tools beside the tools installed via gem, npm or pip. Those would need more effort to override the registry urls.

Would it be enough to document how to use the specific package manager environment variables?

Otherwise i would convert those tools and update the default registry urls on the fly, but that needs some more time to implement.

@rarkins
Copy link
Member Author

rarkins commented Jul 19, 2023

I think those tools hopefully have their own way of using own registries. I was after examples of redirecting URLs like GitHub and downloads.apache.org

@viceice viceice reopened this Jul 24, 2023
@viceice
Copy link
Member

viceice commented Jul 24, 2023

will add the docs and also missing gem, npm and pip support

@rarkins
Copy link
Member Author

rarkins commented Aug 16, 2023

@viceice does this require any more code, or just docs?

@viceice
Copy link
Member

viceice commented Aug 16, 2023

needs more code too

@EXHades
Copy link

EXHades commented Aug 21, 2023

please support redirect/replace https://dl.google.com/go

in some company intranet,unable to access dl.google.com directly

@viceice
Copy link
Member

viceice commented Aug 21, 2023

please support redirect/replace https://dl.google.com/go

in some company intranet,unable to access dl.google.com directly

already supported

@viceice
Copy link
Member

viceice commented Aug 24, 2023

when this build is done, we should have all tools compatible with url replace

https://github.com/containerbase/base/actions/runs/5964382723

@viceice
Copy link
Member

viceice commented Oct 25, 2023

We should mention the abilllity to change the default corepack registry (can only be done at runtime)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority-1-critical A bad bug or work that is holding up a lot of other important features or fixes status:in-progress Someone is working on implementation type:feature Feature (new functionality)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants