Merge branch 'master' into patch-1

This commit is contained in:
James Kinsman 2019-06-23 14:34:02 +01:00 committed by GitHub
commit a7a60f84ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 50 additions and 41 deletions

View file

@ -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

View file

@ -1,5 +1,5 @@
FROM steamcache/generic:latest
MAINTAINER SteamCache.Net Team <team@steamcache.net>
FROM lancachenet/generic:latest
MAINTAINER LanCache.Net Team <team@lancache.net>
ENV GENERICCACHE_VERSION 2
ENV WEBUSER www-data

View file

@ -16,17 +16,17 @@ 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 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/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 [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 <path on host>:/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 \
@ -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:
```
export 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
echo Please configure your dhcp server to serve dns as $HOST_IP
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 router/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 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 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
@ -106,30 +106,31 @@ 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
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)
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
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
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 <IPadddress>: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.
* 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 <IPadddress>: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 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
@ -158,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).

6
faq.md
View file

@ -56,11 +56,11 @@ 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?
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*
@ -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.

View file

@ -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

View file

@ -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