From 2204c00379c043057dc96123f540e5ab5d94437c Mon Sep 17 00:00:00 2001 From: Attila Date: Wed, 13 Mar 2019 17:55:32 +0100 Subject: [PATCH 1/7] Update README with the correct default environment variables Plus add CACHE_MAX_AGE variable to example --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b107622..d1e0f1b 100644 --- a/README.md +++ b/README.md @@ -109,13 +109,13 @@ CACHE_DISK_SIZE 1000000m In addition, there is an environment variable to control the max cache age ``` -CACHE_MAX_AGE 3650d +CACHE_MAX_AGE 3560d ```` You can override these at run time by adding the following to your docker run command. They accept the standard nginx notation for sizes (k/m/g/t) and durations (m/h/d) ``` --e CACHE_MEM_SIZE=4000m -e CACHE_DISK_SIZE=1000g +-e CACHE_MEM_SIZE=4000m -e CACHE_DISK_SIZE=1000g -e CACHE_MAX_AGE 3560d ``` ## Tuning your cache From 9f29675ef1f1e5513c3386a8cabbd51c58d89f90 Mon Sep 17 00:00:00 2001 From: VibroAxe Date: Thu, 30 May 2019 21:30:25 +0100 Subject: [PATCH 2/7] LanCache.Net changes --- .circleci/config.yml | 10 +++++----- Dockerfile | 4 ++-- run-tests.sh | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d3bb5ac..a372b62 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -44,11 +44,11 @@ jobs: name: Save docker image command: | mkdir -p workspace - docker save -o workspace/steamcache-monolithic.tar steamcache/monolithic:goss-test + docker save -o workspace/lancachenet-monolithic.tar lancachenet/monolithic:goss-test - persist_to_workspace: root: workspace paths: - steamcache-monolithic.tar + lancachenet-monolithic.tar - store_test_results: path: reports - store_artifacts: @@ -66,6 +66,6 @@ jobs: name: "Deploy latest to docker hub" command: | docker login -u $DOCKER_USER -p $DOCKER_PASS - docker load -i /tmp/workspace/steamcache-monolithic.tar - docker tag steamcache/monolithic:goss-test steamcache/monolithic:latest - docker push steamcache/monolithic:latest + docker load -i /tmp/workspace/lancachenet-monolithic.tar + docker tag lancachenet/monolithic:goss-test lancachenet/monolithic:latest + docker push lancachenet/monolithic:latest diff --git a/Dockerfile b/Dockerfile index 225fef8..c73de1d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ -FROM steamcache/generic:latest -MAINTAINER SteamCache.Net Team +FROM lancachenet/generic:latest +MAINTAINER LanCache.Net Team ENV GENERICCACHE_VERSION 2 ENV WEBUSER www-data diff --git a/run-tests.sh b/run-tests.sh index 0dfdb29..a81ea41 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -8,7 +8,7 @@ if [ $? -ne 0 ]; then exit $? fi -docker build --tag steamcache/monolithic:goss-test . +docker build --tag lancachenet/monolithic:goss-test . case $1 in circleci) shift; @@ -18,7 +18,7 @@ case $1 in shift fi export GOSS_OPTS="$GOSS_OPTS --format junit" - dgoss run $@ steamcache/monolithic:goss-test > reports/goss/report.xml + dgoss run $@ lancachenet/monolithic:goss-test > reports/goss/report.xml #store result for exit code RESULT=$? #delete the junk that goss currently outputs :( @@ -31,10 +31,10 @@ case $1 in KEEPIMAGE=true shift fi - dgoss run $@ steamcache/monolithic:goss-test + dgoss run $@ lancachenet/monolithic:goss-test RESULT=$? ;; esac -[[ "$KEEPIMAGE" == "true" ]] || docker rmi steamcache/monolithic:goss-test +[[ "$KEEPIMAGE" == "true" ]] || docker rmi lancachenet/monolithic:goss-test exit $RESULT From 09f1895eff698abfb935e911c7b7b96d0ec6a121 Mon Sep 17 00:00:00 2001 From: James Kinsman Date: Thu, 30 May 2019 21:46:21 +0100 Subject: [PATCH 3/7] Update README.md LanCache.Net changes --- README.md | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index b107622..75921bf 100644 --- a/README.md +++ b/README.md @@ -16,13 +16,13 @@ This container is designed to support any game that uses HTTP and also supports - Uplay (Ubisoft) - Windows Updates -This is the best container to use for all game caching and should be used for Steam in preference to the steamcache/steamcache and steamcache/generic containers. +This is the best container to use for all game caching and should be used for Steam in preference to the steamcache/steamcache and lancachenet/generic containers. ## Usage You need to be able to redirect HTTP traffic to this container. The easiest way to do this is to replace the DNS entries for the various game services with your cache server. -You can use the [steamcache-dns](https://hub.docker.com/r/steamcache/steamcache-dns/) docker image to do this or you can use a DNS service already on your network see the [steamcache-dns github page](https://github.com/steamcache/steamcache-dns) for more information. +You can use the [steamcache-dns](https://hub.docker.com/r/lancachenet/steamcache-dns/) docker image to do this or you can use a DNS service already on your network see the [steamcache-dns github page](https://github.com/lancachenet/steamcache-dns) for more information. For the cache files to persist you will need to mount a directory on the host machine into the container. You can do this using `-v :/data/cache`. You can do the same with a logs directory as well if you want logs to be persistent as well. @@ -35,31 +35,31 @@ docker run \ -v /cache/data:/data/cache \ -v /cache/logs:/data/logs \ -p 192.168.1.10:80:80 \ - steamcache/monolithic:latest + lancachenet/monolithic:latest ``` -Unlike steamcache/generic this service will cache all cdn services (defined in the [uklans cache-domains repo](https://github.com/uklans/cache-domains) so multiple instances are not required +Unlike lancachenet/generic this service will cache all cdn services (defined in the [uklans cache-domains repo](https://github.com/uklans/cache-domains) so multiple instances are not required ## Simple Full Stack startup To initialise a full caching setup with dns and sni proxy you can use the following script as a starting point: ``` HOST_IP=`hostname -I | cut -d' ' -f1` -docker run --restart unless-stopped --name steamcache-dns --detach -p 53:53/udp -e USE_GENERIC_CACHE=true -e LANCACHE_IP=$HOST_IP steamcache/steamcache-dns:latest -docker run --restart unless-stopped --name lancache --detach -v /cache/data:/data/cache -v /cache/logs:/data/logs -p 80:80 steamcache/monolithic:latest -docker run --restart unless-stopped --name sniproxy --detach -p 443:443 steamcache/sniproxy:latest +docker run --restart unless-stopped --name steamcache-dns --detach -p 53:53/udp -e USE_GENERIC_CACHE=true -e LANCACHE_IP=$HOST_IP lancachenet/steamcache-dns:latest +docker run --restart unless-stopped --name lancache --detach -v /cache/data:/data/cache -v /cache/logs:/data/logs -p 80:80 lancachenet/monolithic:latest +docker run --restart unless-stopped --name sniproxy --detach -p 443:443 lancachenet/sniproxy:latest echo Please configure your dhcp server to serve dns as $HOST_IP ``` Please check that `hostname -I` returns the correct IP before running this snippet -## Changing from steamcache/steamcache and steamcache/generic +## Changing from steamcache/steamcache and lancachenet/generic This new container is designed to replace an array of steamcache or generic containers with a single monolithic instance. However if you currently run a steamcache or generic setup then there a few things to note -1) Your existing cache files are NOT compatible with steamcache/monolithic, unfortunately your cache will need repriming +1) Your existing cache files are NOT compatible with lancachenet/monolithic, unfortunately your cache will need repriming 2) You do not need multiple containers, a single monolithic container will cache ALL cdns without collision -3) steamcache/monolithic should be compatible with your existing container's env vars so you can use the same run command you currently use, just change to steamcache/monolithic +3) lancachenet/monolithic should be compatible with your existing container's env vars so you can use the same run command you currently use, just change to lancachenet/monolithic ## Origin and SSL @@ -71,10 +71,10 @@ docker run \ --restart unless-stopped \ --name sniproxy \ -p 443:443 \ - steamcache/sniproxy:latest + lancachenet/sniproxy:latest ``` -Please read the [steamcache/sniproxy](https://github.com/steamcache/sniproxy) project for more information. +Please read the [lancachenet/sniproxy](https://github.com/lancachenet/sniproxy) project for more information. ## DNS Entries @@ -124,8 +124,9 @@ Steam in particular has some inherrent limitations caused by the adherence to th Consult your OS documentation in order to add additional IP addresses onto your docker cache host machine ### Step 2: Adding IP's to your cache container In order for this to work you need to add the port maps onto the relevant cdn container (for example steam). -* If you are using `steamcache/monolithic` then using `-p 80:80` should be sufficient as per the documentation. -* If you are using `steamcache/generic` or `steamcache/steamcache` then add multiple `-p :80:80` for each IP you have added. For example `-p 10.10.1.30:80:80 -p 10.10.1.31:80:80` +* If you are using `lancachenet/monolithic` then using `-p 80:80` should be sufficient as per the documentation. +* If you are using `lancachenet/generic` or `lancachenet/steamcache` then add multiple `-p :80:80` for each IP you have added. For example `-p 10.10.1.30:80:80 -p 10.10.1.31:80:80` + ### Step 3: Informing steamcache-dns of the extra IP's Finally we need to inform steamcache-dns that STEAM is now available on multiple IP addresses. This can be done on the command line using the following command `-e STEAMCACHE_IP="10.10.1.30 10.10.1.31"`. Note the quotes surrounding the multiple IP addresses. ### Step 4: Testing From d2af1448661a17d24e80cb286ebdeb8809d7dd7b Mon Sep 17 00:00:00 2001 From: Goten Xiao Date: Fri, 31 May 2019 00:58:59 +0100 Subject: [PATCH 4/7] Rebranding updates --- README.md | 12 ++++++------ faq.md | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 75921bf..0307742 100644 --- a/README.md +++ b/README.md @@ -16,13 +16,13 @@ This container is designed to support any game that uses HTTP and also supports - Uplay (Ubisoft) - Windows Updates -This is the best container to use for all game caching and should be used for Steam in preference to the steamcache/steamcache and lancachenet/generic containers. +This is the best container to use for all game caching and should be used for Steam in preference to the lancachenet/steamcache and lancachenet/generic containers. ## Usage You need to be able to redirect HTTP traffic to this container. The easiest way to do this is to replace the DNS entries for the various game services with your cache server. -You can use the [steamcache-dns](https://hub.docker.com/r/lancachenet/steamcache-dns/) docker image to do this or you can use a DNS service already on your network see the [steamcache-dns github page](https://github.com/lancachenet/steamcache-dns) for more information. +You can use the [lancache-dns](https://hub.docker.com/r/lancachenet/lancache-dns/) docker image to do this or you can use a DNS service already on your network see the [lancache-dns github page](https://github.com/lancachenet/lancache-dns) for more information. For the cache files to persist you will need to mount a directory on the host machine into the container. You can do this using `-v :/data/cache`. You can do the same with a logs directory as well if you want logs to be persistent as well. @@ -45,7 +45,7 @@ Unlike lancachenet/generic this service will cache all cdn services (defined in To initialise a full caching setup with dns and sni proxy you can use the following script as a starting point: ``` HOST_IP=`hostname -I | cut -d' ' -f1` -docker run --restart unless-stopped --name steamcache-dns --detach -p 53:53/udp -e USE_GENERIC_CACHE=true -e LANCACHE_IP=$HOST_IP lancachenet/steamcache-dns:latest +docker run --restart unless-stopped --name lancache-dns --detach -p 53:53/udp -e USE_GENERIC_CACHE=true -e LANCACHE_IP=$HOST_IP lancachenet/lancache-dns:latest docker run --restart unless-stopped --name lancache --detach -v /cache/data:/data/cache -v /cache/logs:/data/logs -p 80:80 lancachenet/monolithic:latest docker run --restart unless-stopped --name sniproxy --detach -p 443:443 lancachenet/sniproxy:latest echo Please configure your dhcp server to serve dns as $HOST_IP @@ -53,7 +53,7 @@ echo Please configure your dhcp server to serve dns as $HOST_IP Please check that `hostname -I` returns the correct IP before running this snippet -## Changing from steamcache/steamcache and lancachenet/generic +## Changing from lancachenet/steamcache and lancachenet/generic This new container is designed to replace an array of steamcache or generic containers with a single monolithic instance. However if you currently run a steamcache or generic setup then there a few things to note @@ -127,8 +127,8 @@ In order for this to work you need to add the port maps onto the relevant cdn co * If you are using `lancachenet/monolithic` then using `-p 80:80` should be sufficient as per the documentation. * If you are using `lancachenet/generic` or `lancachenet/steamcache` then add multiple `-p :80:80` for each IP you have added. For example `-p 10.10.1.30:80:80 -p 10.10.1.31:80:80` -### Step 3: Informing steamcache-dns of the extra IP's -Finally we need to inform steamcache-dns that STEAM is now available on multiple IP addresses. This can be done on the command line using the following command `-e STEAMCACHE_IP="10.10.1.30 10.10.1.31"`. Note the quotes surrounding the multiple IP addresses. +### Step 3: Informing lancache-dns of the extra IP's +Finally we need to inform lancache-dns that STEAM is now available on multiple IP addresses. This can be done on the command line using the following command `-e STEAMCACHE_IP="10.10.1.30 10.10.1.31"`. Note the quotes surrounding the multiple IP addresses. ### Step 4: Testing Choose a game which has not been seen by the cache before (or clear your `/data/cache` folder) and start it downloading. Check to see what the maximum speed seen by your steam client is. If necessary repeat steps 1-3 with additional IPs until you see a download equivalent to your uncached steam client or no longer see an improvement vs the previous IP allocation. diff --git a/faq.md b/faq.md index 3eba0eb..f17e1a4 100644 --- a/faq.md +++ b/faq.md @@ -56,7 +56,7 @@ This solution is designed to support anything from a couple of people at home, t No. HTTPS traffic is encrypted. Some of the games, Origin for instance, also serve HTTPS content on the same hostnames we're intercepting - for this you can use SNI Proxy. It listens on port 443 and just passes through any HTTPS traffic. It is unable to inspect the traffic, or cache it. -You can find more at the [steamcache/sniproxy](https://github.com/steamcache/sniproxy) project page. +You can find more at the [lancachenet/sniproxy](https://github.com/lancachenet/sniproxy) project page. ## Can I cache Fortnite/Epic Games Launcher? @@ -68,7 +68,7 @@ Yes, almost any HTTP content can be cached. We're maintaining a list of hostname ## How do you intercept the HTTP traffic? -We prefer to use DNS-based interception This is because it is easier to deploy than other methods. We have a [steamcache-dns](https://github.com/steamcache/steamcache-dns) project that is a self-contained DNS server with options for setting your cache IP addresses. +We prefer to use DNS-based interception This is because it is easier to deploy than other methods. We have a [lancache-dns](https://github.com/lancachenet/lancache-dns) project that is a self-contained DNS server with options for setting your cache IP addresses. If you already run a DNS server and are comfortable configuring new override DNS zones, you can also just do this from the list on [uklans/cache-domains](https://github.com/uklans/cache-domains). pfSense's DNS forwarder can easily be configured, and the project has scripts to generate config for unbound. From 876d4f0537d7d113b6086be84ff2a904edbda578 Mon Sep 17 00:00:00 2001 From: Goten Xiao Date: Fri, 31 May 2019 00:59:12 +0100 Subject: [PATCH 5/7] Update FAQ for Epic Games --- faq.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/faq.md b/faq.md index f17e1a4..685f86d 100644 --- a/faq.md +++ b/faq.md @@ -60,7 +60,7 @@ You can find more at the [lancachenet/sniproxy](https://github.com/lancachenet/s ## Can I cache Fortnite/Epic Games Launcher? -Sadly no, it uses HTTPS and can't be cached. +Yes, as of [2019-05-30](https://github.com/uklans/cache-domains/pull/89) - Epic Games have kindly moved their CDN servers and launcher to use HTTP for content delivery. ## Can I cache *some other service* From 459f8af361138e3a5db93f22d00993d5da58eb74 Mon Sep 17 00:00:00 2001 From: VibroAxe Date: Sat, 22 Jun 2019 16:41:45 +0100 Subject: [PATCH 6/7] Added NOFETCH option to prevent git reset When developing/updating the uklans repo it is helpful to bind mount a local copy for testing. -e NOFETCH=true Resolves #41 --- README.md | 5 +++++ overlay/hooks/entrypoint-pre.d/15_generate_maps.sh | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0307742..dad118e 100644 --- a/README.md +++ b/README.md @@ -159,6 +159,11 @@ If you're a games publisher and you'd like LAN parties, gaming centers and other If you have any questions, please check [our FAQs](faq.md). If this doesn't answer your question, please raise an issue in GitHub. +## How to help out +To build just run `docker build --tag lancachenet/monolithic:testing .`. To test you can run `./run_tests.sh` + +If you want to test a new build with a forked uklans repo/branch you can specify `-e CACHE_DOMAIN_REPO=""` and even `-e NOFETCH=true` if using a locally bind mounted git repo. + ## Thanks - Based on original configs from [ansible-lanparty](https://github.com/ti-mo/ansible-lanparty). diff --git a/overlay/hooks/entrypoint-pre.d/15_generate_maps.sh b/overlay/hooks/entrypoint-pre.d/15_generate_maps.sh index c14d4ed..fea7578 100644 --- a/overlay/hooks/entrypoint-pre.d/15_generate_maps.sh +++ b/overlay/hooks/entrypoint-pre.d/15_generate_maps.sh @@ -7,8 +7,11 @@ export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostCACHE_I if [[ ! -d .git ]]; then git clone ${CACHE_DOMAIN_REPO} . fi -git fetch origin -git reset --hard origin/master + +if [[ "${NOFETCH:-false}" != "true" ]]; then + git fetch origin + git reset --hard origin/master +fi TEMP_PATH=$(mktemp -d) OUTPUTFILE=${TEMP_PATH}/outfile.conf echo "map \$http_host \$cacheidentifier {" >> $OUTPUTFILE From f2fc2e34548b567a9ce35ea70dce9c3f1fb6cfeb Mon Sep 17 00:00:00 2001 From: LovecraftianHorror Date: Sat, 22 Jun 2019 19:41:07 -0400 Subject: [PATCH 7/7] README corrections and consistency --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index dad118e..ceae27b 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ You can use the [lancache-dns](https://hub.docker.com/r/lancachenet/lancache-dns For the cache files to persist you will need to mount a directory on the host machine into the container. You can do this using `-v :/data/cache`. You can do the same with a logs directory as well if you want logs to be persistent as well. -Run the container using the following to allow TCP port 80 (HTTP) and to mount `/cache/steam/data` directory into the container. +Run the container using the following to allow TCP port 80 (HTTP) and to mount `/cache/data` directory into the container. ``` docker run \ @@ -38,7 +38,7 @@ docker run \ lancachenet/monolithic:latest ``` -Unlike lancachenet/generic this service will cache all cdn services (defined in the [uklans cache-domains repo](https://github.com/uklans/cache-domains) so multiple instances are not required +Unlike lancachenet/generic this service will cache all cdn services defined in the [uklans cache-domains repo](https://github.com/uklans/cache-domains) so multiple instances are not required. ## Simple Full Stack startup @@ -55,7 +55,7 @@ Please check that `hostname -I` returns the correct IP before running this snipp ## Changing from lancachenet/steamcache and lancachenet/generic -This new container is designed to replace an array of steamcache or generic containers with a single monolithic instance. However if you currently run a steamcache or generic setup then there a few things to note +This new container is designed to replace an array of steamcache or generic containers with a single monolithic instance. However if you currently run a steamcache or generic setup then there a few things to note. 1) Your existing cache files are NOT compatible with lancachenet/monolithic, unfortunately your cache will need repriming 2) You do not need multiple containers, a single monolithic container will cache ALL cdns without collision @@ -106,20 +106,20 @@ CACHE_MEM_SIZE 500m CACHE_DISK_SIZE 1000000m ``` -In addition, there is an environment variable to control the max cache age +In addition, there is an environment variable to control the max cache age. ``` CACHE_MAX_AGE 3650d ```` -You can override these at run time by adding the following to your docker run command. They accept the standard nginx notation for sizes (k/m/g/t) and durations (m/h/d) +You can override these at run time by adding the following to your docker run command. They accept the standard nginx notation for sizes (k/m/g/t) and durations (m/h/d). ``` -e CACHE_MEM_SIZE=4000m -e CACHE_DISK_SIZE=1000g ``` ## Tuning your cache -Steam in particular has some inherrent limitations caused by the adherence to the HTTP spec connection pool. As such steam download speed are highly dependent on the latency between your server and the steam cdn servers. In the event you find your initial download speed with the default settings is slow this can be resolved by allocating more IP's to your ache. We suggest adding one IP at a time to see how much gain can be had (4 seems to work for a number of people) +Steam in particular has some inherrent limitations caused by the adherence to the HTTP spec connection pool. As such steam's download speed is highly dependent on the latency between your server and the steam cdn servers. In the event you find your initial download speed with the default settings is slow this can be resolved by allocating more IP's to your cache. We suggest adding one IP at a time to see how much gain can be had (4 seems to work for a number of people). ### Step 1: Adding IP's to your docker host Consult your OS documentation in order to add additional IP addresses onto your docker cache host machine ### Step 2: Adding IP's to your cache container @@ -130,7 +130,7 @@ In order for this to work you need to add the port maps onto the relevant cdn co ### Step 3: Informing lancache-dns of the extra IP's Finally we need to inform lancache-dns that STEAM is now available on multiple IP addresses. This can be done on the command line using the following command `-e STEAMCACHE_IP="10.10.1.30 10.10.1.31"`. Note the quotes surrounding the multiple IP addresses. ### Step 4: Testing -Choose a game which has not been seen by the cache before (or clear your `/data/cache` folder) and start it downloading. Check to see what the maximum speed seen by your steam client is. If necessary repeat steps 1-3 with additional IPs until you see a download equivalent to your uncached steam client or no longer see an improvement vs the previous IP allocation. +Choose a game which has not been seen by the cache before (or clear your `/data/cache` folder) and start downloading it. Check to see what the maximum speed seen by your steam client is. If necessary repeat steps 1-3 with additional IPs until you see a download equivalent to your uncached steam client or no longer see an improvement vs the previous IP allocation. ## Monitoring