Giter VIP home page Giter VIP logo

Comments (6)

delthas avatar delthas commented on June 18, 2024 1

It could work, but ideally the cache should be based on LRU (least recently used), like most HTTP caches, etc. So that when space needs to be cleared for the package to be saved, the package that was requested (not saved) the longest time ago is deleted. With an external script, I would probably only be able to delete based on file mtime, so the least recently fetched. Meaning that a package that is fetched often will still get cleared regularly after a full cache rotation.

While Athens is a "Go Proxy", it's a also really a cache for Go packages, and having a fixed cache size, with a small logic to delete the LRU ones, is quite standard for caches.

As a first step, an external script could work, but I think that it would really make sense for Athens to have this kind of logic.

from athens.

matt0x6F avatar matt0x6F commented on June 18, 2024

Athens would have to do a lot of work here that's kind of out of the scope of a Go Proxy. Would it be reasonable to suggest writing a daemon or CronJob that monitors that disk and removes files in the order you desire?

from athens.

matt0x6F avatar matt0x6F commented on June 18, 2024

Ah, these are good points. Theoretically we could probably attach some "access" metadata to the indexer. Then I could see having a subprocess that runs continually and removes entries from the index as well as the filesystem based on some threshold criteria.

from athens.

ionrover2 avatar ionrover2 commented on June 18, 2024

What you’re suggesting, i think, could be accomplished with an nginx proxy. I’m not the authority, but i think the intention behind Athens is to ensure longevity of modules than act as an LRU cache. The nature of unused modules getting purged seems counterpoint to the intention of the product. To me at least, I could be very wrong.

Why do you need Athens for this over something like nginx?

from athens.

delthas avatar delthas commented on June 18, 2024

For public packages, setting an nginx HTTP reverse proxy in front of https://proxy.golang.org would probably work after some tweaks. Additional configuration would probably be needed to cache only source files (so basically, .zip) but not metadata; and to store requests on the disk, with a maximum size. At this point nginx would be a working alternative; although would require some thinking for configuring etc.

However for my use case, I would also like to cache packages of a large internal Gitlab (unreachable over the Internet). So I can't just proxy HTTP over proxy.golang.org; and ask proxy.golang.org to fetch the packages for me over Git. I really need a tool that fetches the packages over Git itself. Hence, Athens.

from athens.

ionrover2 avatar ionrover2 commented on June 18, 2024

I also work in an airgapped lab environment and have this same use case!

I have an instance of Athens running on the public internet that I use as a GOPROXY in order to get the packages I need.

Using a deployment that has the same dockerfile in my airgapped environment, I manually tar up the Athens storage directory to a flash drive and unpack it to the same spot on the airgapped side with decent regularity.

This has been great for my team as previously they were vendoring dependencies to dummy projects and then having to hand jam into the project they actually wanted. If you use the GOPROXY variable with the direct clause at the end, you can access your internal golang projects through the proxy in your airgappend environment or directly from their git repo.

from athens.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.