# Configuration for nightscout setup

# Name of the big-bear-nightscout application
name: big-bear-nightscout
# Service definitions for the big-bear-nightscout application
services:
  big-bear-nightscout:
    # Name of the container
    container_name: big-bear-nightscout
    # Image to be used for the container
    image: nightscout/cgm-remote-monitor:15.0.7
    # Container restart policy
    restart: unless-stopped
    # Port mappings for the container
    ports:
      - "1337:1337"
    # Environment variables for the container
    environment:
      ### Variables for the container
      NODE_ENV: production
      # TZ - Timezone for the container
      TZ: Etc/UTC
      ### Overridden variables for Docker Compose setup
      # The `nightscout` service can use HTTP, because we use `traefik` to serve the HTTPS
      # and manage TLS certificates
      INSECURE_USE_HTTP: "true"
      # For all other settings, please refer to the Environment section of the README
      ### Required variables
      # MONGO_CONNECTION - The connection string for your Mongo database.
      # Something like mongodb://sally:sallypass@ds099999.mongolab.com:99999/nightscout
      # The default connects to the `mongo` included in this docker-compose file.
      # If you change it, you probably also want to comment out the entire `mongo` service block
      # and `depends_on` block above.
      MONGO_CONNECTION: mongodb://big-bear-nightscout-mongo:27017/nightscout
      # API_SECRET - A secret passphrase that must be at least 12 characters long.
      API_SECRET: 48f875fa-0e03-416f-b9d6-19c9afc4e194 # change_me
      ### Features
      # ENABLE - Used to enable optional features, expects a space delimited list, such as: careportal rawbg iob
      # See https://github.com/nightscout/cgm-remote-monitor#plugins for details
      ENABLE: careportal rawbg iob
      # AUTH_DEFAULT_ROLES (readable) - possible values readable, denied, or any valid role name.
      # When readable, anyone can view Nightscout without a token. Setting it to denied will require
      # a token from every visit, using status-only will enable api-secret based login.
      AUTH_DEFAULT_ROLES: denied
      # For all other settings, please refer to the Environment section of the README
      # https://github.com/nightscout/cgm-remote-monitor#environment
    # Service dependencies
    depends_on:
      - big-bear-nightscout-mongo
    # Networks for the container
    networks:
      - big-bear-nightscout-network
    x-casaos:
      envs:
        - container: NODE_ENV
          description:
            en_us: 'Container Variable: NODE_ENV'
        - container: TZ
          description:
            en_us: 'Container Variable: TZ'
        - container: INSECURE_USE_HTTP
          description:
            en_us: 'Container Variable: INSECURE_USE_HTTP'
        - container: MONGO_CONNECTION
          description:
            en_us: 'Container Variable: MONGO_CONNECTION'
        - container: API_SECRET
          description:
            en_us: 'Container Variable: API_SECRET'
        - container: ENABLE
          description:
            en_us: 'Container Variable: ENABLE'
        - container: AUTH_DEFAULT_ROLES
          description:
            en_us: 'Container Variable: AUTH_DEFAULT_ROLES'
      ports:
        - container: "1337"
          description:
            en_us: 'Container Port: 1337'
  big-bear-nightscout-mongo:
    # Name of the MongoDB container
    container_name: big-bear-nightscout-mongo
    # Image to be used for the MongoDB container
    image: mongo:4.4
    # Networks for the MongoDB container
    networks:
      - big-bear-nightscout-network
    # Volume mappings for the MongoDB container
    volumes:
      - /DATA/AppData/$AppID/mongo-data:/data/db
    x-casaos:
      volumes:
        - container: /data/db
          description:
            en_us: 'Container Path: /data/db'
# Network definitions
networks:
  big-bear-nightscout-network:
    driver: bridge
x-casaos:
  # Supported CPU architectures for this application
  architectures:
    - amd64
    - arm64
  # Main service for this application
  main: big-bear-nightscout
  # Detailed description for the application
  description:
    en_us: This acts as a web-based CGM (Continuous Glucose Monitor) to allow multiple caregivers to remotely view a patient's glucose data in real time. The server reads a MongoDB which is intended to be data from a physical CGM, where it sends new SGV (sensor glucose values) as the data becomes available. The data is then displayed graphically and blood glucose values are predicted 0.5 hours ahead using an autoregressive second order model. Alarms are generated for high and low values, which can be cleared by any watcher of the data.
  # Screenshot links for the application
  screenshot_link:
    - https://cdn.jsdelivr.net/gh/bigbeartechworld/big-bear-universal-apps@main/apps/nightscout/screenshots/screenshot.png
  # Brief tagline for the application
  tagline:
    en_us: Nightscout
  # Developer's information
  developer: nightscout
  # Author of this particular configuration
  author: BigBearTechWorld
  # Icon URL for the application
  icon: https://cdn.jsdelivr.net/gh/selfhst/icons/png/nightscout.png
  # Thumbnail image for the application (if any)
  thumbnail: https://cdn.jsdelivr.net/gh/bigbeartechworld/big-bear-universal-apps/apps/nightscout/screenshot.png
  # Installation tips
  tips:
    before_install:
      en_us: |
        https://community.bigbeartechworld.com/t/added-nightscout-to-bigbearcasaos/1403#documentation-3
  # Title for the application
  title:
    en_us: nightscout
  # Category under which the application falls
  category: BigBearCasaOS
  # Default port mapping for the application
  port_map: "1337"
