jaymoulin / docker-jdownloader

JDownloader 2 Docker Image (Multiarch) - 50M+ Downloads
https://brands.jaymoulin.me/me/docker-jdownloader
MIT License
180 stars 36 forks source link

Use app folder for main JDownloader files #102

Closed egvimo closed 2 years ago

egvimo commented 2 years ago

This PR moves the main app to a separate folder (app). This way this directory can be mounted as a volume which persists the data after an update.

THIS IS A BREAKING CHANGE! Because of the extra directory layer the mounts has to be changed.

I've created an image and tested this on my Kubernetes cluster. A small example for a pod:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: jdownloader
  labels:
    app: jdownloader
spec:
  replicas: 1
  selector:
    matchLabels:
      app: jdownloader
  template:
    metadata:
      labels:
        app: jdownloader
    spec:
      containers:
        - name: jdownloader
          image: jaymoulin/jdownloader
          env:
            - name: MYJD_USER
              value: "email@email.com"
            - name: MYJD_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: my_jd_secret
                  key: password
          volumeMounts:
            - mountPath: /opt/JDownloader/app
              name: exec
            - mountPath: /opt/JDownloader/app/cfg
              name: cfg
            - mountPath: /opt/JDownloader/Downloads
              name: downloads
      volumes:
        - name: exec
          emptyDir: {}
        - name: cfg
          hostPath:
            path: /path/to/jd/cfg
            type: Directory
        - name: downloads
          hostPath:
            path: /path/to/downloads
            type: Directory

Fixes: https://github.com/jaymoulin/docker-jdownloader/issues/94, https://github.com/jaymoulin/docker-jdownloader/issues/91, https://github.com/jaymoulin/docker-jdownloader/issues/82 and maybe other related.

jaymoulin commented 2 years ago

related #94

egvimo commented 2 years ago

If you accept this PR, I can update the readme file, too.

I also can change the paths and names if you think others are better suited. They were just my preference.

jaymoulin commented 2 years ago

@egvimo thank you for your contribution.

This is an effective implementation of https://github.com/jaymoulin/docker-jdownloader/issues/94#issuecomment-878397718 (which is still waiting for vote BTW) but I think it could have been easier.

Yes please change the README.md as everything must be related in the same commit. IMHO implementing only the exec subfolder + cp in config.sh would ease review, bug avoiding, documentation maintaining and understanding for migrating users. (even if I checked, I could have missed some behaviours).

egvimo commented 2 years ago

@jaymoulin You're right. I've reverted all my preferences and optimizations. Now only the new exec folder is included. Everything else can be done separately.

egvimo commented 2 years ago

After some thoughts I think app would be a better choice for the folder. What do you think?

egvimo commented 2 years ago

I've changed the folder to app and updated everything accordingly. And I updated the K8s example with everything necessary to run the app.