version: '2.4'
services:
  kraken-worker:
    image: "{{ weka_kraken_docker_image }}"
    ulimits:
      nofile:
        soft: 524288
        hard: 524288
    volumes:
      - {{ kraken_work_path_root }}:{{ kraken_work_path_root }}
      - {{ kraken_metrics_file }}:/home/zoox/kraken_metrics.log
      - {{ kraken_action_logs_dir_host }}:{{ kraken_action_logs_dir_container }}
      - {{ qnx_config_path }}:/home/zoox/.qnx
      - {{ qnx_binary_path }}:/home/zoox/qnx700
      - {{ qnx_toolchain_path }}:{{ qnx_toolchain_path }}
      - type: bind
        source: /mnt
        target: /mnt
        bind:
          propagation: rslave
      - /sys/fs/cgroup:/sys/fs/cgroup:ro
      - /opt/zoox/zrte:/opt/zoox/zrte:ro
    security_opt:
      - apparmor:unconfined # This is needed to address the apparmor issue on Ubuntu: https://github.com/moby/moby/issues/16429
    network_mode: host
    restart: unless-stopped
    environment:
      - JAEGER_SERVICE_NAME={{ jaeger_service_name }}
    cap_add:
      - SYS_ADMIN
      - SYS_PTRACE # Needed so that we can do ptrace when debugging code from client side
    command:
      - "-XX:MaxDirectMemorySize=64000000000"
      - com.google.devtools.build.remote.worker.RemoteWorker
      - --action_log_path={{ kraken_action_logs_dir_container }}/action_log
      - --jobs={{ firmware_max_concurrent_actions }}
      - --kraken_cluster_name=onprem-weka-kraken
      - --listen_port={{ kraken_worker_port_number }}
      - --max_permissible_worker_timeout={{ kraken_max_permissible_worker_timeout }}
      - --metrics_file_path=/home/zoox/kraken_metrics.log
      - --metrics_log_mode=selected
      - --mtime_modification_chance={{ mtime_modification_chance }}
      - --remote_filesystem_cache_root={{ weka_remote_filesystem_cache_root }}
      - --run_in_cgroup
      - --work_path={{ kraken_worker_work_path }}
      - --worker_timeout={{ kraken_firmware_worker_execute_timeout }}
      - --worker_type=firmware
