# Steamcache

A light weight series of services that allow caching of steam downloads, windows updates and more!

## Inspiration / Further Reading

- [http://steamcache.github.io/](http://steamcache.github.io/)

## Warning

Please note this is a set of 3 services that work well for caching downloaded content. HOWEVER, you will be poisoning your DNS records and creating a small Man-In-The-Middle attach for some services. These are very real concerns that should be considered before running these services.

## Hardware Concerns

The official docs state you'll want "big, dedicated hardware". They are not lying. You'll want at least a 500Gb HD, preferably >1Tb and likely an O-Droid HC2 dedicated to this setup.

This setup also assumes you will only be running steamcache on the main, wired network adapter with *no* firewall.

We do **NOT** recommend running Steamcache alongside any other services. There are too many ways things can go wrong when putting this service alongside others.

## Prep Install

``` bash

# Prep
mkdir -p /tank/steam/cache/data /tank/steam/cache/logs

# Setup static IP(s) for the main board running steam cache ; fix the IP addresses in the run scripts below

```

## Install / Run

``` bash

cat > /root/steamcache.sh <<EOF
#!/bin/bash

ARCH=\`arch\`
UPSTREAM=""

# Cleanup arch/container image here
if [ \$ARCH == "aarch64" ]
then
    echo "64bit arm"
    UPSTREAM="registry.lollipopcloud.solutions/arm64v8/steamcache:latest"
else
    echo "32bit arm"
    UPSTREAM="registry.lollipopcloud.solutions/arm32v7/steamcache:latest"
fi

echo "Updating"
docker pull \$UPSTREAM


docker stop steamcache
docker rm steamcache

docker run --name steamcache \\
    --restart unless-stopped \\
    --network docker-private \\
    --ip 172.30.0.5 \\
    -v /tank/steam/cache/data:/data/cache \\
    -v /tank/steam/cache/logs:/data/logs \\
    \$UPSTREAM
EOF

cat > /root/steamcache-dns.sh <<EOF
#!/bin/bash

ARCH=\`arch\`
UPSTREAM=""

# Cleanup arch/container image here
if [ \$ARCH == "aarch64" ]
then
    echo "64bit arm"
    UPSTREAM="registry.lollipopcloud.solutions/arm64v8/steamcache-dns:latest"
else
    echo "32bit arm"
    UPSTREAM="registry.lollipopcloud.solutions/arm32v7/steamcache-dns:latest"
fi

echo "Updating"
docker pull \$UPSTREAM

docker stop steamcache-dns
docker rm steamcache-dns

docker run --name steamcache-dns \\
    --restart unless-stopped \\
    -e USE_GENERIC_CACHE=true \\
    -p 172.31.30.51:53/udp \\
    -p 172.31.30.51:53/tcp \\
    -e LANCACHE_IP=172.31.30.50 \\
    -e STEAMCACHE_IP=172.31.30.50 \\
    -e UPSTREAM_DNS=172.31.0.1 \\
    \$UPSTREAM
EOF

cat > steamcache-sniproxy.sh <<EOF
#!/bin/bash

ARCH=\`arch\`
UPSTREAM=""

# Cleanup arch/container image here
if [ \$ARCH == "aarch64" ]
then
    echo "64bit arm"
    UPSTREAM="registry.lollipopcloud.solutions/arm64v8/steamcache-sniproxy:latest"
else
    echo "32bit arm"
    UPSTREAM="registry.lollipopcloud.solutions/arm32v7/steamcache-sniproxy:latest"
fi

echo "Updating"
docker pull \$UPSTREAM

docker stop steamcache-sniproxy
docker rm steamcache-sniproxy

docker run --name steamcache-sniproxy \\
    --restart unless-stopped \\
    -p 443:443 \\
    $UPSTREAM
EOF

```

Simply execute ```/root/steamcache*.sh``` to update/run all of the steamcache containers/services.
