version: 1
kind: hwlab-tasktree-runtime

metadata:
  id: hwlab-tasktree
  owner: hwlab
  relatedIssues:
    - 2380
    - 2668

defaults:
  node: NC01
  database:
    mode: nc01-host-native-postgresql
    configRef: config/platform-db/postgres-nc01.yaml
    secretName: hwlab-tasktree-db
    secretKey: database-url
    sslmode: require
  temporal:
    configRef: config/platform-infra/temporal.yaml
    serviceRef:
      namespace: temporal
      name: temporal-frontend
      port: 7233
    logicalNamespace: unidesk
    workflow:
      executionTimeout: 5m
      activityStartToCloseTimeout: 30s
      retry:
        maximumAttempts: 3
  backup:
    mode: github-versioned-snapshot
    enabled: true
    repository: pikasTech/decision-center-data
    sshUrl: git@github.com:pikasTech/decision-center-data.git
    branch: main
    interval: 5m
    worktreePath: .state/tasktree/backup-repo
    commitMessagePrefix: "tasktree:"
    author:
      name: HWLAB TaskTree
      email: tasktree@hwlab.local
    sshIdentity:
      configRef: config/deploy-ssh-identities.yaml
      targetId: NC01
      identityId: github.com
    restore:
      defaultMode: dry-run
      requireExpectedContentSha: true
      automaticRestore: false
  runtime:
    api:
      serviceId: hwlab-tasktree-api
      port: 6673
      healthPath: /health/ready
    worker:
      serviceId: hwlab-tasktree-worker
      healthPort: 6674
      healthPath: /health/ready
    cli:
      localMode: dispatcher
  web:
    route: /projects/tasktree
    apiBasePath: /v1/tasktree
    defaultView: gantt
    timeline:
      weekStartsOn: 1
      minimumDayWidth: 28
      maximumVisibleDays: 120

targets:
  development:
    lane: v03
    namespace: hwlab-v03
    database:
      sourceRef: hwlab/tasktree-nc01-db.env
    temporal:
      taskQueue: hwlab-v03-tasktree
    backup:
      target: development
      basePath: tasktree/development
    runtime:
      cli:
        overapiEndpoint: http://hwlab-tasktree-api.hwlab-v03.svc.cluster.local:6673
    public:
      webUrl: https://lab.hwpod.com
  production:
    lane: production
    namespace: hwlab-production
    database:
      sourceRef: hwlab/tasktree-nc01-db.env
    temporal:
      taskQueue: hwlab-production-tasktree
    backup:
      target: production
      basePath: tasktree/production
    runtime:
      cli:
        overapiEndpoint: http://hwlab-tasktree-api.hwlab-production.svc.cluster.local:6673
    public:
      webUrl: https://lab.hwpod.com

native:
  targetRef: targets.development
  stateDir: .state/tasktree
  worker:
    entrypoint: cmd/hwlab-tasktree-worker/main.ts
    logFile: worker.jsonl
    pidFile: worker.pid
  api:
    entrypoint: cmd/hwlab-tasktree-api/main.ts
    host: 127.0.0.1
    port: 6673
    logFile: api.jsonl
    pidFile: api.pid
