tpill90 / battlenet-lancache-prefill

CLI tool to automatically prefill a Lancache with Battle.Net games
https://tpill90.github.io/battlenet-lancache-prefill/
MIT License
72 stars 10 forks source link

Docker Version always Downloading #105

Open gen2fish opened 9 months ago

gen2fish commented 9 months ago

Describe the bug Running the container in Kubernetes as a CronJob, even with back to back executions it still downloads each time.

CronJob Manifest

apiVersion: batch/v1
kind: CronJob
metadata:
  name: battlenet-lancache-prefill
spec:
  schedule: "0 * * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: battlenet-lancache-prefill
            image: tpill90/battlenet-lancache-prefill:latest
            args:
            - prefill
            - -p
            - wow
          restartPolicy: OnFailure

Container Log for 1st run

[2:25:33 PM] Prefilling 1 products 

[2:25:33 PM] Starting World Of Warcraft
Detecting Lancache server...
[2:25:33 PM] Detected Lancache server at level3.blizzard.com [172.20.0.12]

Getting latest config files...
Building Archive Indexes...
Determining files to download...
[2:25:48 PM] Retrieved product metadata                          15.1284
[2:25:49 PM] Downloading 84.62 GiB
Downloading..: 0%
Downloading..: 13%
Downloading..: 25%
Downloading..: 38%
Downloading..: 50%
Downloading..: 65%
Downloading..: 75%
Downloading..: 91%
Downloading..: 95%
Downloading..: 96%
Downloading..: 97%
Downloading..: 98%
Downloading..: 99%
[2:29:08 PM] Finished in 03:19.37 - 3.65 Gbit/s

[2:29:08 PM] Prefill complete! Prefilled 1 apps                  03:35.26
────────────────────────────────────────────────────────────────────────────────
  Prefilled 1 apps in 03:35.28 

   Updated │ Up To Date        
  ━━━━━━━━━┿━━━━━━━━━━━━       
      1    │     0             
2023-09-12T14:29:08.643070287Z

2nd Run

[2:29:49 PM] Prefilling 1 products 

[2:29:50 PM] Starting World Of Warcraft
Detecting Lancache server...
[2:29:50 PM] Detected Lancache server at level3.blizzard.com [172.20.0.12]

Getting latest config files...
Building Archive Indexes...
Determining files to download...
[2:30:03 PM] Retrieved product metadata                          13.6584
[2:30:04 PM] Downloading 84.62 GiB
Downloading..: 0%
Downloading..: 12%
Downloading..: 25%
Downloading..: 38%
Downloading..: 50%
Downloading..: 63%
Downloading..: 75%
Downloading..: 91%
Downloading..: 95%
Downloading..: 96%
Downloading..: 97%
Downloading..: 98%
Downloading..: 99%
[2:33:33 PM] Finished in 03:29.01 - 3.48 Gbit/s

[2:33:33 PM] Prefill complete! Prefilled 1 apps                  03:43.40
────────────────────────────────────────────────────────────────────────────────
  Prefilled 1 apps in 03:43.41 

   Updated │ Up To Date        
  ━━━━━━━━━┿━━━━━━━━━━━━       
      1    │     0             
2023-09-12T14:33:33.267542917Z

172.20.0.12 is the correct IP for my Lancache server

tpill90 commented 9 months ago

I'm not familiar with how Kubernetes works, but are the containers for this job being reused? Or run and then removed immediately?

I think I might know what's going on here, but need the above info to be sure

gen2fish commented 9 months ago

They are ran and removed and a new one is built everytime

On Wed, Sep 13, 2023, 12:01 AM Tim Pilius @.***> wrote:

I'm not familiar with how Kubernetes works, but are the containers for this job being reused? Or run and then removed immediately?

I think I might know what's going on here, but need the above info to be sure

— Reply to this email directly, view it on GitHub https://github.com/tpill90/battlenet-lancache-prefill/issues/105#issuecomment-1716996320, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTL4KXUVJBRYS7MTBEFRNTX2FDZ5ANCNFSM6AAAAAA4VRBQXQ . You are receiving this because you authored the thread.Message ID: @.***>

tpill90 commented 1 month ago

Hi Chris,

Apologies for the late reply. The solution to your issue is that BattlenetPrefill has a directory where it stores various configuration, and inside that folder is a file where it keeps track of what is up to date.

The solution here will be to properly bind mount that directory. An example is in the docs Docker Setup Guide, but I'll post it here as well:

docker run -it --rm --net=host \
  --volume ~/.config/BattleNetPrefill:/Config \
  tpill90/battlenet-lancache-prefill:latest 

From the above example, the Config folder is being bound to the user's directory. You'll want to change the binding for the Config folder to wherever you want to save it.

tpill90 commented 1 month ago

I'm going to close this for now. If the above doesn't solve your issue please feel free to reopen.

gen2fish commented 1 month ago

I was able to implement and it works

apiVersion: batch/v1
kind: CronJob
metadata:
  name: battlenet-lancache-prefill
spec:
  schedule: "0 * * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: battlenet-lancache-prefill
            image: tpill90/battlenet-lancache-prefill:latest
            args:
            - prefill
            - -p
            - wow
            volumeMounts:
            - name: battlenet-pvc
              mountPath: /root/.cache/
          restartPolicy: OnFailure
          volumes:
          - name: battlenet-pvc
            persistentVolumeClaim:
              claimName: battlenet-pvc
bedaes commented 2 weeks ago

@gen2fish thx for pointing me to /root/.cache.

@tpill90 I had to mount both /Config and /root/.cache directories to have it working properly. /Config contains selectedAppsToPrefill.json whereas /root/.cache holds the BattlenetPrefill folder. But there's only /Config mentioned in the setup guide - am I doing something wrong or should /root/.cache be added to the guid? Thx!