# Configuration for nextcloud-smb setup

# Name of the big-bear-nextcloud-smb application
name: big-bear-nextcloud-smb
# Service definitions for the big-bear-nextcloud-smb application
services:
  # Service name: app
  # The `app` service definition
  big-bear-nextcloud-smb:
    # Define the container name
    container_name: big-bear-nextcloud-smb
    # Use the nextcloud image from the official Docker Hub
    image: bigbeartechworld/big-bear-nextcloud-with-smbclient:33.0.5
    # Restart the container unless stopped
    restart: unless-stopped
    # Map port 7580 on the host to port 80 on the container
    ports:
      - 7580:80
    # Mount the nextcloud-with-smbclient_html directory on the host to /var/www/html in the container
    volumes:
      - /DATA/AppData/$AppID/html:/var/www/html
    # Set environment variables for the container
    environment:
      - POSTGRES_HOST=big-bear-nextcloud-smb-db
      - REDIS_HOST=big-bear-nextcloud-smb-redis
      - POSTGRES_PASSWORD=casaos
      - POSTGRES_USER=casaos
      - POSTGRES_DB=nextcloud
      - NEXTCLOUD_ADMIN_USER=casaos
      - NEXTCLOUD_ADMIN_PASSWORD=casaos
      - TRUSTED_PROXIES=
      - OVERWRITEPROTOCOL=http
      - PHP_MEMORY_LIMIT=1024M
      - PHP_UPLOAD_LIMIT=1024M
    # Specify the dependencies
    depends_on:
      big-bear-nextcloud-smb-db:
        condition: service_healthy
      big-bear-nextcloud-smb-redis:
        condition: service_healthy
    # Define the network
    networks:
      - big_bear_nextcloud_network
    x-casaos:
      envs:
        - container: POSTGRES_HOST
          description:
            en_us: 'Container Variable: POSTGRES_HOST'
        - container: REDIS_HOST
          description:
            en_us: 'Container Variable: REDIS_HOST'
        - container: POSTGRES_PASSWORD
          description:
            en_us: 'Container Variable: POSTGRES_PASSWORD'
        - container: POSTGRES_USER
          description:
            en_us: 'Container Variable: POSTGRES_USER'
        - container: POSTGRES_DB
          description:
            en_us: 'Container Variable: POSTGRES_DB'
        - container: NEXTCLOUD_ADMIN_USER
          description:
            en_us: 'Container Variable: NEXTCLOUD_ADMIN_USER'
        - container: NEXTCLOUD_ADMIN_PASSWORD
          description:
            en_us: 'Container Variable: NEXTCLOUD_ADMIN_PASSWORD'
        - container: TRUSTED_PROXIES
          description:
            en_us: 'Container Variable: TRUSTED_PROXIES'
        - container: OVERWRITEPROTOCOL
          description:
            en_us: 'Container Variable: OVERWRITEPROTOCOL'
        - container: PHP_MEMORY_LIMIT
          description:
            en_us: 'Container Variable: PHP_MEMORY_LIMIT'
        - container: PHP_UPLOAD_LIMIT
          description:
            en_us: 'Container Variable: PHP_UPLOAD_LIMIT'
      volumes:
        - container: /var/www/html
          description:
            en_us: 'Container Path: /var/www/html'
      ports:
        - container: "80"
          description:
            en_us: 'Container Port: 80'
  # Define the database container for Nextcloud
  big-bear-nextcloud-smb-db:
    container_name: big-bear-nextcloud-smb-db
    image: postgres:14.2
    restart: unless-stopped
    volumes:
      - /DATA/AppData/$AppID/pgdata:/var/lib/postgresql/data # Mount the PostgreSQL data directory
    environment:
      - POSTGRES_PASSWORD=casaos # Set the PostgreSQL password
      - POSTGRES_USER=casaos # Set the PostgreSQL username
      - POSTGRES_DB=nextcloud # Set the name of the Nextcloud database
    networks:
      - big_bear_nextcloud_network # Connect to the Nextcloud network
    # Healthcheck configuration for the database service
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U casaos -d nextcloud"]
      interval: 10s
      timeout: 5s
      retries: 5
    x-casaos:
      envs:
        - container: POSTGRES_PASSWORD
          description:
            en_us: 'Container Variable: POSTGRES_PASSWORD'
        - container: POSTGRES_USER
          description:
            en_us: 'Container Variable: POSTGRES_USER'
        - container: POSTGRES_DB
          description:
            en_us: 'Container Variable: POSTGRES_DB'
      volumes:
        - container: /var/lib/postgresql/data
          description:
            en_us: 'Container Path: /var/lib/postgresql/data'
  # Redis configuration for Nextcloud
  big-bear-nextcloud-smb-redis:
    container_name: big-bear-nextcloud-smb-redis
    user: "1000:1000"
    image: redis:6.2.20@sha256:d06ff6ec778c7f2a5c0dfaf58141d598efaa50a89d0e966faedfdf122cef451b
    restart: on-failure
    volumes:
      - "/DATA/AppData/$AppID/redis:/data" # Mount the Redis data directory
    networks:
      - big_bear_nextcloud_network # Connect to the Nextcloud network
    # Healthcheck configuration for the Redis service
    healthcheck:
      test: ["CMD-SHELL", "redis-cli ping || exit 1"]
      interval: 10s
      timeout: 5s
      retries: 5
    x-casaos:
      volumes:
        - container: /data
          description:
            en_us: 'Container Path: /data'
  big-bear-nextcloud-smb-cron:
    container_name: big-bear-nextcloud-smb-cron
    image: bigbeartechworld/big-bear-nextcloud-with-smbclient:33.0.5
    restart: on-failure
    volumes:
      - /DATA/AppData/$AppID/html:/var/www/html
    entrypoint: /cron.sh
    # Specify the dependencies
    depends_on:
      big-bear-nextcloud-smb-db:
        condition: service_healthy
      big-bear-nextcloud-smb-redis:
        condition: service_healthy
    networks:
      - big_bear_nextcloud_network # Connect to the Nextcloud network
    x-casaos:
      volumes:
        - container: /var/www/html
          description:
            en_us: 'Container Path: /var/www/html'
