version: "3"

volumes:
  nchome:
    driver: local
    driver_opts:
      type: none
      o: bind
      device: /srv/dev-disk-by-uuid-9033ccb2-df6d-46a3-9996-99a0d4d34688/nextcloud/home
  ncdb:
    driver: local
    driver_opts:
      type: none
      o: bind
      device: /srv/dev-disk-by-uuid-9033ccb2-df6d-46a3-9996-99a0d4d34688/nextcloud/database
  ncdata:
    driver: local
    driver_opts:
      type: none
      o: bind
      device: /srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/nextcloud/storage


services:
  db:
    image: mariadb:10.6
    restart: always
    command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
    volumes:
      - ncdb:/var/lib/mysql:Z
    environment:
      - MYSQL_ROOT_PASSWORD=rootpw
      - MYSQL_PASSWORD=password
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud

  aio-imaginary:
    image: nextcloud/aio-imaginary:latest
    restart: always
    environment:
      - PORT=9000
    ports:
      - 9999:9000
    command: -concurrency 50 -enable-url-source 

  nextcloud:
    build: 
      context: ./nc-fpm
      args: 
        UID: ${MUID} 
        GID: ${MGID} 
    restart: always
    links:
      - db
    volumes:
      - nchome:/var/www/html:z
      - 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/pictures:/ex_storage/pictures

    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
#      - extra_params=--o:ssl.enable=true
#    ports:
#      - 9980:9980


  nginx:
    build: 
      context: ./nginx
      args:
        UID: ${MUID}
        GID: ${MGID}
    restart: always
    ports:
      - 8888:80
    links:
      - nextcloud
    volumes:
      - nchome:/var/www/html:z,ro

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

  cron:
    build:
      context: ./nc-fpm
      args:
        UID: ${MUID}
        GID: ${MGID}
    restart: always
    volumes:
      - nchome:/var/www/html:z
      - 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/pictures:/ex_storage/pictures

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

