GitXplorerGitXplorer
h

nginx_pypi_cache

public
29 stars
8 forks
2 issues

Commits

List of commits on branch master.
Verified
15f27b3b29c8cdb121e39d63958a2d660b2175d6

Mention ghcr in README (#11)

hhauntsaninja committed a month ago
Verified
d925f4520ea5baa71e90045866eeedf03ecf70ca

Set use_temp_path=off (#10)

hhauntsaninja committed a month ago
Verified
cd65d5db86552625df6a711de7c316fb5c820013

Change status codes cached, cache for longer, expose nginx_status (#7)

hhauntsaninja committed 3 months ago
Verified
17102810874fb95098caf4c980c4699fe59d7505

Run tests in CI (#5)

hhauntsaninja committed 5 months ago
Unverified
fe0a4aec2e010f499441485e9b41d79a968978eb

Move GCR workflow to correct location

hhauntsaninja committed 5 months ago
Verified
7a5f9c3adc89d954a132907720065d90ebb22d94

Publish to GitHub Container Registry (#1)

00x2b3bfa0 committed 5 months ago

README

The README file for this repository.

pypi_nginx_cache

A PyPI cache using nginx.

Usage

This serves as a caching mirror for PyPI. It's a simple stateless service and does not support uploading packages / private indices. For this use case, I've found it to be significantly faster and significantly more reliable than devpi.

To run it locally:

docker run -p 80:80 --rm $(docker build -q .)

To tell pip to connect to this instead of pypi.org, use:

pip install --index-url=http://localhost/simple mypy

or

export PIP_INDEX_URL=http://localhost/simple
pip install mypy

Github container registry

To pull the latest version from the Github container registry:

docker pull ghcr.io/hauntsaninja/nginx_pypi_cache:latest

See https://github.com/hauntsaninja/nginx_pypi_cache/pkgs/container/nginx_pypi_cache

Troubleshooting

It turns out it's surprisingly easy to mess something up and not actually end up proxying requests. tests/mitmtest.sh should help confirm that we're hitting the cache when we expect to, instead of hitting upstream PyPI.

The log messages are also pretty useful (check nginx.conf to see exactly what these correspond to):

172.17.0.1 - localhost [13/Jan/2023:02:36:00 +0000] request_time=0.000 upstream_time=- cache_status=HIT 	200 "GET /simple/mypy/ HTTP/1.1" 78368