# Configuration for plant-it setup

# Name of the big-bear-plant-it application
name: big-bear-plant-it
# Service definitions for the big-bear-plant-it application
services:
  # Service name: big-bear-plant-it
  # The `big-bear-plant-it` service definition
  big-bear-plant-it:
    # Name of the container
    container_name: big-bear-plant-it
    # Image to be used for the container
    image: msdeluise/plant-it-server:0.10.0
    # Container restart policy
    restart: unless-stopped
    environment:
      # MySQL database host
      - MYSQL_HOST=big-bear-plant-it-db
      # MySQL database port
      - MYSQL_PORT=3306
      # MySQL database username
      - MYSQL_USERNAME=root
      # MySQL database password
      - MYSQL_PSW=9c75c563-b549-40e6-a0d2-360cf9a962ea
      # MySQL database name
      - MYSQL_DATABASE=plantit
      # MySQL root password
      - MYSQL_ROOT_PASSWORD=9c75c563-b549-40e6-a0d2-360cf9a962ea
      # JWT secret for authentication
      - JWT_SECRET=putTheSecretHere
      # JWT expiration time
      - JWT_EXP=1
      # Users limit (-1 means no limit)
      - USERS_LIMIT=-1
      # Directory for file uploads
      - UPLOAD_DIR=/upload-dir
      # API port
      - API_PORT=8080
      # Trefle API key (currently empty)
      - TREFLE_KEY=
      # Log level
      - LOG_LEVEL=DEBUG
      # Allowed origins for CORS
      - ALLOWED_ORIGINS=*
      # Cache time-to-live (TTL) in seconds
      - CACHE_TTL=86400
      # Cache host
      - CACHE_HOST=big-bear-plant-it-cache
      # Cache port
      - CACHE_PORT=6379
      # SSL enabled flag
      - SSL_ENABLED=false
      # Path to SSL certificates
      - CERTIFICATE_PATH=/certificates/
    # Volumes to be mounted to the container
    volumes:
      # Volume for uploads
      - "/DATA/AppData/$AppID/upload-dir:/upload-dir"
      # Volume for SSL certificates
      - "/DATA/AppData/$AppID/certificates:/certificates"
    # Ports mapping between host and container
    ports:
      # Mapping port 3000 of the host to port 3000 of the container
      - "3000:3000"
      # Mapping port 8080 of the host to port 8080 of the container
      - "8080:8080"
    networks:
      # Network definition
      - big_bear_plant_it_network
    x-casaos:
      envs:
        - container: MYSQL_HOST
          description:
            en_us: 'Container Variable: MYSQL_HOST'
        - container: MYSQL_PORT
          description:
            en_us: 'Container Variable: MYSQL_PORT'
        - container: MYSQL_USERNAME
          description:
            en_us: 'Container Variable: MYSQL_USERNAME'
        - container: MYSQL_PSW
          description:
            en_us: 'Container Variable: MYSQL_PSW'
        - container: MYSQL_DATABASE
          description:
            en_us: 'Container Variable: MYSQL_DATABASE'
        - container: MYSQL_ROOT_PASSWORD
          description:
            en_us: 'Container Variable: MYSQL_ROOT_PASSWORD'
        - container: JWT_SECRET
          description:
            en_us: 'Container Variable: JWT_SECRET'
        - container: JWT_EXP
          description:
            en_us: 'Container Variable: JWT_EXP'
        - container: USERS_LIMIT
          description:
            en_us: 'Container Variable: USERS_LIMIT'
        - container: UPLOAD_DIR
          description:
            en_us: 'Container Variable: UPLOAD_DIR'
        - container: API_PORT
          description:
            en_us: 'Container Variable: API_PORT'
        - container: TREFLE_KEY
          description:
            en_us: 'Container Variable: TREFLE_KEY'
        - container: LOG_LEVEL
          description:
            en_us: 'Container Variable: LOG_LEVEL'
        - container: ALLOWED_ORIGINS
          description:
            en_us: 'Container Variable: ALLOWED_ORIGINS'
        - container: CACHE_TTL
          description:
            en_us: 'Container Variable: CACHE_TTL'
        - container: CACHE_HOST
          description:
            en_us: 'Container Variable: CACHE_HOST'
        - container: CACHE_PORT
          description:
            en_us: 'Container Variable: CACHE_PORT'
        - container: SSL_ENABLED
          description:
            en_us: 'Container Variable: SSL_ENABLED'
        - container: CERTIFICATE_PATH
          description:
            en_us: 'Container Variable: CERTIFICATE_PATH'
      volumes:
        - container: /upload-dir
          description:
            en_us: 'Container Path: /upload-dir'
        - container: /certificates
          description:
            en_us: 'Container Path: /certificates'
      ports:
        - container: "3000"
          description:
            en_us: 'Container Port: 3000'
        - container: "8080"
          description:
            en_us: 'Container Port: 8080'
  # Service definition for the database
  big-bear-plant-it-db:
    # Name of the database container
    container_name: big-bear-plant-it-db
    # Image for the database
    image: mysql:8.0
    # Restart policy for the database container
    restart: always
    environment:
      # MySQL database name
      - MYSQL_DATABASE=plantit
      # MySQL root password
      - MYSQL_ROOT_PASSWORD=9c75c563-b549-40e6-a0d2-360cf9a962ea
    ports:
      # Mapping port 3306 of the host to port 3306 of the container
      - "3306:3306"
    volumes:
      # Volume for MySQL data
      - "/DATA/AppData/$AppID/mysql:/var/lib/mysql"
    networks:
      # Network definition
      - big_bear_plant_it_network
    x-casaos:
      envs:
        - container: MYSQL_DATABASE
          description:
            en_us: 'Container Variable: MYSQL_DATABASE'
        - container: MYSQL_ROOT_PASSWORD
          description:
            en_us: 'Container Variable: MYSQL_ROOT_PASSWORD'
      volumes:
        - container: /var/lib/mysql
          description:
            en_us: 'Container Path: /var/lib/mysql'
      ports:
        - container: "3306"
          description:
            en_us: 'Container Port: 3306'
  # Service definition for the cache
  big-bear-plant-it-cache:
    # Name of the cache container
    container_name: big-bear-plant-it-cache
    # Image for the cache
    image: redis:7.2.11@sha256:9c44a721d444690605ffa32d6b6e1ac565060676386f88bbbb376f56cef2f724
    # Restart policy for the cache container
    restart: always
    networks:
      # Network definition
      - big_bear_plant_it_network
# Network configuration
networks:
  # Network definition
  big_bear_plant_it_network:
    driver: bridge
x-casaos:
  # Supported CPU architectures for this application
  architectures:
    - amd64
    - arm64
  # Main service for this application
  main: big-bear-plant-it
  # Detailed description for the application
  description:
    en_us: Plant-it is a self-hosted gardening companion app. Useful for keeping track of plant care, receiving notifications about when to water plants, uploading plant images, and more.
  # Brief tagline for the application
  tagline:
    en_us: Self-hosted, open source gardening companion app
  # Developer's information
  developer: msdeluise
  # Author of this particular configuration
  author: BigBearTechWorld
  # Icon URL for the application
  icon: https://cdn.jsdelivr.net/gh/bigbeartechworld/big-bear-universal-apps/apps/plant-it/logo.png
  # Thumbnail image for the application (if any)
  thumbnail: ""
  # Installation tips
  tips:
    before_install:
      en_us: |
        Before installing read this: https://community.bigbeartechworld.com/t/added-plant-it-to-bigbearcasaos/1297#documentation-3
  # Title for the application
  title:
    en_us: Plant-it
  # Category under which the application falls
  category: BigBearCasaOS
  # Default port mapping for the application
  port_map: "3000"
