lancachenet / docker-compose

Docker-compose for a full-stack lancache
288 stars 55 forks source link

Manually setting up a Lancache on TrueNAS Scale with docker-compose #33

Closed fex95 closed 1 year ago

fex95 commented 1 year ago

TrueNAS does not provide support for Lancache out of the box. In the context of several private events I wanted to use this combination more often and would like to publish my solution here for others with the same problem. Unfortunately, the pre-built Lancache implementation of Truecharts does not work for me.

1. Adding catalog for docker-compose

Adding the Truecharts catalog to your TrueNAS as described in this manual https://truecharts.org/docs/manual/guides/Adding-TrueCharts This takes a few minutes. The progress can be monitored in the task manager.

2. Install an instance of the docker-compose app

Apps -> Available Applications -> docker-compose -> Install Give it a name like lancache and keep clicking next until you get to the tab Storage and Persistence, click add and select type of storage PVC and mount path to /cache and select the desired storage size for the cache. Now continue clicking next until you reach the save button and click it.

3. Change WebUi Ports

System Settings -> General -> GUI -> Settings Change Web Interface HTTP Port and Web Interface HTTPS Port. In my case i use port 8080 and 9443. From now on you have to use the server address with the new ports for example 192.168.100.100:8080.

4. Setup lancache

Apps -> Installed Applications -> [your new docker-compose instanz] -> three points -> Shell -> Choose Now you are on the container on which we want to run lancache. Use the command ls and make sure that the directory cache is present. Enter the directory with cd cache, create a new directory with mkdir lancache and enter it cd lancache. Unfortunately this container does not support git but we can download the important files manually. wget https://raw.githubusercontent.com/lancachenet/docker-compose/master/.env wget https://raw.githubusercontent.com/lancachenet/docker-compose/master/docker-compose.yml Open the .env file with nano .env and adjust the configuration. It's important to change your cache path to /cache, your size lower then the seleced size in step 2 and your ip to your truenas ip. Start the lancache with docker-compose -f docker-compose.yml up -d

5. Check if the cache is running correctly

Write docker ps and check that there are two containers named lancache and lancache-dns. Go to System Settings -> Shell and type sudo lsof -i -P -n | grep docker and check that there is port 80 (TCP), 443 (TCP) an 53 (TCP+UDP). Change the DNS server to your truenas ip and disable IPv6 on the device you want to test. Close steam or whatever applications you want to use to test the cache and open a terminal on the device where you type ipconfig /flushdns. Now open steam or other game provider and download a game. While doing this, open the dashboard in the truenas webui and look at the network load. When downloading the game for the first time, the downlink (in) and uplink (out) should match your internet performance and be the same size. The second time you download the game, only the uplink (out) should be used, and at a much higher speed.

I hope I could help someone who had the same problems as me.

Tested under TrueNAS-SCALE-22.02.4

stale[bot] commented 1 year ago

This issue has been automatically marked as inactive because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 1 year ago

This issue has been automatically marked as inactive because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 1 year ago

This issue has been automatically closed after being inactive for 30 days. If you require further assistance please reopen the issue with more details or talk to us on discord