services:
  db:
    image: mariadb:latest
    restart: always
    command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW --log_bin_trust_function_creators=true
    volumes:
      - /srv/dev-disk-by-uuid-9033ccb2-df6d-46a3-9996-99a0d4d34688/nextcloud/database:/var/lib/mysql:Z
#      - ./database:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=rootpw
      - MYSQL_PASSWORD=password
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
    ports:
      - 3306:3306

  aio-imaginary:
    image: ghcr.io/nextcloud-releases/aio-imaginary:latest
    restart: always
    environment:
      - PORT=9000
    ports:
      - 9999:9000
    command: -enable-url-source -enable-placeholder
    cap_add:
      - SYS_NICE

  nextcloud:
    build:
      context: ./nc
      args:
        UID: ${MUID}
        GID: ${MGID}
    restart: always
    ports:
      - 8888:80
    links:
      - db
    volumes:
      - /srv/dev-disk-by-uuid-9033ccb2-df6d-46a3-9996-99a0d4d34688/nextcloud/home:/var/www/html:z
#      - ./nchome:/var/www/html
      - /srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/nextcloud_storage:/var/www/html/data
#      - ./ncdata:/var/www/html/data
      - /srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/:/ex_storage/
      - /srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/bands/fearium:/ex_storage/bands/fearium
      - /srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/bands/breakpointnine:/ex_storage/bands/breakpointnine
      - /srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/bands/lastfloorright:/ex_storage/bands/lastfloorright
      - /srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/bands/nofunkallowed:/ex_storage/bands/nofunkallowed
      - /srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/music:/ex_storage/music
      - /srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/video:/ex_storage/video
      - /srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/repositories:/ex_storage/repositories
      - /srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/hwsw:/ex_storage/hwsw
      - /srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/timelapse:/ex_storage/timelapse
      - /srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/daf2000:/ex_storage/daf2000


    environment:
      - MYSQL_PASSWORD=password
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_HOST=db
      - REDIS_HOST=redis

  collabora:
    image: collabora/code:latest
    restart: unless-stopped
    environment:
      - password=password 
      - username=nextcloud
      - domain=mitscherlich.nl
      - extra_params=--o:ssl.enable=true
    ports:
      - 9980:9980


  redis:
    build:
      context: ./redis
      args:
        UID: ${MUID}
        GID: ${MGID}
    restart: always

  cron:
    build:
      context: ./nc
      args:
        UID: ${MUID}
        GID: ${MGID}
    restart: always
    links:
      - db
    volumes:
      - /srv/dev-disk-by-uuid-9033ccb2-df6d-46a3-9996-99a0d4d34688/nextcloud/home:/var/www/html:z
#      - ./nchome:/var/www/html
      - /srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/nextcloud_storage:/var/www/html/data
#      - ./ncdata:/var/www/html/data
      - /srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/:/ex_storage/
      - /srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/bands/fearium:/ex_storage/bands/fearium
      - /srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/bands/breakpointnine:/ex_storage/bands/breakpointnine
      - /srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/bands/lastfloorright:/ex_storage/bands/lastfloorright
      - /srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/bands/nofunkallowed:/ex_storage/bands/nofunkallowed
      - /srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/music:/ex_storage/music
      - /srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/video:/ex_storage/video
      - /srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/repositories:/ex_storage/repositories
      - /srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/hwsw:/ex_storage/hwsw
      - /srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/timelapse:/ex_storage/timelapse
      - /srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/daf2000:/ex_storage/daf2000

    environment:
      - MYSQL_PASSWORD=password
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_HOST=db
      - REDIS_HOST=redis
    entrypoint: /cron.sh
    depends_on:
      - nextcloud

