Files
pf-linux-port/scripts/screencast/narration/05-balanceamento.en.json
T
lgcosta cc67531602 Screencasts v2: real shell sessions, MiniMax narration (EN/PT), lab diagram
O problema da primeira serie era a sensacao de 'quadro a quadro': a captura
era a saida de um script despejada em blocos.  Agora cada video e uma sessao
shell de verdade.

- record.py: abre um pty, faz SSH no firewall e digita os comandos tecla a
  tecla (~34 c/s, com jitter).  O tty remoto ecoa, o kernel responde ao vivo;
  a captura e asciicast v2 com timestamps.  'bash --noediting' evita que o
  editor de linha redesenhe o comando e o tty o repita (a linha aparecia
  duplicada).
- record.py --pace: segura a tela enquanto a voz fala - cada batida dura o
  trecho de audio que a acompanha, de modo que uma unica captura serve as
  duas versoes de idioma.
- record.py --ensure-pf: garante pf.ko carregado antes de gravar.  Sem isso
  uma fase que roda 'rmmod' (ativacao) pode derrubar o /dev/pf de outra
  gravacao concorrentes - foi exatamente o que quebrou a fase de roteamento
  na primeira tentativa.
- make_audio.py: geracao da narracao pelo MiniMax TTS, uma voz feminina por
  idioma (English_ConfidentWoman / Portuguese_ConfidentWoman), um arquivo
  por segmento.  A API devolve o audio em hexadecimal, nao base64.
- render_video.py: reproduz a captura por um emulador de terminal e escreve
  os frames direto no ffmpeg como RGB bruto (um PNG por frame era uma ordem
  de grandeza mais lento).  Desenha o diagrama de rede do lab por cima do
  terminal nas fases de roteamento e balanceamento, destacando o caminho em
  discussao, e queima a legenda da narracao.
- assemble.py: mixa os segmentos de audio na linha do tempo.
- join.py: emenda as fases com crossfade sobre um cartao de capitulo e
  sincroniza o audio na mesma linha do tempo.
- build-all.sh: roda o pipeline inteiro.

Arte de fundo e audio vem do MiniMax; a geracao de video do MiniMax nao esta
habilitada nesta conta (erro 2068 em todos os modelos), entao as transicoes
sao renderizadas localmente com ffmpeg.

16 videos: 7 fases + filme completo, em ingles e portugues, com legenda
queimada.
2026-11-12 10:57:29 -03:00

68 lines
2.2 KiB
JSON

{
"phase": "05-balanceamento",
"lang": "en",
"voice": "English_ConfidentWoman",
"title": "Load balancing",
"subtitle": "NAT pools in round-robin and source-hash, plus dup-to",
"segments": [
{
"beat": "b1",
"text": "Load balancing in pf is done with pools. This rule translates the source of the client network into a pool of two addresses, the two gateways of the firewall, and selects between them round robin.",
"highlight": [
"cli",
"pf0",
"srv"
],
"diagram_caption": "pool { 10.0.2.1, 10.0.3.1 }: round-robin"
},
{
"beat": "b2",
"text": "We capture on the interface towards the server to see which source address each packet carries."
},
{
"beat": "b3",
"text": "Six packets from the client."
},
{
"beat": "b4",
"text": "And the capture shows the truth: three packets went out with one address, three with the other. The pool is really rotating between its members, and the server sees a balanced load.",
"highlight": [
"cli",
"pf0",
"srv"
],
"diagram_caption": "3 packets with each source address"
},
{
"beat": "b5",
"text": "Sometimes you do not want rotation. source hash keeps a given origin always mapped to the same pool member, which is what you want when a session has to be sticky.",
"highlight": [
"cli",
"pf0",
"srv"
],
"diagram_caption": "pool { 10.0.2.1, 10.0.3.1 }: source-hash"
},
{
"beat": "b6",
"text": "Four more packets, and now every single one carries the same source address. The mapping is stable per origin.",
"highlight": [
"cli",
"pf0",
"srv"
],
"diagram_caption": "every packet with the same source"
},
{
"beat": "b7",
"text": "And dup to is the mirror case: the packet keeps its normal path, and a copy is delivered to the second gateway. We count the requests on both interfaces: one on the normal path, one on the mirrored path. The packet was duplicated, not moved.",
"highlight": [
"cli",
"pf0",
"srv",
"gw2"
],
"diagram_caption": "dup-to: the normal path and the mirrored copy"
}
]
}