Skip to content

ELB (Edge Load Balancer)

Castis ELB sits in front of cproxy nodes, distributing traffic across them and handling failover. PlayTelly runs one ELB instance per location: elb_bkk.

Compose

elb_bkk:
  image: registry.mashup.castis.io/castis-images/image-storage/elb:v1
  container_name: elb_bkk
  networks:
    - internal
  ports:
    - "38090:8090"   # proxy
    - "38100:8100"   # api
  volumes:
    - ./cdn/elb-bkk/elb.yml:/usr/local/castis/GSLB/elb.yml:ro
    - ./cdn/elb-bkk/logs:/data/log/elb
  command: bash -c "cd /usr/local/castis/GSLB && chmod +x elb-1.0.3.rc1.x86_64 && ./elb-1.0.3.rc1.x86_64"

Volume Reference

Host path Container path Purpose
elb.yml /usr/local/castis/GSLB/elb.yml Config (read-only)
logs/ /data/log/elb/ Log output

Key Config

listen-addresses:
  - address: :8090
    use-ssl: false

api-listen-addresses:
  - address: :8100
    use-ssl: false

log-directory: /data/log/elb
log-level: debug

balance: round-robin
node-redirect-code: 302

failover:
  redirect-url: http://cproxy_bkk_1:8080
  redirect-code: 307

nodes:
  - id: cproxy-bkk
    hash-weight: 1
    websocket-url: "ws://cproxy_bkk_1:8081/api/traffic"
    redirect-address: "localhost:28080"

API

# version
curl http://localhost:38100/api/version

# current config
curl http://localhost:38100/api/config | jq .

# traffic stats
curl http://localhost:38100/api/traffic | jq .

Runtime config switching

Runtime origin switching via API (similar to cproxy's PUT /api/config/origins) is not yet implemented for ELB in CoreAPI. Current setup uses static yml config only. This will be added in a future iteration.