Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebuild for monolithic #5

Merged
merged 17 commits into from
Feb 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions .env
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
## See the "Settings" section in README.md for more details

## Set this to true if you're using a load balancer, or set it to false if you're using seperate IPs for each service.
## If you're using monolithic (the default), leave this set to true
USE_GENERIC_CACHE=true

## IP Address that the lancache load balancer will be running on
## IP addresses that the lancache monolithic instance is reachable on
## Specify one or more IPs, space separated - these will be used when resolving DNS hostnames through lancachenet-dns. Multiple IPs can improve cache priming performance for some services (e.g. Steam)## IP Address that the lancache monolithic instance will run on
## Note: This setting only affects DNS, monolithic and sniproxy will still bind to all IPs by default
LANCACHE_IP=10.0.39.1
VibroAxe marked this conversation as resolved.
Show resolved Hide resolved

DNS_IP=10.0.39.1
## IP address on the host that the DNS server should bind to
DNS_BIND_IP=10.0.39.1

## DNS Resolution for forwarded DNS lookups
UPSTREAM_DNS=8.8.8.8

## Storage path for the cached data
CACHE_ROOT=/lancache
## Note that by default, this will be a folder relative to the docker-compose.yml file
CACHE_ROOT=./lancache

## Change this to customise the size of the memory cache (default 500m)
CACHE_MEM_SIZE=500m

## Change this to customise the size of the disk cache (default 1000000m)
## If you have more storage, you'll likely want to increase this
## The cache server will prune content on a least-recently-used basis if it
## starts approaching this limit
CACHE_DISK_SIZE=1000000m
VibroAxe marked this conversation as resolved.
Show resolved Hide resolved

## Which type of steam caching to use [generic|steamcache]
STEAMCACHE_CONTAINER=generic
## Change this to limit the maximum age of cached content (default 3650d)
CACHE_MAX_AGE=3650d
69 changes: 66 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,72 @@

