battlenet-lancache-prefill icon indicating copy to clipboard operation
battlenet-lancache-prefill copied to clipboard

Docker Version always Downloading

Open gen2fish opened this issue 1 year ago • 7 comments

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

gen2fish avatar Sep 12 '23 23:09 gen2fish

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

tpill90 avatar Sep 13 '23 06:09 tpill90

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: @.***>

gen2fish avatar Sep 13 '23 12:09 gen2fish

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 avatar May 07 '24 19:05 tpill90

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

tpill90 avatar May 07 '24 19:05 tpill90

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

gen2fish avatar May 29 '24 03:05 gen2fish

@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!

bedaes avatar Jun 15 '24 18:06 bedaes

@gen2fish @bedaes I've given this some more thought and I realize that the reason that this is happening is a holdover behavior that was subsequently changed in SteamPrefill and EpicPrefill. Both of the other prefills track which apps are up to date in their /Config dir, while BattlenetPrefill is still storing it in it's /Cache dir. When I get a few minutes I'll update BattlenetPrefill to point to the correct directory and get a fix pushed up.

tpill90 avatar Aug 28 '24 17:08 tpill90