Showcase
A 24/7 live channel run by Dagu, a 256 MB RISC-V board and five throwaway VMs
Recorded videos are encoded and cut into 30-minute segments on VMs that sleep when idle, then aired nonstop. Viewers vote segments away from the chat.
Built by Killian ·
Plain YAML next to my shell and Python scripts, one binary, no database, and it sits in 1 GB next to a live encoder without trouble.
- on air, over 452 hours
- 99.1%
- segments aired
- 918
- Dagu runs in 15 days
- 16,029
- scheduler memory
- 41 MB
The problem
Killian wanted a channel that never goes off air, built from a 256 MB board at home and free-tier cloud machines: one VM with 1 GB of RAM, and five worker VMs that sleep until there is work. The 1 GB VM does no encoding, so the heavy work has to run on the workers. And whatever goes wrong upstream, the live stream must not drop.
How it's built
Dagu runs on the 1 GB VM as a single scheduler process with nine DAGs.
- Every 10 minutes, the home board asks the cloud VM how many hours of video are ready. When stock runs low, it queues one job per video.
- Five copies of the feed DAG run every 5 minutes. Each takes one job, wakes a worker VM, and has it fetch the source, encode it to H.264 with 2-second keyframes, and cut 30-minute segments.
- The cloud VM pulls the finished segments into its queue. A single ffmpeg process streams them live over RTMPS, and nothing ever restarts it, so anything upstream can fail or pause without dropping the live.
The other four DAGs keep it running:
vodloop-backoff, every 15 minutes: after 3 failed fetches and no new segment in 30 minutes, pauses fetching for 2 hours.vodloop-catalog, daily: lists the available videos and installs the catalogue, refusing a list that comes back 10% short.vodloop-lot, daily: when under 3 days of the batch are left, draws the next 14 days of videos.vm-health, daily: checks the provider's API key, the base snapshot, and every worker's disk before the feed breaks.
The feed DAG
Each of the five copies is this file, with the description and comments translated, a label renamed, and the path shortened.
description: "Take one fetch job from the queue
(asked by the home board when stock runs
low), run it on a VM, queue the result here.
Nothing to take = short, green run."
labels: [vodloop, vm]
schedule: "*/5 * * * *"
# up to three runs of this copy at once
max_active_runs: 3
# no catch-up after downtime: the home
# board decides what is due
catchup_window: ""
steps:
- id: feed
action: exec
timeout_sec: 10800
with:
command: /bin/sh
args: ["~/feed/feed-run.sh"]
Results
Measured on the running system, from Dagu's own run history:
- 99.1% of 5-minute checks found the channel live, from 20 October to 7 November (452 hours).
- 918 segments aired, from 367 different videos.
- 16,029 runs of the nine DAGs in 15 days. The feed DAGs made 15,166 of them; 534 failed, and 257 did real encode work, with a median of 32 minutes.
- 41 MB of memory for the scheduler, which had been up for 8 days and 20 hours when measured. A cron line with
flockrestarts it within a minute if it ever stops.
What made it work:
- Scale by copying a file. One feed DAG on 25 October, three on 27 October, then five. No code change.
- A kill switch that is a file. A
STOPfile pauses the feed, and runs stay green while paused. - History as the metrics store. Every number on this page comes from Dagu's run records.
- Portable. The same DAGs first ran on a Windows PC, then moved to the Linux VM.
Numbers and DAG file by Killian.
Dagu is one binary with no database. It runs next to your scripts, on whatever machine you have.