Librum-Reader / Librum-Server

The Librum server
https://librumreader.com
GNU Affero General Public License v3.0
302 stars 22 forks source link

Docker install won't start with error "Access denied for user 'librum'@'localhost'" #37

Open goaliedude3919 opened 4 months ago

goaliedude3919 commented 4 months ago

docker-compose file

Logs

Lipown commented 3 months ago

Same here :/

benooye commented 3 months ago

Wanted to give Librum a try, it looks very interesting, but same error here also

paulcsiki commented 2 months ago

I've had a similar issue with Kubernetes and I've added an init-container to chmod it like this:

    spec:
      volumes:
        - name: data
          persistentVolumeClaim:
            claimName: librum-pvc
      initContainers:
        - name: init-storage
          image: busybox:latest
          command:
            - sh
            - '-c'
            - mkdir -p /vol-path && chmod -R 777 /vol-path
          resources:
            limits:
              cpu: '1'
              memory: 1Gi
          volumeMounts:
            - name: data
              mountPath: /vol-path
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: Always
abdessalaam commented 2 months ago

I still have this issue. I don't use kubernetes so I tried to implement @paulcsiki paulcsiki solution via vanilla docker compose, but to no avail...

# Init service to chmod the volume
  init-storage:
    image: busybox:latest
    command: sh -c "mkdir -p /vol-path && chmod -R 777 /vol-path"
    volumes:
      - data:/vol-path
    deploy:
      resources:
        limits:
          cpus: "1"
          memory: 1G
    restart: "no" 
goaliedude3919 commented 2 months ago

I've had a similar issue with Kubernetes and I've added an init-container to chmod it like this:

    spec:
      volumes:
        - name: data
          persistentVolumeClaim:
            claimName: librum-pvc
      initContainers:
        - name: init-storage
          image: busybox:latest
          command:
            - sh
            - '-c'
            - mkdir -p /vol-path && chmod -R 777 /vol-path
          resources:
            limits:
              cpu: '1'
              memory: 1Gi
          volumeMounts:
            - name: data
              mountPath: /vol-path
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: Always

As someone who's not super well versed in docker, is that something that you added on top of your existing compose file? What exactly would should my docker compose file look like when trying this?

swonky commented 2 weeks ago

I worked out one of the issues here. The file permission issue is due to using a bind mount instead of docker volumes. The container executes commands using a non-root uid and gid that doesn't match the docker user, so if you want to use a bind mount then you need to manually set the ownership of the server's storage directory to uid=999 and gid=999 before running the container. eg:

chown -R 999:999 /opt/apps/librum

It looks like you also have a database login issue as well though. Are the credentials in your docker-compose file the ones you actually used? Or are they placeholders?