Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .env.production
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
PUBLIC_RELAY_URL="https://relay.quic.video"
# Generate with: cargo run --bin moq-token -- --key root.jwk sign --root "demo" --subscribe ""
#PUBLIC_RELAY_TOKEN="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb290IjoiZGVtbyIsInB1YiI6bnVsbCwic3ViIjoiIiwiZXhwIjpudWxsLCJpYXQiOm51bGx9.igFi_TB6UndjY7o2H5OipJKeN-jxue9EQUgVSVHM0NA"
PUBLIC_RELAY_TOKEN=""
PUBLIC_RELAY_TOKEN="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb290IjoiZGVtbyIsInB1YiI6bnVsbCwic3ViIjoiIiwiZXhwIjpudWxsLCJpYXQiOm51bGx9.w6NCqef736qNYCC1KAovUbTaJb8bvHnY-QwXZ_p3vTw"
4 changes: 2 additions & 2 deletions infra/input.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ variable "domain" {

variable "docker_relay" {
description = "Docker image for moq-relay"
default = "docker.io/kixelated/moq-relay:0.8.0"
default = "docker.io/kixelated/moq-relay:0.8.5"
}

variable "docker_hang" {
description = "Docker image for hang"
default = "docker.io/kixelated/hang:0.2.0"
default = "docker.io/kixelated/hang:0.2.3"
}

# Too complicated to specify via flags, so do it here.
Expand Down
4 changes: 2 additions & 2 deletions infra/pub.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ resource "google_compute_instance" "pub" {
region = local.pub.region

# A token used to publish demo/bbb.hang
# cargo run --bin moq-token -- --key root.jwk sign --root "demo" --publish "" > demo.jwt
demo_token = trimspace(file("demo.jwt"))
# cargo run --bin moq-token -- --key root.jwk sign --root "demo" --publish "" > demo-pub.jwt
demo_token = trimspace(file("demo-pub.jwt"))
})
}

Expand Down
65 changes: 53 additions & 12 deletions infra/pub.yml.tpl
Original file line number Diff line number Diff line change
@@ -1,26 +1,66 @@
#cloud-config

write_files:
- path: /etc/systemd/system/hang-bbb.service
- path: /etc/systemd/system/hang-bbb-prepare.service
permissions: 0644
owner: root
content: |
[Unit]
Description=Run hang-bbb via docker
Description=Prepare video for hang-bbb
Requires=docker.service
After=docker.service
Before=hang-bbb.service

[Service]
Type=oneshot
RemainAfterExit=yes
WorkingDirectory=/tmp
ExecStart=/bin/bash -c '\
# Download the video \
docker run --rm -v /tmp:/tmp alpine:latest \
wget -nv "$${URL:-http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4}" \
-O /tmp/tmp.mp4 && \
# Fragment the video \
docker run --rm -v /tmp:/tmp linuxserver/ffmpeg:latest \
-y -loglevel error -i /tmp/tmp.mp4 \
-c copy \
-f mp4 -movflags cmaf+separate_moof+delay_moov+skip_trailer+frag_every_frame \
/tmp/fragmented.mp4 && \
rm -f /tmp/tmp.mp4'

- path: /etc/systemd/system/hang-bbb.service
permissions: 0644
owner: root
content: |
[Unit]
Description=Run hang-bbb via docker
Requires=docker.service hang-bbb-prepare.service
After=docker.service hang-bbb-prepare.service

[Service]
ExecStart=docker run --rm \
--name hang-bbb \
--network="host" \
--pull=always \
--cap-add=SYS_PTRACE \
-e RUST_LOG=debug -e RUST_BACKTRACE=1 \
-e REGION=${region} \
--entrypoint hang-bbb \
${docker_image} \
publish --url "https://relay.quic.video/anon" --name "bbb"
ExecStart=/bin/bash -c '\
docker run --rm -v /tmp:/tmp:ro linuxserver/ffmpeg:latest \
-stream_loop -1 \
-hide_banner \
-v quiet \
-re \
-i /tmp/fragmented.mp4 \
-vf "drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf:text='${region}: %%{gmtime: %%H\\:%%M\\:%%S.%%3N}':x=(W-tw)-24:y=24:fontsize=48:fontcolor=white:box=1:boxcolor=black@0.5" \
-an \
-b:v 3M \
-preset ultrafast \
-tune zerolatency \
-f mp4 \
-movflags cmaf+separate_moof+delay_moov+skip_trailer+frag_every_frame \
- | \
docker run --rm -i \
--name hang-bbb \
--network="host" \
--pull=always \
--cap-add=SYS_PTRACE \
-e RUST_LOG=debug -e RUST_BACKTRACE=1 \
${docker_image} \
hang publish --url "https://relay.quic.video/anon" --name "bbb"'

ExecStop=docker stop hang-bbb

Expand Down Expand Up @@ -51,4 +91,5 @@ write_files:
runcmd:
- systemctl daemon-reload
- systemctl restart docker
- systemctl start hang-bbb-prepare
- systemctl start hang-bbb
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@astrojs/rss": "^4.0.12",
"@astrojs/solid-js": "5.1.0",
"@astrojs/tailwind": "6.0.2",
"@kixelated/hang": "^0.3.0",
"@kixelated/hang": "^0.3.2",
"@tailwindcss/forms": "^0.5.10",
"@tailwindcss/typography": "^0.5.16",
"astro": "^5.8.2",
Expand Down
26 changes: 13 additions & 13 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.