captainVersion: 4
services:
    $$cap_appname:
        documentation: https://docs.browserless.io/docs/docker-quickstart.html
        image: browserless/chrome:$$cap_browserless_version
        restart: always
        volumes:
            - $$cap_appname-workspace:/downloads
            - $$cap_appname-metrics:/metrics
            - $$cap_appname-user-data:/user-data
        environment:
            DEMO_MODE: $$cap_demo_mode
            ENABLE_DEBUGGER: $$cap_enable_debugger
            MAX_CONCURRENT_SESSIONS: $$cap_max_concurrent_sessions
            CONNECTION_TIMEOUT: $$cap_connection_timeout
            MAX_QUEUE_LENGTH: $$cap_max_queue_length
            WORKSPACE_DIR: $$cap_workspace_dir
            WORKSPACE_DELETE_EXPIRED: $$cap_workspace_delete_expired
            WORKSPACE_EXPIRE_DAYS: $$cap_workspace_expire_days
            DEFAULT_USER_DATA_DIR: $$cap_default_user_data_dir
            METRICS_JSON_PATH: $$cap_metrics_json_path
            DISABLE_AUTO_SET_DOWNLOAD_BEHAVIOR: $$cap_disable_auto_set_download_behavior
            DEFAULT_BLOCK_ADS: $$cap_default_block_ads
            ENABLE_API_GET: $$cap_enable_api_get
            TOKEN: $$cap_token
            ENABLE_CORS: $$cap_enable_cors
            ENABLE_XVBF: $$cap_enable_xvbf
            EXIT_ON_HEALTH_FAILURE: $$cap_exit_on_health_failure
            DEFAULT_IGNORE_HTTPS_ERRORS: $$cap_default_ignore_https_errors
            DEFAULT_IGNORE_DEFAULT_ARGS: $$cap_default_ignore_default_args
            DISABLED_FEATURES: $$cap_disabled_features
            PREBOOT_CHROME: $$cap_preboot_chrome
            KEEP_ALIVE: $$cap_keep_alive
            CHROME_REFRESH_TIME: $$cap_chrome_refresh_time
            FUNCTION_ENABLE_INCOGNITO_MODE: $$cap_function_enable_incognito_mode
        caproverExtra:
            containerHttpPort: '3000'
