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

always verifying module #1904

Closed
tonycody opened this issue Dec 13, 2023 · 2 comments
Closed

always verifying module #1904

tonycody opened this issue Dec 13, 2023 · 2 comments
Labels
awaiting reply Used in issues when a maintainer is waiting for a reply. question Further information is requested

Comments

@tonycody
Copy link

tonycody commented Dec 13, 2023

docker-compose.yml

version: '3.8'
services:
  proxy:
    image: gomods/athens:v0.12.1
    restart: always
    volumes:
      - ./download.model:/root/download.model
      - ./gitconfig:/root/.gitconfig
      - ./ssh-keys:/root/.ssh
      - /opt/athens-storage:/var/lib/athens
    ports:
      - "3000:3000"
    environment:
      - LANG=C.UTF-8
      - TZ=Asia/Shanghai
      - GO_ENV=production
      - ATHENS_STORAGE_TYPE=disk
      - ATHENS_DISK_STORAGE_ROOT=/var/lib/athens
      - ATHENS_GOGET_WORKERS=100
      - ATHENS_DOWNLOAD_MODE=file:/root/download.model
      - ATHENS_GONOSUM_PATTERNS=git.wanfeng-inc.com/*

download.model

downloadURL = "https://goproxy.cn"

mode = "async_redirect"

download "git.wanfeng-inc.com/*" {
    mode = "sync"
}

nginx

server {
    listen 80;
    listen 443 ssl http2;
    server_name goproxy.wanfeng-inc.com;

    location / {
        proxy_pass https://goproxy.cn;
        proxy_cache_valid 30d;
    }

    location ~ ^/(git\.wanfeng-inc\.com)/ {
        proxy_pass http://172.28.133.179:3000;
    }
}

I expect proxies that are not git.wanfeng-inc.com requests: goproxy.

When it's a git.wanfeng-inc.com request, proxy athens

When I don't set GONOSUM before go get

$ GOPROXY=https://goproxy.wanfeng-inc.com go get git.wanfeng-inc.com/xs-samples/go-module-test
go: downloading git.wanfeng-inc.com/xs-samples/go-module-test v1.0.1
go: git.wanfeng-inc.com/xs-samples/go-module-test@v1.0.1: verifying module: git.wanfeng-inc.com/xs-samples/go-module-test@v1.0.1: reading https://goproxy.wanfeng-inc.com/sumdb/sum.golang.org/lookup/git.wanfeng-inc.com/xs-samples/go-module-test@v1.0.1: 404 Not Found
        server response: not found: git.wanfeng-inc.com/xs-samples/go-module-test@v1.0.1: unrecognized import path "git.wanfeng-inc.com/xs-samples/go-module-test": https fetch: Get "https://git.wanfeng-inc.com/xs-samples/go-module-test?go-get=1": dial tcp 172.28.133.47:443: connect: connection refused

When I set GONOSUM before go get

$ GOPROXY=https://goproxy.wanfeng-inc.com GONOSUMDB=git.wanfeng-inc.com/* go get git.wanfeng-inc.com/xs-samples/go-module-test
go: downloading git.wanfeng-inc.com/xs-samples/go-module-test v1.0.1
go: git.wanfeng-inc.com/xs-samples/go-module-test@v1.0.1: parsing go.mod:
        module declares its path as: git.wanfeng-inc.com/xs-samples/go-moudle-test
                but was required as: git.wanfeng-inc.com/xs-samples/go-module-test

The key issue is that I have already specified the environment variables: ATHENS_GONOSUM_PATTERNS=git.wanfeng-inc.com/*

If you have to specify the GONOSUM environment variable before you go get, you might as well just use the GOPRIVATE environment variable instead of athens. gitlab has the goproxy feature enabled.

The purpose of this is to expect that private modules will be proxied by athens, while non-private public modules will be proxied by goproxy.cn, and when you go get, you only need to set the proxy link that GOPROXY provides for me, which will unify the problem of public module proxying and private module proxying.

@matt0x6F
Copy link
Contributor

You shouldn't be getting a connection refused when you have NOSUMPATTERNS specified while using a SumDB. You should get an error, but not connection refused.

@matt0x6F matt0x6F modified the milestone: 0.13.4 Apr 16, 2024
@matt0x6F matt0x6F added question Further information is requested awaiting reply Used in issues when a maintainer is waiting for a reply. labels Apr 29, 2024
@matt0x6F
Copy link
Contributor

Open this back up if you feel your issue wasn't resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting reply Used in issues when a maintainer is waiting for a reply. question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants