api_version: iobackup.io/v1
kind: BackupJob

metadata:
  job_id: production-backup
  name: Production Backup
  labels:
    environment: production
    server: prod-01

spec:
  enabled: true
  operation:
    type: backup
    strategy: full
  repository:
    type: single_artifact
    engine: iobackup
  execution:
    mode: sequential
    fail_fast: true
    timeout: 2h
  artifact:
    mode: auto
    staging:
      enabled: false
  notifications:
    webhooks:
      - name: backup-status
        enabled: true
        events: [on_started, on_success, on_failure, on_finished]
        policy:
          include_job_snapshot: false
          include_manifest: false
          include_labels: true
          include_paths: false
        request:
          method: POST
          url: "https://monitoring.example.com/iobackup/job"
          timeout: 10s
          auth:
            type: bearer
            token_env: IOBACKUP_WEBHOOK_TOKEN
        retry:
          enabled: true
          max_attempts: 3
          initial_delay: 2s
          max_delay: 30s
          backoff: exponential
          retry_on_5xx: true
          retry_on_network_error: true
  tasks:
    - task_id: app-files
      source:
        type: filesystem
        config:
          paths: [/srv/app, /etc/nginx]
          exclude: ["*.tmp", "*.log", ".git/*"]
          include_hidden: true
          follow_symlinks: false
      backup:
        format: tar.gz
        compression: gzip
        checksum: sha256
      destination:
        type: local
        config:
          path: /backups/files
        write_policy:
          on_conflict: fail
      policies:
        retention:
          keep_last_days: 14
