# zerops.yaml — runtime build/run config for the chaos test services.
#
# Two setups, both built from the same Go source under valkey/.
#
#   chaosworker     10 replicas, ships events to chaoscollector (no exposed port).
#                   Reads $ZEROPS_Number → maps to Redis DB N and pub/sub
#                   channel suffix ":N" so the 10 containers don't collide
#                   in the keyspace or on the same channel.
#
#   chaoscollector  1 replica, exposes :8080 with subdomain access enabled,
#                   ingests events from the workers and serves the dashboard.
#
# NB: validate the exact schema (field names, autoscaling block, prepare
# commands) against the current Zerops docs before pushing. Field names
# below follow the typical zerops.yaml conventions but vary by runtime
# version.

zerops:
  - setup: chaosworker
    build:
      base: ubuntu/go@1
      buildCommands:
        - go build -o app .
      deployFiles:
        - app
        - config.yaml
      cache: true
    run:
      base: ubuntu@latest
      start: ./app --worker --config config.yaml
      envVariables:
        COLLECTOR_URL: http://chaoscollector.zerops:8080
        VALKEY_PASSWORD: ${valkeyha_password}

  - setup: chaoscollector
    build:
      base: ubuntu/go@1
      buildCommands:
        - go build -o app .
      deployFiles:
        - app
      cache: true
    run:
      base: ubuntu@latest
      ports:
        - port: 8080
          httpSupport: true
      start: ./app --collector --collector-port 8080

  - setup: chaosbasic
    build:
      base: ubuntu/go@1
      buildCommands:
        - go build -o app .
      deployFiles:
        - app
        - config-basic.yaml
      cache: true
    run:
      base: ubuntu@latest
      ports:
        - port: 8080
          httpSupport: true
      startCommands:
        - name: collector
          command: ./app --collector --collector-port 8080
        - name: worker
          command: ./app --worker --config config-basic.yaml
      envVariables:
        COLLECTOR_URL: http://localhost:8080
        VALKEY_VALKEYSINGLE1_PASSWORD: ${valkeysingle1_password}
        VALKEY_VALKEYSINGLE2_PASSWORD: ${valkeysingle2_password}
        VALKEY_VALKEYSINGLE3_PASSWORD: ${valkeysingle3_password}
        VALKEY_VALKEYHA1_PASSWORD: ${valkeyha1_password}
        VALKEY_VALKEYHA2_PASSWORD: ${valkeyha2_password}
        VALKEY_VALKEYHA3_PASSWORD: ${valkeyha3_password}