# Network definition for the big-bear-nextcloud application
networks:
  big_bear_nextcloud_network:
    driver: bridge
x-casaos:
  # Supported CPU architectures for this application
  architectures:
    - amd64
    - arm64
  # Main service for this application
  main: big-bear-nextcloud-smb
  # Detailed description for the application
  description:
    en_us: This is legacy and you should use the BigBearCasaOS Nextcloud instead. Nextcloud puts your data at your fingertips, under your control. Store your documents, calendar, contacts and photos on a server at home, at one of our providers or in a data center you trust.
  # Screenshot links for the application
  screenshot_link:
    - https://cdn.jsdelivr.net/gh/IceWhaleTech/CasaOS-AppStore@main/Apps/Nextcloud/screenshot-1.png
    - https://cdn.jsdelivr.net/gh/IceWhaleTech/CasaOS-AppStore@main/Apps/Nextcloud/screenshot-2.png
    - https://cdn.jsdelivr.net/gh/IceWhaleTech/CasaOS-AppStore@main/Apps/Nextcloud/screenshot-3.png
  # Brief tagline for the application
  tagline:
    en_us: The productivity platform that keeps you in control
  # Developer's information
  developer: nextcloud
  # Author of this particular configuration
  author: BigBearTechWorld
  # Icon URL for the application
  icon: https://cdn.jsdelivr.net/gh/selfhst/icons/png/nextcloud.png
  # Thumbnail image for the application (if any)
  thumbnail: https://cdn.jsdelivr.net/gh/IceWhaleTech/CasaOS-AppStore@main/Apps/Nextcloud/thumbnail.jpg
  # Installation tips
  tips:
    before_install:
      en_us: |
        Read the [Nextcloud installation guide](https://community.bigbeartechworld.com/t/added-nextcloud-to-bigbearcasaos/455?u=dragonfire1119)
  # Title for the application
  title:
    en_us: Nextcloud with SMB (Legacy)
  # Category under which the application falls
  category: BigBearCasaOS
  # Default port mapping for the application
  port_map: "7580"
