---
kind: Service
name: web-app
count: 3
runtime:
  one_of: process
  command: /bin/sleep 3600
ports:
  - name: http
    port: 8080
restart:
  mode: service
  attempts: 5
  delay: 2s
update:
  strategy: rolling
  max_parallel: 1
  min_healthy_time: 10s
  healthy_deadline: 2m
service:
  name: web-app
  port: 8080
health:
  check_type: http
  interval: 5s
  timeout: 1s
  unhealthy_threshold: 2
constraints:
  - node.role == "web"
affinity:
  - target: zone == "a"
    weight: 80
lifecycle:
  post_start:
    - /bin/sh -c 'echo cache warmed'
  pre_stop:
    - /bin/sh -c 'sleep 5'
    - /bin/sh -c 'echo draining web-app'
---
# Web App

Frontend web application serving HTTP on port 8080 via Unix socket.
Three replicas with rolling updates, anti-affinity for zone spreading,
and lifecycle hooks for cache warm-up and graceful drain.

> **Production substitution**: this example uses `/bin/sh -c 'echo ...
> sleep 3600'` so it runs out-of-the-box on any Linux machine. In a
> real deployment, replace the `runtime.command` with your actual
> binary, e.g. `/usr/bin/httpd -f /etc/orca/web-app/httpd.conf`, and
> replace the lifecycle hooks with your real scripts
> (`/usr/local/bin/warm-cache.sh`, `/usr/local/bin/drain.sh`).