With the recent upgrade to Fortnite, I saw that the bandwidth at the house was being saturated with these 17GB updates going to 3 different Playstations. With that being said I started to think there had to be a way to set up a local report, or a cache to serve all the updates/installs to save not only bandwidth but also time.
A quick search landed me on Lancache which totes itself with the motto of “LAN Party game caching made easy“. Sounded like an instant win, especially when I saw that it consisted of only two Docker containers to get it up and running.
The one issue is that it does run its own DNS server, which I have a Pi-hole on the LAN so I needed to figure out if it was possible to still run traffic through the Pi-hole or not. The next issue was, where was I going to run this as it also used ports 80 and 443 which I have other services running on those ports via my reverse proxy.
Again the install was simple enough using the following commands once Docker had been installed
export HOST_IP=`hostname -I | cut -d' ' -f1`
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 -p 443:443 lancachenet/monolithic:latest
echo Please configure your router/dhcp server to serve dns as $HOST_IP
Of course, the commands they had published on their site did not work entirely on macOS as the “hostname” command for instance did not provide the results, again it was easy enough to know the IP of the Mac mini and use that in the Docker commands. Also, the /cache/ directory I relocated to my /Users/name/ instead since I was the logged-in user on the Mac mini.
Once I ran the commands I was up and running, I was able to point one of the Playstations to use the IP of the container as the primary DNS server. Upon doing that I removed Fortnite and then downloaded it again. I kept an eye on the cache directory and saw that it was increasing so this was working.
However after this reinstall was complete, I removed the game from the Playstation and downloaded it again. I confirmed it was downloading from the Mac mini instead of from the internet, but the speeds were not nearly what I was expecting. Bandwidth usage aside I was better off just downloading it in real-time as the speeds were just so/so.
I decided that this had to be an issue with the I/O on the dated Mac mini set up so I set up a Ryzen 5 3600 machine I had sitting unused at the time and reinstalled Ubuntu Server 20.04, Docker, and the Lancache containers.
I again tested the method again, and saw that the cache directory was increasing in size so things were working! After the initial install, I again deleted the game from the Playstation and gave it a go again. Now, this is what I was expecting when the PlayStation queued up Fortnite the total install time was sitting at 4 minutes, vs the Mac mini which was about 20 minutes (Still a huge improvement from no-cache which was around 45-60 minutes).
I also made some adjustments this time around to the containers as I had a lot more resources to play around with on the new machine, I adjusted them as follows.
docker run --restart unless-stopped --name lancache-dns --detach -p 53:53/udp -e USE_GENERIC_CACHE=true -e UPSTREAM_DNS=10.0.1.23 -e LANCACHE_IP=$HOST_IP lancachenet/lancache-dns:latest
docker run --restart unless-stopped --name lancache --detach -v /home/shelby/cache/data:/data/cache -v /home/shelby/logs:/data/logs -e CACHE_MEM_SIZE=2048m -e CACHE_DISK_SIZE=500000m -e CACHE_MAX_AGE=3560d -e UPSTREAM_DNS=10.0.1.23 -p 80:80 -p 443:443 lancachenet/monolithic:latest
As you may notice I adjusted the cache memory limit and disk limits, I tried this on the Mac mini (Not as high of settings) but even then it made little to no difference on the Mac mini. I also was able to adjust the upstream DNS to point to my Pi-hole so it was able to be utilized in the end.
I almost forgot to mention on the new Ubuntu 20.04 setup I was running into issues getting the lancache-dns container to initialize as it kept complaining about port 53 already being in use, to resolve this I had to run the following and then the container was created without issue
sudo systemctl stop systemd-resolved
sudo systemctl disable systemd-resolved
Overall I am happy with the setup, while minor it may help to stop some complaining about installs, and upgrades on the network if someone else has already requested them previously.