Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Problem]: Container does not start with NFS mount #509

Open
crosenbe opened this issue Jan 5, 2025 · 2 comments
Open

[Problem]: Container does not start with NFS mount #509

crosenbe opened this issue Jan 5, 2025 · 2 comments

Comments

@crosenbe
Copy link

crosenbe commented Jan 5, 2025

Description / Beschreibung

If the container will be configured with a NFS path to store backups before ioBroker was initially started data are detected and the installation stops. There are two workarounds.

  1. Mount the NFS after the initialization.
  2. Change the kind how data are detected.

Inside the container the function copy backup to NAS does not work because rpc-statd is missing, the NFS mount inside of the container does not work. Mounting the backup folder via NFS as a volume solve this problem, but with the limitation described above.

Maybe following change can be a potential solution ...

if [[ find /opt/iobroker -type f -maxdepth 1 | wc -l -lt 1 ]]; then

Kubernetes YAML

apiVersion: apps/v1
kind: Deployment
metadata:
  name: iobroker
  namespace: home
spec:
  selector:
    matchLabels:
      app: iobroker
  replicas: 1
  template:
    metadata:
      name: iobroker
      labels:
        app: iobroker
    spec:
      securityContext:
        runAsUser: 0
        runAsGroup: 0
        fsGroup: 0
      hostname: iobroker
      containers:
        - name: iobroker
          image: buanet/iobroker:latest-v10
          resources:
            requests:
              memory: "500Mi"
              cpu: "50m"
            limits:
              memory: "500Mi"
              cpu: "500m"
          ports:
            - containerPort: 8081 # admin
            - containerPort: 8087 # SimpleAPI SSL
            - containerPort: 8089 # SimpleAPI
            - containerPort: 8091 # Backup Web
            - containerPort: 9081 # Backup Download
            - containerPort: 9082 # Backup Upload
          livenessProbe:
            exec:
              command:
                - sh
                - -c
                - '[ -f "/tmp/liveness-status" ] || curl -k -f https://localhost:8081/status >/dev/null 2>&1'
            initialDelaySeconds: 600 
            periodSeconds: 10
            timeoutSeconds: 5
            failureThreshold: 40 
          env:
          env:
            - name: TZ
              value: Europe/Berlin
          volumeMounts:
            - name: iobroker-data
              mountPath: /opt/iobroker
            - name: iobroker-backup
              mountPath: /opt/iobroker/backups
          securityContext:
            appArmorProfile:
              type: Unconfined
            capabilities:
              add:
                - SYS_ADMIN
            privileged: true
      volumes:
        - name: iobroker-data
          persistentVolumeClaim:
            claimName: iobroker-data-pvc
        - name: iobroker-backup
          nfs:
            server: 10.10.10.10
            path: /iobroker_backup

Image version

:latest-v10

Docker logs / Docker Protokoll

n/a
@Marc-Berg
Copy link

Marc-Berg commented Jan 16, 2025

Inside the container the function copy backup to NAS does not work because rpc-statd is missing, the NFS mount inside of the container does not work. Mounting the backup folder via NFS as a volume solve this problem, but with the limitation described above.

You have to start the Container in privileged mode for the NFS mount to work. Apart from that, I would also find it helpful to exclude the /opt/iobroker/backups folder from the “DetectData” function.

@buanet
Copy link
Owner

buanet commented Jan 16, 2025

I don’t quite understand this. This should only be an issue when starting with a new ioBroker instance.
As long as an existing instance of ioBroker is located in /opt/iobroker, there shouldn’t be any problems.

Could you please clarify the exact scenario where this becomes an issue?

Apart from that, I would also find it helpful to exclude the /opt/iobroker/backups folder from the “DetectData” function.

As far as I recall, the script checks for existing data in /opt/iobroker to ensure nothing gets overwritten when restoring the initial ioBroker setup to the mounted volume or folder.

That said, mounting anything into /opt/iobroker is not a good practice. This directory is meant for the program files and should not be altered by users.

Regards,
André

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants