Giter Club home page Giter Club logo

Comments (5)

Scrumplex avatar Scrumplex commented on June 9, 2024 1

cpcache uses it's own internal mirrorlist. That means your reflector changes won't affect cpcache. In /etc/cpcache/cpcache.toml you can define mirrors yourself OR just let cpcache handle it automatically.

For example:

My cpcache config looks something like this:

# ...

# The selection method to choose a mirror. Valid values are:
#   "auto": In order to attempt to find suitable mirrors automatically.
#           With this method, performance tests are run on the official mirrors
#           to select only sufficiently fast mirrors.
#   "predefined": To only choose the mirrors defined for the variable
#                 mirrors_predefined (see below).
mirror_selection_method = "auto"

mirrors_predefined = [
    # ...
]

# ...

[mirrors_auto]
    # only use mirrors with HTTPS support.
    https_required = true
    # mirrors must support IPv4.
    ipv4 = true
    # mirrors must support IPv6.
    ipv6 = true
    # The maximum score allowed from a mirror. See
    # https://www.archlinux.org/mirrors/status/ for an explanation of this
    # metric.
    max_score = 2.5
    # timeout, in milliseconds, when testing the mirrors' performance.
    # Mirros which exceed the timeout will not be considered further, regardless
    # of their score.
    timeout = 500
    # If mirrors are chosen automatically, this setting allows to define how
    # often the selection process should be repeated. Valid values are positive
    # numbers (for instance, 24 to rerun the selection process every 24 hours),
    # and -1 to never re-run the selection process.
    test_interval = 24

This activates some kind of included reflector, which can be configured as described above. Using this is the best way I know of using cpcache.

On all my machines I have set cpcache's endpoint as the first mirror and have my usual resolver list after that. Defining more mirrors than cpcache is good if you want something to fall back to in case cpcache is offline.

from cpcache.

jogleasonjr avatar jogleasonjr commented on June 9, 2024

Great - thank you for the response. Does cpcache refresh the mirrors when the server (re)starts? Also - how many mirrors does it maintain internally?

from cpcache.

Scrumplex avatar Scrumplex commented on June 9, 2024

As far as I know it does not store this list so it would need to do that on every start. I don't know how many it maintains internally (I am not the developer, I have no idea how this language even works)

from cpcache.

nroi avatar nroi commented on June 9, 2024

Thanks for your feedback, it's always interesting to hear how others use cpcache.
As described by @Scrumplex, cpcache maintains its own mirrorlist. The whole mirror handling in cpcache is less than ideal, what it currently does is:

  1. At startup, try to fetch a mirrorlist from https://www.archlinux.org/mirrors/status/json/
  2. If that fails (which often happens because there is no internet connectivity immediately after startup if cpcache boots with your system), try again after 5 seconds, with 5 attempts in total. If all five attempts have failed, it will see if the json document has been cached from a previous run of cpcache. If that also fails, the five mirrors stored in mirrors_predefined in /etc/cpcache/cpcache.toml are used as fallback (I just noticed that some of the mirrors defined in the toml file are not even active anymore…)
  3. When the json document has been fetched successfully, test the latency of all mirrors that match the given criteria (the ones defined in [mirrors_auto] in your /etc/cpcache/cpcache.toml). These mirrors are then sorted by latency.

This list is not stored, it's re-generated after each start. For each download, it tries each mirror in this list one after another until there are none left, then it returns 404 to the client.

In instances where a package updates, such as i3-gaps yesterday, cpcache couldn't find the package and the client machine was getting 404 errors. I updated the mirrorlist of 50 on the cpcache server and restarted, but I still couldn't get the package.

This was most likely a bug in cpcache, but it's difficult to say what caused it exactly. I've been meaning to revamp the whole mirror selection process for some time, hopefully I'll get around to it this weekend and hopefully, this will fix your issue.

from cpcache.

jogleasonjr avatar jogleasonjr commented on June 9, 2024

Thanks for the explanation. Understanding how it works will help place it into my workflow correctly. Thanks again!

from cpcache.

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.