caproverOneClickApp:
    variables:
        - id: $$cap_browserless_version
          label: Browserless Version
          defaultValue: 1-chrome-stable
          description: Browserless Image Version
          validRegex: /^([^\s^\/])+$/
        - id: $$cap_demo_mode
          label: Demo Mode
          defaultValue: 'false'
          validRegex: /^(true|false)$/
          description: If you want to serve the interactive debugger, but not allow it to handle puppeteer.connect calls, you can do so via the DEMO_MODE flag.
        - id: $$cap_enable_debugger
          label: Enable Debugger
          defaultValue: 'true'
          validRegex: /^(true|false)$/
          description: If you want to disable the debugger (and all accompnaying HTML) you can set the ENABLE_DEBUGGER to false to only allow puppeteer.connect calls to succeed.
        - id: $$cap_max_concurrent_sessions
          label: Max Concurrent Sessions
          defaultValue: 5
          description: Since running Chrome can be rather resource intensive you'll probably want to limit the number of concurrent sessions. This is, by default, set to 5 when not specified. Once the limit is reached then queueing begins to take place and requests will wait until more workers are ready.
        - id: $$cap_connection_timeout
          label: Connection Timeout
          defaultValue: 30000
          description: Connection timeout is a parameter that sets how long any session can run for. This is in place to prevent scripts that don't cleanup properly, or run into errors tha cause them to hang. The value of which can be set in milliseconds, and defaults to 30000, or 30 seconds.
        - id: $$cap_max_queue_length
          label: Max Queue Length
          defaultValue: 5
          description: This value determines how many items in the queue are allowed before requests are issued a 429 response code and closed.
        - id: $$cap_workspace_dir
          label: workspace location
          defaultValue: /downloads
          description: Defining a workspace location
        - id: $$cap_workspace_delete_expired
          label: Deleting workspace files automatically
          defaultValue: 'false'
          validRegex: /^(true|false)$/
          description: When downloads from Chrome are larger, it's easy for the docker image to fill it's disk-space if you forget to periodically delete files.
        - id: $$cap_workspace_expire_days
          label: time to delete workspace files
          defaultValue: 30
          description: When WORKSPACE_DELETE_EXPIRED is true, browserless attempts to delete files older than 30 days in the workspace directory.
        - id: $$cap_default_user_data_dir
          label: User Data Dir
          defaultValue: /user-data
          description: Sets a default directory to cache user data to (cookies, local-storage and more).
        - id: $$cap_metrics_json_path
          label: Persisting Metrics
          defaultValue: /metrics/metrics.json
          description: browserless captures metrics while it's running, and exposes them via the /metrics endpoint.
        - id: $$cap_disable_auto_set_download_behavior
          label: Disable download behavior
          defaultValue: 'false'
          validRegex: /^(true|false)$/
          description: By default, browserless tells chromium to use a special directory in /tmp for storing files. If you want opt-out of this behavior, set to true
        - id: $$cap_default_block_ads
          label: Block Ads
          defaultValue: 'false'
          validRegex: /^(true|false)$/
          description: Starts all sessions with the ad-blocker already running
        - id: $$cap_enable_api_get
          label: Enable API GET
          defaultValue: 'true'
          validRegex: /^(true|false)$/
          description: Allows for enabling an expiremental GET-style operation, as opposed to POSTing bodies of code to run on our APIs.
        - id: $$cap_token
          label: Token
          defaultValue: $$cap_gen_random_hex(32)
          validRegex: /^([^\s^\/])+$/
          description: If you're exposing your instance to the world, but don't want anyone to use it, you can optionally apply a TOKEN param that will restrict calls without a token query-string parameter.
        - id: $$cap_enable_cors
          label: Enable CORS
          defaultValue: 'true'
          validRegex: /^(true|false)$/
          description: You can enable cross-origin-resource-sharing with browserless
        - id: $$cap_enable_xvbf
          label: Enable XVFB
          defaultValue: 'true'
          validRegex: /^(true|false)$/
          description: in some hosting environments it's not possible to write to the appropriate folders to support XVFB and you should set this parameter to false.
        - id: $$cap_exit_on_health_failure
          label: Exit on health failure
          defaultValue: 'true'
          validRegex: /^(true|false)$/
          description: In order for browserless to restart on health-failure checks, you'll have to set to true.
        - id: $$cap_default_ignore_https_errors
          label: Ignore HTTPS errors
          defaultValue: 'true'
          validRegex: /^(true|false)$/
          description: Tells browserless to, by default, ignore or not ignore HTTPS errors on sites.
        - id: $$cap_default_ignore_default_args
          label: Ignore Default Args
          defaultValue: 'false'
          validRegex: /^(true|false)$/
          description: When set this will override any default arguments set by browserless to Chrome's launch arguments
        - id: $$cap_disabled_features
          label: Disable Routes
          defaultValue: ''
          description: Allows for disabling routes by supplying a list of routes to disable
        - id: $$cap_preboot_chrome
          label: Pre-booting Chrome
          defaultValue: 'false'
          validRegex: /^(true|false)$/
          description: You can, optionally, pre-boot Chrome and keep it in a pool of instances (determined by MAX_CONCURRENT_SESSIONS) in order to cut-down on the boot time.
        - id: $$cap_keep_alive
          label: Keeping Chrome Alive
          defaultValue: 'false'
          validRegex: /^(true|false)$/
          description: When the PREBOOT_CHROME flag is set, you can optionally keep Chrome "alive" after sessions are complete. This allows you to re-use Chrome instances without having to start and stop them (making for much faster execution).
        - id: $$cap_chrome_refresh_time
          label: Chrome Refresh Time
          defaultValue: 3600000
          description: When both PREBOOT_CHROME and KEEP_ALIVE are true browserless keeps track of how long Chrome has been running, and will attempt to close it after a certain period.
        - id: $$cap_function_enable_incognito_mode
          label: Function Incognito Mode
          defaultValue: 'false'
          validRegex: /^(true|false)$/
          description: When set, and PREBOOT_CHROME and KEEP_ALIVE are set, allows for generating a fresh page (incognito page) from a re-used browser.
    instructions:
        start: >-
            Browserless Web is communication between web applications without the need for a web browser.
        end: >-
            Your service is available at http://$$cap_appname.$$cap_root_domain?token=$$cap_token
            Atention: you need activate Websocket Support!
    displayName: Browserless
    isOfficial: true
    description: Browserless Web is communication between web applications without the need for a web browser.
    documentation: https://docs.browserless.io/docs/docker.html
