version: "3"

services:

  redis:

    image: redis:7.0.10
    restart: always
    networks:
      - default


  mysql:

    image: mariadb:10.10.2
    restart: always
    volumes:
      - /srv/nextcloud/db/:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: "{{ mysql_admin_pass }}"
      MYSQL_PASSWORD: "{{ mysql_user_pass }}"
      MYSQL_DATABASE: nextcloud
      MYSQL_USER: nextcloud
    networks:
      - default


  app:

    image: nextcloud:25.0.5-apache
    restart: always
    volumes:
      - /srv/nextcloud/data/:/var/www/html/
      - /srv/nextcloud/tmp/:/tmp/nextcloudtemp/
      - /srv/nextcloud/memory-limit.ini:/usr/local/etc/php/conf.d/memory-limit.ini:ro
      - /srv/jameica-vnc/work/:/jameica-work/
    environment:
      REDIS_HOST: redis
      MYSQL_DATABASE: nextcloud
      MYSQL_USER: nextcloud
      MYSQL_PASSWORD: "{{ mysql_user_pass }}"
      MYSQL_HOST: mysql
      NEXTCLOUD_ADMIN_USER: "admin"
      NEXTCLOUD_ADMIN_PASSWORD: "{{nextcloud_admin_pass}}"
    labels:
      - traefik.enable=true
      - traefik.http.routers.{{ servicename }}.rule=Host(`{{ domain }}`)
      - traefik.http.routers.{{ servicename }}.entrypoints=websecure
      - traefik.http.services.{{ servicename }}.loadbalancer.server.port=80 
    networks:
      - default      
      - web  
    

  webcron:
    
    image: jsonfry/curl-cron:latest 
    restart: always
    depends_on:
      - app
    environment:
      OPTIONS: "--insecure https://{{ domain }}/cron.php"
      CRON_SCHEDULE: "*/5 * * * *"
    networks:
      - default


networks:
  web:
    external: true    
