Skip to content

Deploying Lancache

Introduction

Lancache is an open source caching solution designed specifically for game downloads from major platforms like Steam, Epic Games Store, Origin, Battle.net, and many others. Originally designed for LAN parties and gaming events, Lancache reduces bandwidth usage and dramatically speeds up game downloads by caching content locally.

When multiple users download the same game or update, Lancache serves the content from its local cache instead of downloading from the internet repeatedly. This is invaluable for events, gaming cafes, households with multiple gamers, or organizations with limited bandwidth.

Key features of Lancache:

  • Multi-Platform Support: Steam, Epic, Origin, Battle.net, Uplay, Xbox, PlayStation, Nintendo
  • Massive Bandwidth Savings: Cache once, serve many times
  • Fast Downloads: Local network speeds for cached content
  • Automatic Updates: Cached content updated transparently
  • DNS-Based Routing: Works with any client without configuration
  • Monolithic or Split Mode: Single cache or per-service caches
  • Statistics Dashboard: Monitor cache hits and bandwidth savings
  • Prefill Support: Pre-download games before events
  • Open Source: Community-driven development
  • Docker-Based: Easy deployment and management

This guide walks through deploying Lancache on Klutch.sh using Docker, configuring DNS, and maximizing your cache efficiency.

Why Deploy Lancache on Klutch.sh

Deploying Lancache on Klutch.sh provides several advantages for game download caching:

Simplified Deployment: Klutch.sh automatically detects your Dockerfile and builds Lancache without complex orchestration.

Massive Storage: Attach large persistent volumes to cache hundreds of gigabytes of game content.

Always Available: Your cache is accessible 24/7, not just during events.

GitHub Integration: Connect your configuration repository directly from GitHub. Updates trigger automatic redeployments.

Scalable Resources: Allocate CPU and memory based on expected concurrent users.

Environment Variable Management: Securely store configuration without exposing in code.

Custom Domains: Assign domains for the cache and DNS services.

Persistent Cache: Game downloads survive container restarts.

Prerequisites

Before deploying Lancache on Klutch.sh, ensure you have:

  • A Klutch.sh account
  • A GitHub account with a repository for your configuration
  • Basic familiarity with Docker, DNS, and networking
  • Ability to configure DNS on your network
  • Large storage capacity for game cache
  • (Optional) Upstream DNS server address

Preparing Your Repository

Create a GitHub repository containing your Dockerfile for deploying Lancache on Klutch.sh.

Repository Structure

lancache-deploy/
├── Dockerfile
├── README.md
└── .dockerignore

Creating the Dockerfile

Create a Dockerfile for the Lancache monolithic container:

FROM lancachenet/monolithic:latest
# Set environment variables
ENV CACHE_MEM_SIZE=500m
ENV CACHE_DISK_SIZE=1000g
ENV CACHE_MAX_AGE=3650d
# Create cache directory
RUN mkdir -p /data/cache /data/logs
# Expose HTTP port
EXPOSE 80
# The base image includes the default entrypoint

Environment Variables Reference

VariableRequiredDefaultDescription
CACHE_MEM_SIZENo500mMemory for caching metadata
CACHE_DISK_SIZEYes-Maximum disk cache size
CACHE_MAX_AGENo3650dMaximum age of cached content
UPSTREAM_DNSNo8.8.8.8Upstream DNS server
CACHE_DOMAINS_REPONo-Custom cache domains repository
NGINX_WORKER_PROCESSESNoautoNumber of nginx workers
CACHE_INDEX_SIZENo500mSize of cache index in memory

Deploying Lancache on Klutch.sh

    Push Your Repository to GitHub

    Initialize your repository and push to GitHub:

    Terminal window
    git init
    git add Dockerfile .dockerignore README.md
    git commit -m "Initial Lancache deployment configuration"
    git remote add origin https://github.com/yourusername/lancache-deploy.git
    git push -u origin main

    Create a New Project on Klutch.sh

    Navigate to the Klutch.sh dashboard and create a new project. Give it a descriptive name like “lancache” or “game-cache”.

    Create a New App

    Within your project, create a new app. Connect your GitHub account if you haven’t already, then select the repository containing your Lancache Dockerfile.

    Configure HTTP Traffic

    In the deployment settings:

    • Select HTTP as the traffic type
    • Set the internal port to 80

    Set Environment Variables

    Add the following environment variables:

    VariableValue
    CACHE_MEM_SIZE500m
    CACHE_DISK_SIZE1000g (adjust to your volume size)
    CACHE_MAX_AGE3650d
    UPSTREAM_DNS8.8.8.8

    Attach Persistent Volumes

    Add volumes for cache storage:

    Mount PathRecommended SizePurpose
    /data/cache1+ TBCached game downloads
    /data/logs10 GBAccess and error logs

    Deploy Your Application

    Click Deploy to start the build process. Klutch.sh will:

    • Detect your Dockerfile automatically
    • Build the container image
    • Attach the persistent volumes
    • Start the Lancache container
    • Provision an HTTPS certificate

    Note Your IP Address

    Record the IP address of your Lancache deployment for DNS configuration.

DNS Configuration

Setting Up Lancache DNS

For Lancache to work, client devices need to use DNS that redirects game download requests to your cache. You have several options:

Option 1: Use Lancache DNS Container

Deploy the Lancache DNS container separately and point clients to it.

Option 2: Configure Your Router

Many routers support custom DNS entries. Add entries for game CDN domains pointing to your Lancache IP.

Option 3: Local DNS Server

If you run Pi-hole or similar, add custom DNS records for game CDNs.

Supported Services

Lancache caches downloads from:

ServiceDescription
SteamSteam game downloads
EpicEpic Games Store
OriginEA Origin/EA App
Battle.netBlizzard games
UplayUbisoft Connect
XboxMicrosoft/Xbox downloads
PlayStationPlayStation Network
NintendoNintendo Switch updates
RiotLeague of Legends, Valorant
RockstarRockstar Games Launcher

Monitoring Your Cache

Checking Cache Statistics

View cache performance:

  1. Check Lancache logs for HIT/MISS ratios
  2. Monitor disk usage of cache volume
  3. Track bandwidth savings over time

Understanding Cache Behavior

Log EntryMeaning
HITServed from cache
MISSDownloaded from origin
EXPIREDCache entry expired, re-downloading
BYPASSContent not cached

Prefilling Your Cache

Using Steam Prefill

Download games before events:

Terminal window
docker run -it --rm \
-v /data/cache:/data/cache \
tpill90/steam-lancache-prefill:latest \
prefill --appids 730,570,440

Using Epic Prefill

Pre-cache Epic games:

Terminal window
docker run -it --rm \
-v /data/cache:/data/cache \
tpill90/epic-lancache-prefill:latest \
prefill

Troubleshooting Common Issues

Cache Not Working

  • Verify DNS is correctly redirecting traffic
  • Check that clients are using your DNS server
  • Ensure firewall allows traffic to Lancache

Slow Downloads

  • Check cache HIT rate in logs
  • Verify sufficient disk I/O
  • Ensure network isn’t bottlenecked

Disk Space Issues

  • Monitor cache size vs allocated space
  • Adjust CACHE_DISK_SIZE if needed
  • Consider enabling cache cleanup

Additional Resources

Conclusion

Deploying Lancache on Klutch.sh gives you a powerful game download caching solution with persistent storage and automatic builds. Save bandwidth and speed up downloads for your gaming setup, whether for events or everyday use.