version: '2'

volumes:
  #  nextcloud:
  db:

services:
  db:
    image: mariadb
    container_name: db
    restart: always
    #command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    command: --innodb-read-only-compressed=OFF
    volumes:
      - db:/var/lib/mysql
    networks:
      - nxc-db
    environment:
      - MYSQL_ROOT_PASSWORD=blabla
      - MYSQL_PASSWORD=blabla
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud

  nxc:
    image: nextcloud
    restart: always
    container_name: nxc
#    ports:
#      - 8080:80
#    links:
    depends_on:
      - db
    volumes:
      - ./nextcloud:/var/www/html
    environment:
      - MYSQL_PASSWORD=blabla
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_HOST=db
    labels:
      # Enable this container to be mapped by traefik
      # For more information, see: https://docs.traefik.io/providers/docker/#exposedbydefault
      - "traefik.enable=true"
      # URL to reach this container
      - "traefik.http.routers.nxc.rule=Host(`s-nxc.gsb.lan`)"
      # Activation of TLS
      - "traefik.http.routers.nxc.tls=true"
      # If port is different than 80, use the following service:
      #-  "traefik.http.services.<service_name>.loadbalancer.server.port=<port>"
      #      -  "traefik.http.services.app.loadbalancer.server.port=8080"
    networks:
      - proxy
      - nxc-db
networks:
  proxy:
    external: true
  nxc-db:
    external: false