# Configuration for ayon setup

# Name of the big-bear-ayon application
name: big-bear-ayon
# Service definitions for the big-bear-ayon application
services:
  # Service name: big-bear-ayon
  # The `big-bear-ayon` service definition
  big-bear-ayon:
    # Name of the container
    container_name: big-bear-ayon
    # Image to be used for the container
    image: ynput/ayon:1.3.6-20240823
    # Container restart policy
    restart: unless-stopped
    # Healthcheck configuration to ensure the service is running properly
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:5000/api/info"]
      interval: 10s
      timeout: 2s
      retries: "3"
    # Volumes to be mounted to the container
    volumes:
      - "/DATA/AppData/$AppID/addons:/addons"
      - "/DATA/AppData/$AppID/storage:/storage"
      # comment out the following line on Windows
      - "/etc/localtime:/etc/localtime:ro"
    # Ports mapping between host and container
    ports:
      # Mapping port 5000 of the host to port 5000 of the container
      - "5000:5000"
    expose: ["5000"]
    networks:
      - big-bear-ayon-network
    depends_on:
      postgres:
        condition: service_healthy
      redis:
        condition: service_started
    x-casaos:
      volumes:
        - container: /addons
          description:
            en_us: 'Container Path: /addons'
        - container: /storage
          description:
            en_us: 'Container Path: /storage'
        - container: /etc/localtime
          description:
            en_us: 'Container Path: /etc/localtime'
      ports:
        - container: "5000"
          description:
            en_us: 'Container Port: 5000'
  # Service definition for the PostgreSQL database
  postgres:
    image: postgres:15-alpine
    container_name: postgres
    restart: unless-stopped
    environment:
      - POSTGRES_USER=ayon
      - POSTGRES_PASSWORD=ayon
      - POSTGRES_DB=ayon
    volumes:
      - /DATA/AppData/$AppID/postgres:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ayon"]
      interval: 10s
      timeout: 5s
      retries: "5"
    expose: ["5432"]
    networks:
      - big-bear-ayon-network
    x-casaos:
      envs:
        - container: POSTGRES_USER
          description:
            en_us: 'Container Variable: POSTGRES_USER'
        - container: POSTGRES_PASSWORD
          description:
            en_us: 'Container Variable: POSTGRES_PASSWORD'
        - 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'
  # Service definition for the Redis database
  redis:
    image: redis:7.4.6-alpine@sha256:7a7c6b5c49a6896d0a58ee0c6dc0dcabe14f30f0a2f7d2d1362d276fa2d43166
    container_name: redis
    restart: unless-stopped
    volumes:
      - /DATA/AppData/$AppID/redis:/data
    healthcheck:
      test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
      interval: 5s
      timeout: 5s
      retries: "5"
    expose: ["6379"]
    networks:
      - big-bear-ayon-network
    x-casaos:
      volumes:
        - container: /data
          description:
            en_us: 'Container Path: /data'
networks:
  big-bear-ayon-network:
    driver: bridge
x-casaos:
  # Supported CPU architectures for this application
  architectures:
    - amd64
  # Main service for this application
  main: big-bear-ayon
  # Detailed description for the application
  description:
    en_us: This is the official Docker-based deployment for the Ayon Server. Ayon is a robust tool designed to manage and automate workflows in the animation and visual effects industries.
  # Brief tagline for the application
  tagline:
    en_us: Ayon
  # Developer's information
  developer: ynput
  # Author of this particular configuration
  author: BigBearTechWorld
  # Icon URL for the application
  icon: https://cdn.jsdelivr.net/gh/bigbeartechworld/big-bear-universal-apps/apps/ayon/logo.png
  # Thumbnail image for the application (if any)
  thumbnail: ""
  # Title for the application
  title:
    en_us: Ayon
  # Category under which the application falls
  category: BigBearCasaOS
  # Default port mapping for the application
  port_map: "5000"
