# Configuration for owncloud setup

# Name of the big-bear-owncloud application
name: big-bear-owncloud
# Service definitions for the big-bear-owncloud application
services:
  # Service name: big-bear-owncloud
  # The `big-bear-owncloud` service definition
  big-bear-owncloud:
    # Name of the container
    container_name: big-bear-owncloud
    # Image to be used for the container
    image: owncloud/server:10.16.3
    # Container restart policy
    restart: unless-stopped
    # Environment variables
    environment:
      - OWNCLOUD_DOMAIN=http://[YOUR_CASAOS_IP]:8080
      - OWNCLOUD_TRUSTED_DOMAINS=[YOUR_CASAOS_IP]
      - OWNCLOUD_DB_TYPE=mysql
      - OWNCLOUD_DB_NAME=big_bear_owncloud
      - OWNCLOUD_DB_USERNAME=bigbear
      - OWNCLOUD_DB_PASSWORD=f01914eb-2be3-4164-a57c-08e6518f313a
      - OWNCLOUD_DB_HOST=big-bear-owncloud-db
      - OWNCLOUD_ADMIN_USERNAME=bigbear
      - OWNCLOUD_ADMIN_PASSWORD=ed135299-7c80-48d4-a2a0-357a012213e5
      - OWNCLOUD_MYSQL_UTF8MB4=true
      - OWNCLOUD_REDIS_ENABLED=true
      - OWNCLOUD_REDIS_HOST=big-bear-owncloud-redis
    # Volumes to be mounted to the container
    volumes:
      # Mounting the local owncloud_data directory to /mnt/data inside the container
      - /DATA/AppData/$AppID/data:/mnt/data
    # Ports mapping between host and container
    ports:
      # Mapping port 8080 of the host to port 8080 of the container
      - "8080:8080"
    # Networks to be attached to the container
    networks:
      - big_bear_owncloud_network
    # Healthcheck configuration for the service
    healthcheck:
      test: ["CMD", "/usr/bin/healthcheck"]
      interval: 30s
      timeout: 10s
      retries: 5
    depends_on:
      - big-bear-owncloud-db
      - big-bear-owncloud-redis
    x-casaos:
      envs:
        - container: OWNCLOUD_DOMAIN
          description:
            en_us: 'Container Variable: OWNCLOUD_DOMAIN'
        - container: OWNCLOUD_TRUSTED_DOMAINS
          description:
            en_us: 'Container Variable: OWNCLOUD_TRUSTED_DOMAINS'
        - container: OWNCLOUD_DB_TYPE
          description:
            en_us: 'Container Variable: OWNCLOUD_DB_TYPE'
        - container: OWNCLOUD_DB_NAME
          description:
            en_us: 'Container Variable: OWNCLOUD_DB_NAME'
        - container: OWNCLOUD_DB_USERNAME
          description:
            en_us: 'Container Variable: OWNCLOUD_DB_USERNAME'
        - container: OWNCLOUD_DB_PASSWORD
          description:
            en_us: 'Container Variable: OWNCLOUD_DB_PASSWORD'
        - container: OWNCLOUD_DB_HOST
          description:
            en_us: 'Container Variable: OWNCLOUD_DB_HOST'
        - container: OWNCLOUD_ADMIN_USERNAME
          description:
            en_us: 'Container Variable: OWNCLOUD_ADMIN_USERNAME'
        - container: OWNCLOUD_ADMIN_PASSWORD
          description:
            en_us: 'Container Variable: OWNCLOUD_ADMIN_PASSWORD'
        - container: OWNCLOUD_MYSQL_UTF8MB4
          description:
            en_us: 'Container Variable: OWNCLOUD_MYSQL_UTF8MB4'
        - container: OWNCLOUD_REDIS_ENABLED
          description:
            en_us: 'Container Variable: OWNCLOUD_REDIS_ENABLED'
        - container: OWNCLOUD_REDIS_HOST
          description:
            en_us: 'Container Variable: OWNCLOUD_REDIS_HOST'
      volumes:
        - container: /mnt/data
          description:
            en_us: 'Container Path: /mnt/data'
      ports:
        - container: "8080"
          description:
            en_us: 'Container Port: 8080'
  big-bear-owncloud-db:
    container_name: big-bear-owncloud-db
    image: mariadb:10.6
    restart: unless-stopped
    environment:
      - MYSQL_ROOT_PASSWORD=f01914eb-2be3-4164-a57c-08e6518f313a
      - MYSQL_USER=bigbear
      - MYSQL_PASSWORD=f01914eb-2be3-4164-a57c-08e6518f313a
      - MYSQL_DATABASE=big_bear_owncloud
      - MARIADB_AUTO_UPGRADE=1
    command: ["--max-allowed-packet=128M", "--innodb-log-file-size=64M"]
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-u", "bigbear", "--password=f01914eb-2be3-4164-a57c-08e6518f313a"]
      interval: 10s
      timeout: 5s
      retries: 5
    volumes:
      - /DATA/AppData/$AppID/mysql:/var/lib/mysql
    networks:
      - big_bear_owncloud_network
    x-casaos:
      envs:
        - container: MYSQL_ROOT_PASSWORD
          description:
            en_us: 'Container Variable: MYSQL_ROOT_PASSWORD'
        - container: MYSQL_USER
          description:
            en_us: 'Container Variable: MYSQL_USER'
        - container: MYSQL_PASSWORD
          description:
            en_us: 'Container Variable: MYSQL_PASSWORD'
        - container: MYSQL_DATABASE
          description:
            en_us: 'Container Variable: MYSQL_DATABASE'
        - container: MARIADB_AUTO_UPGRADE
          description:
            en_us: 'Container Variable: MARIADB_AUTO_UPGRADE'
      volumes:
        - container: /var/lib/mysql
          description:
            en_us: 'Container Path: /var/lib/mysql'
  big-bear-owncloud-redis:
    container_name: big-bear-owncloud-redis
    image: redis:6.2.20@sha256:d06ff6ec778c7f2a5c0dfaf58141d598efaa50a89d0e966faedfdf122cef451b
    restart: unless-stopped
    command: ["--databases", "1"]
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 5s
      retries: 5
    volumes:
      - /DATA/AppData/$AppID/redis:/data
    networks:
      - big_bear_owncloud_network
    x-casaos:
      volumes:
        - container: /data
          description:
            en_us: 'Container Path: /data'
networks:
  big_bear_owncloud_network:
    name: big_bear_owncloud_network
    driver: bridge
x-casaos:
  # Supported CPU architectures for this application
  architectures:
    - amd64
    - arm64
  # Main service for this application
  main: big-bear-owncloud
  # Detailed description for the application
  description:
    en_us: ownCloud offers file sharing and collaboration trusted by 200+ million users worldwide regardless of device or location.
  # Brief tagline for the application
  tagline:
    en_us: ownCloud
  # Developer's information
  developer: owncloud
  # Author of this particular configuration
  author: BigBearTechWorld
  # Icon URL for the application
  icon: https://cdn.jsdelivr.net/gh/selfhst/icons/png/owncloud.png
  # Thumbnail image for the application (if any)
  thumbnail: ""
  # Installation tips
  tips:
    before_install:
      en_us: |
        Read this before installing: https://community.bigbeartechworld.com/t/added-owncloud-to-bigbearcasaos/1874#p-3512-documentation-4
  # Title for the application
  title:
    en_us: ownCloud
  # Category under which the application falls
  category: BigBearCasaOS
  # Default port mapping for the application
  port_map: "8080"
