coollabsio / coolify

An open-source & self-hostable Heroku / Netlify / Vercel alternative.
https://coolify.io
Apache License 2.0
34.83k stars 1.91k forks source link

[Bug]: Docker Compose file removes the mounted SMB shares #2323

Open SpuriousGer opened 6 months ago

SpuriousGer commented 6 months ago

Description

I have the following Docker Compose file where I would expect the SMB shares to be mounted but instead they are not mounted and other shares are created:

version: '3.8'
services:
  broker:
    image: 'docker.io/library/redis:7'
    restart: unless-stopped
    volumes:
      - 'redisdata:/data'
  db:
    image: 'docker.io/library/postgres:15'
    restart: unless-stopped
    volumes:
      - 'pgdata:/var/lib/postgresql/data'
    environment:
      POSTGRES_DB: paperless
      POSTGRES_USER: paperless
      POSTGRES_PASSWORD: paperless
  webserver:
    image: 'ghcr.io/paperless-ngx/paperless-ngx:latest'
    restart: unless-stopped
    depends_on:
      - db
      - broker
    ports:
      - '9001:8000'
    volumes:
      - 'smb_data:/usr/src/paperless/data'
      - 'smb_media:/usr/src/paperless/media'
      - 'smb_export:/usr/src/paperless/export'
      - 'smb_consume:/usr/src/paperless/consume'
    environment:
      PAPERLESS_REDIS: 'redis://broker:6379'
      PAPERLESS_DBHOST: db
      PAPERLESS_CONSUMER_RECURSIVE: 'true'
      PAPERLESS_URL: 'https://paperless.paperless.io'
      PAPERLESS_FILENAME_FORMAT: '{created_year}{created_month}/{correspondent}{title}_{created_year}{created_month}{created_day}'
      PAPERLESS_SECRET_KEY: 'sdfhaskjdfhasjdfhasljk'
      PAPERLESS_CONSUMER_BARCODE_UPSCALE: 1.5
      PAPERLESS_CONSUMER_BARCODE_DPI: 600
      PAPERLESS_CONSUMER_ENABLE_BARCODES: 'true'
      PAPERLESS_CONSUMER_ENABLE_TAG_BARCODE: 'true'
      PAPERLESS_CONSUMER_TAG_BARCODE_MAPPING: '{"[a-fA-F0-9]{64}": "\g<0>"}'
      PAPERLESS_CONSUMER_BARCODE_SCANNER: ZXING
      PAPERLESS_CONSUMER_SUBDIRS_AS_TAGS: true
    user: '0:0'
    cap_add:
      - SYS_ADMIN
      - DAC_READ_SEARCH
    privileged: true
volumes:
  smb_data:
    driver: local
    driver_opts:
      type: cifs
      device: //10.10.10.11/paperless-data
      o: 'username=smbtest,password=smbtest,vers=3.0,uid=0,gid=0,dir_mode=0777,file_mode=0777'
  smb_media:
    driver: local
    driver_opts:
      type: cifs
      device: //10.10.10.11/paperless-media
      o: 'username=smbtest,password=smbtest,vers=3.0,uid=0,gid=0,dir_mode=0777,file_mode=0777'
  smb_export:
    driver: local
    driver_opts:
      type: cifs
      device: //10.10.10.11/paperless-export
      o: 'username=smbtest,password=smbtest,vers=3.0,uid=0,gid=0,dir_mode=0777,file_mode=0777'
  smb_consume:
    driver: local
    driver_opts:
      type: cifs
      device: //10.10.10.11/paperless-consume
      o: 'username=smbtest,password=smbtest,vers=3.0,uid=0,gid=0,dir_mode=0777,file_mode=0777'
  pgdata: null
  redisdata: null

This is then converted to this deployable Compose and I have no clue why this happens:

services:
  broker:
    image: 'docker.io/library/redis:7'
    restart: unless-stopped
    volumes:
      - 'swgksgw_redisdata:/data'
    networks:
      swgksgw: null
    labels:
      - coolify.managed=true
      - coolify.version=4.0.0-beta.291
      - coolify.serviceId=3
      - coolify.type=service
      - coolify.name=broker-swgksgw
      - coolify.pullRequestId=0
      - coolify.service.subId=7
      - coolify.service.subType=application
    container_name: broker-swgksgw
  db:
    image: 'docker.io/library/postgres:15'
    restart: unless-stopped
    volumes:
      - 'swgksgw_pgdata:/var/lib/postgresql/data'
    environment:
      POSTGRES_DB: paperless
      POSTGRES_USER: paperless
      POSTGRES_PASSWORD: paperless
    networks:
      swgksgw: null
    labels:
      - coolify.managed=true
      - coolify.version=4.0.0-beta.291
      - coolify.serviceId=3
      - coolify.type=service
      - coolify.name=db-swgksgw
      - coolify.pullRequestId=0
      - coolify.service.subId=8
      - coolify.service.subType=application
    container_name: db-swgksgw
  webserver:
    image: 'ghcr.io/paperless-ngx/paperless-ngx:latest'
    restart: unless-stopped
    depends_on:
      - db
      - broker
    ports:
      - '9001:8000'
    volumes:
      - 'swgksgw_smb-data:/usr/src/paperless/data'
      - 'swgksgw_smb-media:/usr/src/paperless/media'
      - 'swgksgw_smb-export:/usr/src/paperless/export'
      - 'swgksgw_smb-consume:/usr/src/paperless/consume'
    environment:
      PAPERLESS_REDIS: 'redis://broker:6379'
      PAPERLESS_DBHOST: db
      PAPERLESS_CONSUMER_RECURSIVE: 'true'
      PAPERLESS_URL: 'https://paperless.paperless.io'
      PAPERLESS_FILENAME_FORMAT: '{created_year}{created_month}/{correspondent}{title}_{created_year}{created_month}{created_day}'
      PAPERLESS_SECRET_KEY: 'sdfhaskjdfhasjdfhasljk'
      PAPERLESS_CONSUMER_BARCODE_UPSCALE: 1.5
      PAPERLESS_CONSUMER_BARCODE_DPI: 600
      PAPERLESS_CONSUMER_ENABLE_BARCODES: 'true'
      PAPERLESS_CONSUMER_ENABLE_TAG_BARCODE: 'true'
      PAPERLESS_CONSUMER_TAG_BARCODE_MAPPING: '{"[a-fA-F0-9]{64}": "\g<0>"}'
      PAPERLESS_CONSUMER_BARCODE_SCANNER: ZXING
      PAPERLESS_CONSUMER_SUBDIRS_AS_TAGS: true
    user: '0:0'
    cap_add:
      - SYS_ADMIN
      - DAC_READ_SEARCH
    privileged: true
    networks:
      swgksgw: null
    labels:
      - coolify.managed=true
      - coolify.version=4.0.0-beta.291
      - coolify.serviceId=3
      - coolify.type=service
      - coolify.name=webserver-swgksgw
      - coolify.pullRequestId=0
      - coolify.service.subId=9
      - coolify.service.subType=application
    container_name: webserver-swgksgw
