Socket
Socket
Sign inDemoInstall

angry-caching-proxy

Package Overview
Dependencies
10
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    angry-caching-proxy

Angry Caching Proxy which speeds up package downloads for apt-get, npm and rubygems


Version published
Weekly downloads
8
Maintainers
1
Install size
6.41 MB
Created
Weekly downloads
 

Readme

Source

Build Status

Angry Caching Proxy

screenshot

Make package downloads lightning fast for apt-get, npm, pip and Rubygems!

Angry Caching Proxy is forwarding proxy for various package managers. It is configured transparently to the clients using the http_proxy environment variable. So there is no need to have customized sources.list, Gemfile etc.

It works by doing very angry caching (forever!) for the actual package files. This should be ok as long as the package authors won't override already uploaded packages. It is a very bad practice by the package authors and happens very rarely. If it happens anyway you can always clear the cache from the web interface of Angry Caching Proxy.

Use cases

Installing or upgrading multiple Ubuntu machines. In the worst case you have to download gigabytes of .deb packages for each machine. With Angry Caching Proxy the packages are downloaded once and then served instantly from the cache.

When doing distributed builds it might be hard to share local disk caches.

Just speeding up your local bundle install runs.

Install

Get node.js and type

sudo npm install -g angry-caching-proxy

or if you don't like sudoing random code you can install it locally too:

npm install angry-caching-proxy

and execute it with

node_modules/.bin/angry-caching-proxy

Configuration

Create /etc/angry-caching-proxy/config.json with any of the following keys:

  • directory: Where to store cached requests.
  • port: Port to listen.
    • default: 8080
  • workes: Workers to use. Default to machine cpu core count.
  • customTriggers: Path to custom triggers module.
    • default: /etc/angry-caching-proxy/triggers.js
  • triggers: Array of triggers to activate.
    • default ["apt-get", "npm", "pypi", "rubygems"]

Custom triggers

If you want to add additional caching you can create /etc/angry-caching-proxy/triggers.js file with your own caching functions. It should export an object of functions that return true when the request should be cached. The caching occurs only if the upstream responds with http success status 200. Only GET requests can be cached.

Example:

module.exports = {
    "custom": function isMyCustomCacheRequest(req, res) {
        // Cache all requests that contain X-My-Cache header
        return req.headers["X-My-Cache"]);
    },
};

See buildin-triggers.js for examples.

New build-in triggers are also welcome as a pull request.

Usage

Create directory where to save cached requests

mkdir cache

and start the server

angry-caching-proxy --directory cache

You can inspect and clear the cache by browsing directly to the proxy address http://localhost:8080

apt-get

http_proxy=http://localhost:8080 sudo -E apt-get install sl

Bundler (Rubygems)

http_proxy=http://localhost:8080 bundle install

npm

With npm it is required to use the non-https version of the registry

http_proxy=http://localhost:8080 npm install --registry http://registry.npmjs.org/

Python pip

http_proxy=http://localhost:8080 pip install plone

Cool guys can also set the proxy globally for everybody:

export http_proxy=http://localhost:8080

FAQs

Last updated on 08 Nov 2013

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc