{ "info": { "author": "W. Trevor King", "author_email": "wking@tremily.us", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Environment :: No Input/Output (Daemon)", "Intended Audience :: System Administrators", "License :: OSI Approved :: GNU General Public License (GPL)", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Internet :: Proxy Servers", "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", "Topic :: System :: Software Distribution" ], "description": "Package-cache is a simple caching proxy for package downloads. Just\nconfigure a list of upstream sources (with the ``--source`` option)\nand point clients at the package-cache server. The first time a\npackage is requested, we download that package from one of the sources\nand cache it locally, while also streaming it to the client. Future\nrequests for that package are streamed directly from the local cache.\nThis helps reduce the load on the network and source servers, if you\nhave a number of local clients that will repeatedly request the same\nfiles (e.g. `Gentoo's distfiles`_).\n\nWe don't do anything fancy with `Cache-Control headers`_, since\npackage source files should include the version stamp in the filename\nitself (e.g. ``my-package-0.1.2.tar.gz``). Files are cached after the\nfirst request, and stored forever. This means that every package\nyou've ever requested will still be there if you need it later.\nThat's nice, but it will end up consuming a fair amount of disk space.\nYou might want to periodically cull the cache, using access times to\nsee which files you are unlikely to want in the future.\n\nPackage-cache is written in Python, and has no dependencies outside\nthe standard library.\n\nRunning package-cache\n=====================\n\nBy default, we'll use `Python's reference WSGI implementation`_ to run\nour application::\n\n $ package-cache --source http://distfiles.gentoo.org/\n\nFor other command-line options, see::\n\n $ package-cache --help\n\nIf you need a more perfomant backend, you might try Gunicorn_.\n\nGentoo\n======\n\nThere's an OpenRC_ init script in ``contrib/openrc/init.d``, and a\npackage-cache ebuild in my `wtk overlay`_. To use package-cache as a\ncaching proxy for your distfiles downloads, add the ``wtk`` overlay to\nlayman_ and run::\n\n # emerge --ask --verbose net-proxy/package-cache\n # rc-update add default net-proxy/package-cache\n # rc-service package-cache start\n\nYou can tweak the parameters by setting variables in\n``/etc/conf.d/package-cache`` (``PC_USER``, ``PC_GROUP``,\n``CACHE_DIR``, ``HOST``, ``PORT``, ``SOURCES``, and ``PC_OPTS``). See\nthe init script for default values.\n\nOnce you've setup your package-cache service, just point your local\npackage manager to the cache server instead of the usual mirror. For\nPortage_, that's going to be something like:\n\n GENTOO_MIRRORS=\"http://my-package-cache-server.net:4000/\"\n\nin your ``/etc/portage/make.conf``.\n\nIf you *don't* want to tweak your clients (perhaps there are many of\nthem, or they are out of your direct control), you can add some\nfirewall rules to your router to transparently proxy specific Gentoo\nmirrors. With an internal ``eth1`` and an internal proxy on\n192.168.0.11, that looks something like::\n\n # CACHE_IP=192.168.0.11\n # for SOURCE_IP in $(dig +short distfiles.gentoo.org);\n > do\n > iptables --table nat --append PREROUTING --protocol tcp \\\n > --in-interface eth1 ! --source \"${CACHE_IP}\" \\\n > --destination \"${SOURCE_IP}\" \\\n > --match tcp --destination-port 80 \\\n > --jump DNAT --to-destination \"${CACHE_IP}:4000\" ;\n > done\n\nTo remove those entries later, repeat the command with ``--delete``\ninstead of ``--append``. You may need to list the ``SOURCE_IP`` values\nexplicitly if the DNS entries have changed. Run::\n\n # iptables --table nat --list PREROUTING --numeric\n\nto list the entries. See ``iptables(8)`` and\n``iptables-extensions(8)`` for more details.\n\n.. _Gentoo's distfiles:\n https://wiki.gentoo.org/wiki/Project:Infrastructure/Source_mirrors\n.. _Cache-Control headers:\n https://tools.ietf.org/html/rfc2616#section-14.9\n.. _Python's reference WSGI implementation:\n http://docs.python.org/3/library/wsgiref.html\n.. _Gunicorn:\n http://gunicorn-docs.readthedocs.org/en/latest/run.html#gunicorn\n.. _OpenRC: http://www.gentoo.org/proj/en/base/openrc/\n.. _wtk overlay: http://blog.tremily.us/posts/Gentoo_overlay/\n.. _layman: https://wiki.gentoo.org/wiki/Layman\n.. _Portage: http://wiki.gentoo.org/wiki/Project:Portage", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/wking/package-cache/archive/v0.2.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://blog.tremily.us/posts/package-cache/", "keywords": null, "license": "GNU General Public License (GPL)", "maintainer": null, "maintainer_email": null, "name": "package-cache", "package_url": "https://pypi.org/project/package-cache/", "platform": "all", "project_url": "https://pypi.org/project/package-cache/", "project_urls": { "Download": "https://github.com/wking/package-cache/archive/v0.2.tar.gz", "Homepage": "http://blog.tremily.us/posts/package-cache/" }, "release_url": "https://pypi.org/project/package-cache/0.2/", "requires_dist": null, "requires_python": null, "summary": "A caching proxy for package downloads", "version": "0.2" }, "last_serial": 1008234, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "7d0123f74933bd5482c22c71372503d7", "sha256": "85242215cc0867508f4bf68ee3eb6d8b243b2041b388f096138e4434fe11fd1e" }, "downloads": -1, "filename": "package-cache-0.1.tar.gz", "has_sig": false, "md5_digest": "7d0123f74933bd5482c22c71372503d7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18011, "upload_time": "2014-02-21T06:25:02", "url": "https://files.pythonhosted.org/packages/d5/27/a801937b780f555bef45937dc8a0be421569e88dceff09d3e7b7d03c84c0/package-cache-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "0612cf0c58bd4c035cb5b5da0c306a69", "sha256": "89c9fb4b47a6a667f831ca3a53611ab3ddcffb57d0b49141d0959659f14742dc" }, "downloads": -1, "filename": "package-cache-0.2.tar.gz", "has_sig": false, "md5_digest": "0612cf0c58bd4c035cb5b5da0c306a69", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18544, "upload_time": "2014-02-22T03:15:18", "url": "https://files.pythonhosted.org/packages/12/fe/f6bb51a60d5b262c4977feddd96e0d3e7e175dad92f566b0aadecbcb347d/package-cache-0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0612cf0c58bd4c035cb5b5da0c306a69", "sha256": "89c9fb4b47a6a667f831ca3a53611ab3ddcffb57d0b49141d0959659f14742dc" }, "downloads": -1, "filename": "package-cache-0.2.tar.gz", "has_sig": false, "md5_digest": "0612cf0c58bd4c035cb5b5da0c306a69", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18544, "upload_time": "2014-02-22T03:15:18", "url": "https://files.pythonhosted.org/packages/12/fe/f6bb51a60d5b262c4977feddd96e0d3e7e175dad92f566b0aadecbcb347d/package-cache-0.2.tar.gz" } ] }