![Docker Pulls](https://img.shields.io/docker/pulls/lancachenet/monolithic?label=Monolithic) ![Docker Pulls](https://img.shields.io/docker/pulls/lancachenet/lancache-dns?label=Lancache-dns) ![Docker Pulls](https://img.shields.io/docker/pulls/lancachenet/sniproxy?label=Sniproxy) ![Docker Pulls](https://img.shields.io/docker/pulls/lancachenet/generic?label=Generic)

This docker-compose is meant as an example for running our lancache stack, It will run out of the box with minimal changes to the .env file for your local IP address.
This docker-compose is meant as an example for running our lancache stack, It will run out of the box with minimal changes to the `.env` file for your local IP address.

### More information
# Settings
> You *MUST* set at least `LANCACHE_IP` and `DNS_BIND_IP`. It is highly recommended that you change `CACHE_ROOT` to a folder of your choosing, and set [`CACHE_DISK_SIZE`](#cache_disk_size) to a value that suits your storage capacity.

## `USE_GENERIC_CACHE`
This controls IP assignment within the DNS service - it assumes that every service is reachable by default on every IP given in `LANCACHE_IP`. See the [lancache-dns](https://github.com/lancachenet/lancache-dns) project for documentation on customising the behaviour of the DNS service.

## `LANCACHE_IP`
This provides one or more IP addresses to the DNS service to advertise the cached services. If your cache host has exactly one IP address (e.g. `192.168.0.10`), specify that here. If your cache host has more IP addresses, you can list all of them, separated by spaces (e.g. `192.168.0.10 192.168.0.11 192.168.0.12`) - DNS entries will be configured for all services and all IPs by default.

> **Note:** unless your cache host is at `10.0.39.1`, you will want to change this value.

## `DNS_BIND_IP`
This sets the IP address that the DNS service will listen on. If your cache host has exactly one IP address (eg. `192.168.0.10`), specify that here. If your cache host has multiple IPs, specify exactly one and use that. This compose stack does not support the DNS service listening on multiple IPs by default.

> **Note:** unless your cache host is at `10.0.39.1`, you will want to change this value.

There are a few ways to make your local network aware of the cache server.

1. Advertise the IP given in `DNS_BIND_IP` via DHCP to your network as a nameserver. In this scenario, all clients configured to use the nameservers from DNS will use the `lancache-dns` service.
This allows the `lancache-dns` service to provide clients with the appropriate local IPs for cached services, and all other requests will be passed to `UPSTREAM_DNS`.
2. Use the configuration generators available from [UKLANs' cache-domains](https://github.com/uklans/cache-domains) project to create configuration data to load into your network's existing DNS infrastructure

## `UPSTREAM_DNS`
This allows you to choose one or more IP addresses for upstream DNS resolution if a name is not matched by the `lancache-dns` service (e.g. non-cached services, local hostname resolution).

Whichever resolver you choose depends on your network's requirements - if you don't need to provide internal DNS names, you can point `UPSTREAM_DNS` directly to an external resolver (the default is Google's DNS at `8.8.8.8`).

If you run internal services on your network, you can set `UPSTREAM_DNS` to be your internal DNS resolver(s), semicolon separated (e.g. `192.168.0.1; 192.168.0.2`).

### Example external resolvers
- Google DNS:
- `8.8.8.8`
- `8.8.4.4`
- Cloudflare
- `1.1.1.1`
- OpenDNS
- `208.67.222.222`
- `208.67.220.220`

## `CACHE_ROOT`
This will be used as the base directory for storing cached data (as `CACHE_ROOT/cache`) and logs (as `CACHE_ROOT/logs`).

The `CACHE_ROOT` should either be on a separate partition, or ideally on separate storage devices entirely, from your system root.

> **Note:** this setting defaults to `./lancache`. Unless your cache storage lives here, you probably want to change this value.

## `CACHE_MEM_SIZE`
This controls the size of the memory cache used by the cache server. The default should suffice for almost all configurations.

> **Note:** this setting does not limit the amount of memory that the Linux host will use for page caches, only what the cache server will use itself - see the Docker documentation on limiting memory consumption for a container if you wish to constrain the total memory consumption of the cache server, but generally you want as much memory as possible on your cache server to be used to store hot data.

## `CACHE_DISK_SIZE`
This setting will constrain the upper limit of space used by cached data. You generally want to leave a small gap (10-20GB at least) between the size listed here and the available storage space used for the cached data, just in case.

The cache server will automatically cached data when the total stored amount approaches this limit, in a least-recently-used fashion (oldest data, least accessed deleted first).

> **Note:** that this must be given in megabytes with an `m` suffix (e.g. the default value, `1000000m`).

## `CACHE_MAX_AGE`
This setting allows you to control the maximum duration cached data will be kept for. The default should be fine for most use cases - the `CACHE_DISK_SIZE` setting will generally be used before this for aging out data.

> **Note:** this must be given as a number of days in age before expiry, with a `d` suffix (e.g. the default value, `3650d`).

# More information
The LanCache docker-stack is generated automatically from the data over at [UKLans](https://github.com/uklans/cache-domains). All services that are listed in the UKLans repository are available and supported inside this docker-compose.

For an FAQ see https://github.com/lancachenet/generic/blob/master/faq.md
For an FAQ see https://github.com/lancachenet/monolithic/blob/master/faq.md
20 changes: 0 additions & 20 deletions build/docker-compose.yml.tmp

This file was deleted.

174 changes: 7 additions & 167 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,180 +1,20 @@
version: '2'
services:
proxy:
image: jwilder/nginx-proxy
env_file: .env
ports:
- ${LANCACHE_IP}:80:80/tcp
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
env_file: .env
dns:
image: lancachenet/lancache-dns:latest
env_file: .env
ports:
- ${DNS_IP}:53:53/udp
- ${DNS_BIND_IP}:53:53/udp
sniproxy:
image: lancachenet/sniproxy:latest
env_file: .env
ports:
- 443:443/tcp
apple:
image: lancachenet/generic:latest
env_file: .env
volumes:
- ${CACHE_ROOT}/apple/cache:/data/cache
- ${CACHE_ROOT}/apple/logs:/data/logs
environment:
- VIRTUAL_HOST=swcdn.apple.com
arenanet:
image: lancachenet/generic:latest
env_file: .env
volumes:
- ${CACHE_ROOT}/arenanet/cache:/data/cache
- ${CACHE_ROOT}/arenanet/logs:/data/logs
environment:
- VIRTUAL_HOST=assetcdn.101.arenanetworks.com,assetcdn.102.arenanetworks.com,assetcdn.103.arenanetworks.com,live.patcher.bladeandsoul.com
blizzard:
image: lancachenet/generic:latest
env_file: .env
volumes:
- ${CACHE_ROOT}/blizzard/cache:/data/cache
- ${CACHE_ROOT}/blizzard/logs:/data/logs
environment:
- VIRTUAL_HOST=dist.blizzard.com,dist.blizzard.com.edgesuite.net,llnw.blizzard.com,edgecast.blizzard.com,blizzard.vo.llnwd.net,blzddist1-a.akamaihd.net,blzddist2-a.akamaihd.net,blzddist3-a.akamaihd.net,blzddist4-a.akamaihd.net,level3.blizzard.com,nydus.battle.net,edge.blizzard.top.comcast.net
daybreak:
image: lancachenet/generic:latest
env_file: .env
volumes:
- ${CACHE_ROOT}/daybreak/cache:/data/cache
- ${CACHE_ROOT}/daybreak/logs:/data/logs
environment:
- VIRTUAL_HOST=pls.patch.daybreakgames.com
frontier:
image: lancachenet/generic:latest
env_file: .env
volumes:
- ${CACHE_ROOT}/frontier/cache:/data/cache
- ${CACHE_ROOT}/frontier/logs:/data/logs
environment:
- VIRTUAL_HOST=cdn.zaonce.net
hirez:
image: lancachenet/generic:latest
env_file: .env
volumes:
- ${CACHE_ROOT}/hirez/cache:/data/cache
- ${CACHE_ROOT}/hirez/logs:/data/logs
environment:
- VIRTUAL_HOST=hirez.http.internapcdn.net
minecraft:
image: lancachenet/generic:latest
env_file: .env
volumes:
- ${CACHE_ROOT}/minecraft/cache:/data/cache
- ${CACHE_ROOT}/minecraft/logs:/data/logs
environment:
- VIRTUAL_HOST=*.download.minecraft.net
nexusmods:
image: lancachenet/generic:latest
env_file: .env
volumes:
- ${CACHE_ROOT}/nexusmods/cache:/data/cache
- ${CACHE_ROOT}/nexusmods/logs:/data/logs
environment:
- VIRTUAL_HOST=filedelivery.nexusmods.com
nintendo:
image: lancachenet/generic:latest
env_file: .env
volumes:
- ${CACHE_ROOT}/nintendo/cache:/data/cache
- ${CACHE_ROOT}/nintendo/logs:/data/logs
environment:
- VIRTUAL_HOST=ccs.cdn.wup.shop.nintendo.com,pushmo.hac.lp1.eshop.nintendo.net,ecs-lp1.hac.shop.nintendo.net,receive-lp1.dg.srv.nintendo.net,aqua.hac.lp1.d4c.nintendo.net,atum.hac.lp1.d4c.nintendo.net,bugyo.hac.lp1.eshop.nintendo.net,tagaya.hac.lp1.eshop.nintendo.net
origin:
image: lancachenet/generic:latest
env_file: .env
volumes:
- ${CACHE_ROOT}/origin/cache:/data/cache
- ${CACHE_ROOT}/origin/logs:/data/logs
environment:
- VIRTUAL_HOST=origin-a.akamaihd.net,akamai.cdn.ea.com,lvlt.cdn.ea.com,river.data.ea.com,origin-a.akamaihd.net.edgesuite.net
renegadex:
image: lancachenet/generic:latest
env_file: .env
volumes:
- ${CACHE_ROOT}/renegadex/cache:/data/cache
- ${CACHE_ROOT}/renegadex/logs:/data/logs
environment:
- VIRTUAL_HOST=rxp-fl.cncirc.net,rxp-chi.cncirc.net,rxp-nz.cncirc.net,rxp-bgr.cncirc.net,rxp-fr.cncirc.net,rxp-nyc.cncirc.net,rxp-uk.cncirc.net,rxp-sg.cncirc.net,rxp-la.cncirc.net,rxp-fin.cncirc.net,denver1.renegade-x.com,seattle1.renegade-x.com
riot:
image: lancachenet/generic:latest
env_file: .env
volumes:
- ${CACHE_ROOT}/riot/cache:/data/cache
- ${CACHE_ROOT}/riot/logs:/data/logs
environment:
- VIRTUAL_HOST=l3cdn.riotgames.com,worldwide.l3cdn.riotgames.com,riotgamespatcher-a.akamaihd.net,riotgamespatcher-a.akamaihd.net.edgesuite.net
rockstar:
image: lancachenet/generic:latest
env_file: .env
volumes:
- ${CACHE_ROOT}/rockstar/cache:/data/cache
- ${CACHE_ROOT}/rockstar/logs:/data/logs
environment:
- VIRTUAL_HOST=patches.rockstargames.com
sony:
image: lancachenet/generic:latest
env_file: .env
volumes:
- ${CACHE_ROOT}/sony/cache:/data/cache
- ${CACHE_ROOT}/sony/logs:/data/logs
environment:
- VIRTUAL_HOST=pls.patch.station.sony.com,gs2.ww.prod.dl.playstation.net,gs2.sonycoment.loris-e.llnwd.net
steam:
image: lancachenet/${STEAMCACHE_CONTAINER}:latest
env_file: .env
volumes:
- ${CACHE_ROOT}/steam/cache:/data/cache
- ${CACHE_ROOT}/steam/logs:/data/logs
environment:
- VIRTUAL_HOST=*.content.steampowered.com,content1.steampowered.com,content2.steampowered.com,content3.steampowered.com,content4.steampowered.com,content5.steampowered.com,content6.steampowered.com,content7.steampowered.com,content8.steampowered.com,cs.steampowered.com,steamcontent.com,client-download.steampowered.com,*.hsar.steampowered.com.edgesuite.net,*.akamai.steamstatic.com,content-origin.steampowered.com,clientconfig.akamai.steamtransparent.com,steampipe.akamaized.net,edgecast.steamstatic.com,steam.apac.qtlglb.com.mwcloudcdn.com,*.cs.steampowered.com,*.edgecast.steamstatic.com,*.steamcontent.com,cdn1-sea1.valve.net,cdn2-sea1.valve.net,*.steam-content-dnld-1.apac-1-cdn.cqloud.com,steam.apac.qtlglb.com,edge.steam-dns.top.comcast.net,edge.steam-dns-2.top.comcast.net,steamcdn-a.akamaihd.net
uplay:
image: lancachenet/generic:latest
env_file: .env
volumes:
- ${CACHE_ROOT}/uplay/cache:/data/cache
- ${CACHE_ROOT}/uplay/logs:/data/logs
environment:
- VIRTUAL_HOST=*.cdn.ubi.com
twitch:
image: lancachenet/generic:latest
env_file: .env
volumes:
- ${CACHE_ROOT}/twitch/cache:/data/cache
- ${CACHE_ROOT}/twitch/logs:/data/logs
environment:
- VIRTUAL_HOST=d3rmjivj4k4f0t.cloudfront.net,addons.forgesvc.net,media.forgecdn.net,files.forgecdn.net
wargaming:
image: lancachenet/generic:latest
env_file: .env
volumes:
- ${CACHE_ROOT}/wargaming/cache:/data/cache
- ${CACHE_ROOT}/wargaming/logs:/data/logs
environment:
- VIRTUAL_HOST=dl.wargaming.net,dl2.wargaming.net,wg.gcdn.co,wargaming.net.edgesuite.ne,wgusst-na.wargaming.net,wgusst-eu.wargaming.net,update-v4r4h10x.worldofwarships.com,dl-wows-ak.wargaming.net,wgus-wotasia.wargaming.net
wsus:
image: lancachenet/generic:latest
env_file: .env
volumes:
- ${CACHE_ROOT}/wsus/cache:/data/cache
- ${CACHE_ROOT}/wsus/logs:/data/logs
environment:
- VIRTUAL_HOST=officecdn.microsoft.com,windowsupdate.com,*.windowsupdate.com,dl.delivery.mp.microsoft.com,*.dl.delivery.mp.microsoft.com
xboxlive:
image: lancachenet/generic:latest
monolithic:
image: lancachenet/monolithic:latest
env_file: .env
ports:
- 80:80/tcp
volumes:
- ${CACHE_ROOT}/xboxlive/cache:/data/cache
- ${CACHE_ROOT}/xboxlive/logs:/data/logs
environment:
- VIRTUAL_HOST=assets1.xboxlive.com,assets2.xboxlive.com,dlassets.xboxlive.com,xboxone.loris.llnwd.net,*.xboxone.loris.llnwd.net,xboxone.vo.llnwd.net,images-eds.xboxlive.com,xbox-mbr.xboxlive.com,assets1.xboxlive.com.nsatc.net
- ${CACHE_ROOT}/cache:/data/cache
- ${CACHE_ROOT}/logs:/data/logs
58 changes: 0 additions & 58 deletions generate.sh

This file was deleted.