Sign inSign up

stixes/simple-squid-cache

By stixes

Updated about 7 years ago

Simple to set up, high performing datasaving proxy for home users, build using KISS principles.

Image
0

505

stixes/simple-squid-cache repository overview

simple-squid-cache

Simple to set up, high performing datasaving proxy for home users, build using KISS principles.

Description and motivation

So, in these days of multi Mbit internet connections and fast cpu's, why would you want a caching proxy? More and more, people are changing to mobile connections or similarly connections with fluctuating bandwidth. Often, such connections are also datalimited in some fashion, so it makes sense to cache data and lessen the Mbit requirement on your internet connection.

This is amplified by users of VPN connections, or even TOR routed connections.

Moreover, today many sites we visit are the same, and those sites use a great number of static content, which is still retrieved via "old fashioned" HTTP connections.

Tuning Squid to allow Massive cache sizes, both on disk and in memory can allow for the reuse of many of such resources, improving the performance of your network connection.

Usage

The image will run with no additional configuration:

docker run -d -p 3128:3128 stixes/simple-squid-cache

and will provide a default configuration with 1Gb in-memory cache and 8gb on-disk cache, making it fitt well on the higher end home NAS or your some server setup. The cache can be persist outside the container using volumes:

docker volume create squid-cache
docker run -d -v squid-cache:/var/cache/squid -p 3128:3128 stixes/simple-squid-cache

or using host mapping:

docker run -d -v /opt/dockerstorage/squid-cache:/var/cache/squid -p 3128:3128 stixes/simple-squid-cache

The cache size is controlled using environment variables:

  • SQUID_DISK_SIZE_MB - The size in MB for the on disk size. Default is 8192 (8gb). Bigger is good here.
  • SQUID_MEM_SIZE_MB - The amount of memory used to cache most recent request. Default is 1024 (1Gb). This should be adjusted to fit your server.
  • SQUID_PARENT_HOST - Hostname of a parent proxy, Corporate, vpn or even a local Tor gateway can be used. Leave blank to connect directly from this proxy.
  • SQUID_PARENT_PORT - Port of the parent proxy, defaults to 3128

Thats it. It's simple.

Sample docker-compose

A nice way to run this, is as a docker-compose service (and this service wil also run easily in a docker swarm stack). Here is a sample, which doubles the space allotted for disk and memory:

version: "2.4"
volumes:
  cache:
services:
  squid:
    image: stixes/simple-squid-cache
    ports:
      - 3128:3128
    restart: always
    environment:
      SQUID_DISK_SIZE_MB: 20480
      SQUID_MEM_SIZE_MB: 2048
    volumes:
      - cache:/var/cache/squid

Tag summary

Content type

Image

Digest

Size

8.9 MB

Last updated

about 7 years ago

docker pull stixes/simple-squid-cache