volumes:
  smb_data:
    driver: local
    driver_opts:
      type: cifs
      device: //10.10.10.11/paperless-data
      o: 'username=smbtest,password=smbtest,vers=3.0,uid=0,gid=0,dir_mode=0777,file_mode=0777'
  smb_media:
    driver: local
    driver_opts:
      type: cifs
      device: //10.10.10.11/paperless-media
      o: 'username=smbtest,password=smbtest,vers=3.0,uid=0,gid=0,dir_mode=0777,file_mode=0777'
  smb_export:
    driver: local
    driver_opts:
      type: cifs
      device: //10.10.10.11/paperless-export
      o: 'username=smbtest,password=smbtest,vers=3.0,uid=0,gid=0,dir_mode=0777,file_mode=0777'
  smb_consume:
    driver: local
    driver_opts:
      type: cifs
      device: //10.10.10.11/paperless-consume
      o: 'username=smbtest,password=smbtest,vers=3.0,uid=0,gid=0,dir_mode=0777,file_mode=0777'
  pgdata: null
  redisdata: null
  swgksgw_redisdata:
    name: swgksgw_redisdata
  swgksgw_pgdata:
    name: swgksgw_pgdata
  swgksgw_smb-data:
    name: swgksgw_smb-data
  swgksgw_smb-media:
    name: swgksgw_smb-media
  swgksgw_smb-export:
    name: swgksgw_smb-export
  swgksgw_smb-consume:
    name: swgksgw_smb-consume
networks:
  swgksgw:
    name: swgksgw
    external: true

I can mount it if I run it locally not through Coolify. This seems to be weird.

Also, why can I not change the storages here:

image

Minimal Reproduction (if possible, example repository)

Use the Docker Compose file I have above and paste it in a new resource based on Docker Compose.

Exception or Error

No errors occur, but the share it not mounted.

Version

v4.0.0-beta.291

andrasbacsai commented 6 months ago

It will be fixed in the upcoming version.

SpuriousGer commented 6 months ago

Excellent, thank you very much!

siavashs commented 2 months ago

I'm hitting a similar issue but with nfs mounts. It seems the issue is not fixed. Tested on v4.0.0-beta.323 The volumes are ignored and instead new empty volumes are created under Deployable Compose.

devwearsprada commented 1 month ago

I'm also still having this issue. Running Coolify v4.0.0-beta.360. Excerpt of my docker-compose.yaml:

services:
  backend:
    build:
      context: .
    container_name: backend
    volumes:
      - nfs_images:/app/images
    ports:
      - 9000:9000
    restart: unless-stopped

volumes:
  nfs_images:
    driver: local
    driver_opts:
      type: nfs
      o: addr=${NFS_SERVER_IP},rw,vers=4.1
      device: ":${NFS_DEVICE}"

Logs from the resource deployment:

2024-Oct-28 14:35:57.639960 Oops something is not okay, are you okay? 😢
2024-Oct-28 14:35:57.646766 Volume "z4soo0gc00sgs8o4gkwckoco_nfs_images"  Creating
2024-Oct-28 14:35:57.646766  Volume "z4soo0gc00sgs8o4gkwckoco_nfs_images"  Created
2024-Oct-28 14:35:57.646766  Container backend-z4soo0gc00sgs8o4gkwckoco-143147453254  Creating
2024-Oct-28 14:35:57.646766 Error response from daemon: failed to populate volume: error while mounting volume '/var/lib/docker/volumes/z4soo0gc00sgs8o4gkwckoco_nfs_images/_data': failed to mount local volume: mount :/mnt/data:/var/lib/docker/volumes/z4soo0gc00sgs8o4gkwckoco_nfs_images/_data, data: addr=xx.xx.xx.xxx: operation not permitted 

It seems like Coolify is still making a volume after detecting a nfs mount and using that in combination with the o and device values defined in the docker-compose.yaml.

scob7 commented 2 days ago

I am also having an issue with nfs mounts using docker compose. Wasted hours going in circles trying to find errors and checking permissions but it appears coolify is just stripping the reference to the volume in my service from the deployable compose file for some reason.

Version: v4.0.0-beta.370