# Configuration for semaphore setup

# Name of the big-bear-semaphore application
name: big-bear-semaphore
# Service definitions for the big-bear-semaphore application
services:
  # Service name: big-bear-semaphore
  # The `big-bear-semaphore` service definition
  big-bear-semaphore:
    # Name of the container
    container_name: big-bear-semaphore
    # Image to be used for the container
    image: semaphoreui/semaphore:v2.18.12
    # Container restart policy
    restart: unless-stopped
    # Environment variables for configuration
    environment:
      SEMAPHORE_DB_USER: semaphore
      SEMAPHORE_DB_PASS: semaphore
      SEMAPHORE_DB_HOST: big-bear-semaphore-db
      SEMAPHORE_DB_PORT: "3306"
      SEMAPHORE_DB_DIALECT: mysql
      SEMAPHORE_DB: semaphore
      SEMAPHORE_ADMIN_PASSWORD: password
      SEMAPHORE_ADMIN_NAME: admin
      SEMAPHORE_ADMIN_EMAIL: admin@example.com
      SEMAPHORE_ADMIN: admin
      TZ: UTC
    # Volumes to be mounted to the container
    volumes:
      - /DATA/AppData/$AppID/home:/etc/semaphore # Configuration files for Semaphore
      - /DATA/AppData/$AppID/lib:/var/lib/semaphore # Local storage for Semaphore data (not needed if using an external database)
    # Ports mapping between host and container
    ports:
      - "3000:3000" # Expose port 3000 for web access
    networks:
      - big-bear-semaphore-network
    x-casaos:
      envs:
        - container: SEMAPHORE_DB_USER
          description:
            en_us: 'Container Variable: SEMAPHORE_DB_USER'
        - container: SEMAPHORE_DB_PASS
          description:
            en_us: 'Container Variable: SEMAPHORE_DB_PASS'
        - container: SEMAPHORE_DB_HOST
          description:
            en_us: 'Container Variable: SEMAPHORE_DB_HOST'
        - container: SEMAPHORE_DB_PORT
          description:
            en_us: 'Container Variable: SEMAPHORE_DB_PORT'
        - container: SEMAPHORE_DB_DIALECT
          description:
            en_us: 'Container Variable: SEMAPHORE_DB_DIALECT'
        - container: SEMAPHORE_DB
          description:
            en_us: 'Container Variable: SEMAPHORE_DB'
        - container: SEMAPHORE_ADMIN_PASSWORD
          description:
            en_us: 'Container Variable: SEMAPHORE_ADMIN_PASSWORD'
        - container: SEMAPHORE_ADMIN_NAME
          description:
            en_us: 'Container Variable: SEMAPHORE_ADMIN_NAME'
        - container: SEMAPHORE_ADMIN_EMAIL
          description:
            en_us: 'Container Variable: SEMAPHORE_ADMIN_EMAIL'
        - container: SEMAPHORE_ADMIN
          description:
            en_us: 'Container Variable: SEMAPHORE_ADMIN'
        - container: TZ
          description:
            en_us: 'Container Variable: TZ'
      volumes:
        - container: /etc/semaphore
          description:
            en_us: 'Container Path: /etc/semaphore'
        - container: /var/lib/semaphore
          description:
            en_us: 'Container Path: /var/lib/semaphore'
      ports:
        - container: "3000"
          description:
            en_us: 'Container Port: 3000'
  # MySQL database service for semaphore
  big-bear-semaphore-db:
    container_name: big-bear-semaphore-db
    image: mysql:8.0
    restart: unless-stopped
    volumes:
      - /DATA/AppData/$AppID/mysql:/var/lib/mysql # Data directory for MySQL
    environment:
      MYSQL_RANDOM_ROOT_PASSWORD: "yes" # Generate a random root password
      MYSQL_DATABASE: "semaphore" # Database name to create
      MYSQL_USER: "semaphore" # Database user
      MYSQL_PASSWORD: "semaphore" # Database password
    networks:
      - big-bear-semaphore-network
    x-casaos:
      envs:
        - container: MYSQL_RANDOM_ROOT_PASSWORD
          description:
            en_us: 'Container Variable: MYSQL_RANDOM_ROOT_PASSWORD'
        - container: MYSQL_DATABASE
          description:
            en_us: 'Container Variable: MYSQL_DATABASE'
        - container: MYSQL_USER
          description:
            en_us: 'Container Variable: MYSQL_USER'
        - container: MYSQL_PASSWORD
          description:
            en_us: 'Container Variable: MYSQL_PASSWORD'
      volumes:
        - container: /var/lib/mysql
          description:
            en_us: 'Container Path: /var/lib/mysql'
networks:
  big-bear-semaphore-network:
    driver: bridge # Specifies network driver type
x-casaos:
  # Supported CPU architectures for this application
  architectures:
    - amd64
    - arm64
  # Main service for this application
  main: big-bear-semaphore
  # Detailed description for the application
  description:
    en_us: Ansible Semaphore is a modern UI for Ansible. It lets you easily run Ansible playbooks, get notifications about fails, control access to deployment system.
  # Brief tagline for the application
  tagline:
    en_us: Ansible Semaphore
  # Developer's information
  developer: semaphore
  # Author of this particular configuration
  author: BigBearTechWorld
  # Icon URL for the application
  icon: https://cdn.jsdelivr.net/gh/selfhst/icons/png/semaphore-ui.png
  # Thumbnail image for the application (if any)
  thumbnail: ""
  # Title for the application
  title:
    en_us: Ansible Semaphore
  # Category under which the application falls
  category: BigBearCasaOS
  # Default port mapping for the application
  port_map: "3000"
