Skip to content

404 from @latest and @v/list when pre-filling the disk cache #1416

@brian73286

Description

@brian73286

Describe the bug
I get 404 from @v/list and @latest endpoints for modules when using athens on a computer that has never cached internet resources, after following instructions for pre-filling the disk cache.

Error Message
When I GET $HOST:$PORT/github.com/julienschmidt/httprouter/@v/list my client receives 404 and kubectl logs <POD_NAME> shows:

time="2019-10-09T12:34:56Z" level=info msg="exit status 1: go list -m: github.com/julienschmidt/httprouter@latest: git ls-remote -q origin in /tmp/athens<DECIMAL>/pkg/mod/cache/vcs/<HEXADECIMAL>: exit status 128:\n\tfatal: unable to access 'https://github.com/julienschmidt/httprouter/': Could not resolve host: github.com\n" http-method=GET http-path=/github.com/julienschmidt/httprouter/@v/list http-url=/github.com/julienschmidt/httprouter/@v/list kind="Not Found" module= operation=download.ListHandler ops="[download.ListHandler pool.List protocol.List vcsLister.List]" version=

When I GET $HOST:$PORT/github.com/julienschmidt/httprouter/@latest my client receives 404 and kubectl logs <POD_NAME> shows:

time="2019-10-09T12:34:56Z" level=info msg="exit status 1: go list -m: github.com/julienschmidt/httprouter@latest: git ls-remote -q origin in /tmp/athens<DECIMAL>/pkg/mod/cache/vcs/<HEXADECIMAL>: exit status 128:\n\tfatal: unable to access 'https://github.com/julienschmidt/httprouter/': Could not resolve host: github.com\n" http-method=GET http-path=/github.com/julienschmidt/httprouter/@latest http-url=/github.com/julienschmidt/httprouter/@latest kind="Not Found" module= operation=download.LatestHandler ops="[download.LatestHandler pool.Latest protocol.Latest vcsLister.List]" version=

To Reproduce
Using a computer that has never connected to the internet, follow the instructions at #1414 as they were on 2019-10-08 using the v0.2.0 tag of github.com/plexsystems/pacmod to pack up the v1.3.0 tag of github.com/julienschmidt/httprouter for athens. That creates 3 files: go.mod, v1.3.0.info, v1.3.0.zip.
Rename v1.3.0.zip to source.zip.
Using kubernetes run the image gomods/athens:v0.6.1 with persistent storage mounted at /opt/athens/storage and overwrite the image's included config by mounting yours at /config/config.toml.
Your config.toml contains:

StorageType = "disk"
[Storage]
    [Storage.Disk]
        RootPath = "/opt/athens/storage"

using kubectl cp copy the 3 files, one of was renamed, to be under /opt/athens/storage/github.com/julienschmidt/httprouter/v1.3.0/ and see they default to 0640 file permissions.
It doesn't seem to make a different but restart the pod for good measure in case the files need to exist in persistent storage before the pod launches.

Expected behavior
I expect output similar to what is documented at https://docs.gomods.io/intro/protocol/

Environment (please complete the following information):

  • OS: Kubernetes v1.14.5 runs the image, client is CentOS 6.10
  • Go version : 1.13
  • Proxy version : gomods/athens:v0.6.1
  • Storage (fs/mongodb/s3 etc.) : kubernetes persistentVolumeClaim

Additional context
These work perfectly fine:
GET $HOST:$PORT/github.com/julienschmidt/httprouter/@v/v1.3.0.info returns valid JSON with sane values
GET $HOST:$PORT/github.com/julienschmidt/httprouter/@v/v1.3.0.mod returns text that matches the contents of the module's go.mod file even though the Content-Type is application/json
GET $HOST:$PORT/github.com/julienschmidt/httprouter/@v/v1.3.0.zip serves the zip archieve for download and when downloaded and extracted the files & directory hierarchy matches the module.

This entire issue was hand-typed so feel free to ask if anything in the error messages is a typo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions