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
35 changes: 35 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# .env に写して、この機械に合わせて書く。.env はコミットしない。

# データベースのパスワード。空のままでは起動しない。`;` は使えない
POSTGRES_PASSWORD=

# データベースのデータを置くホスト側のディレクトリ
CARINA_DB_DIR=

# 録画を書くホスト側のディレクトリ。移行で録画を移すなら、移行元と同じマウントの下に置く
CARINA_RECORDINGS_DIR=

# エンコード済みファイルを書くホスト側のディレクトリ。ライブラリと一緒に増える
CARINA_ENCODES_DIR=

# OIDC の client secret を暗号化する鍵を置くホスト側のディレクトリ。データベースとは別に残す
CARINA_KEYS_DIR=

# ブラウザからこのサーバに届くアドレス (https://tv.example.com など)。ID プロバイダに登録する redirect URI の元になる
CARINA_PUBLIC_ORIGIN=

# Caddy が開くサイトのアドレス。公開のドメイン (tv.example.com) なら https で開き証明書を取る。LAN だけなら :80 のまま
PYXIS_SITE_ADDRESS=:80

# ホスト側で開く http と https のポート。80 と 443 がほかに使われているなら別の番号にする
PYXIS_HTTP_PORT=80
PYXIS_HTTPS_PORT=443

# 録画をあとからエンコードするときの変換器。Software か Vaapi (GPU を渡したとき)
CARINA_ENCODINGS_PREFER=Software

# ライブと録画再生をその場で変換するときの変換器。Software か Vaapi (GPU を渡したとき)
CARINA_TRANSCODING_PREFER=Software

# VAAPI で使う GPU の描画ノード
CARINA_RENDER_NODE=/dev/dri/renderD128
71 changes: 71 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,74 @@ jobs:
- uses: actions/checkout@v7
- run: pipx install yamllint==1.38.0
- run: yamllint --strict .

compose-config:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: The .env a check needs, with every required value filled in
run: |
cat > .env <<EOF
POSTGRES_PASSWORD=check
CARINA_DB_DIR=${RUNNER_TEMP}/pyxis/db
CARINA_RECORDINGS_DIR=${RUNNER_TEMP}/pyxis/recordings
CARINA_ENCODES_DIR=${RUNNER_TEMP}/pyxis/encodes
CARINA_KEYS_DIR=${RUNNER_TEMP}/pyxis/keys
EOF
- name: compose.yml on its own
run: docker compose config -q
- name: compose.yml with every device file laid over it
run: docker compose -f compose.yml -f examples/tuner-dvb.yml -f examples/tuner-usb.yml -f examples/gpu-intel.yml config -q

compose-up:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v7
- name: The .env of a host with a synthetic tuner and the proxy on a spare port
run: |
mkdir -p "${RUNNER_TEMP}"/pyxis/{db,recordings,encodes,keys}
cat > .env <<EOF
POSTGRES_PASSWORD=check
CARINA_DB_DIR=${RUNNER_TEMP}/pyxis/db
CARINA_RECORDINGS_DIR=${RUNNER_TEMP}/pyxis/recordings
CARINA_ENCODES_DIR=${RUNNER_TEMP}/pyxis/encodes
CARINA_KEYS_DIR=${RUNNER_TEMP}/pyxis/keys
PYXIS_HTTP_PORT=18080
PYXIS_HTTPS_PORT=18443
EOF
- run: docker compose up -d --quiet-pull
- name: Through the proxy, /api/health and /login answer 200 within 3 minutes
run: |
for _ in $(seq 1 180); do
health=$(curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:18080/api/health || true)
login=$(curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:18080/login || true)
if [ "$health" = 200 ] && [ "$login" = 200 ]; then
echo "health=$health login=$login"
curl -s http://127.0.0.1:18080/api/health
echo
exit 0
fi
sleep 1
done
echo "health=$health login=$login after 180s"
exit 1
- name: Every service is healthy or has finished
run: |
docker compose ps -a
for _ in $(seq 1 60); do
unhealthy=$(docker compose ps -a --format '{{.Service}} {{.Health}} {{.ExitCode}} {{.State}}' \
| awk '$4 == "exited" && $3 != 0 || $4 == "running" && $2 != "healthy" && $2 != ""' | wc -l)
[ "$unhealthy" = 0 ] && exit 0
sleep 2
done
docker compose ps -a
exit 1
- name: What each service said, when something did not come up
if: failure()
run: |
docker compose ps -a
docker compose logs
- name: Take everything down, volumes included
if: always()
run: docker compose down -v -t 60
15 changes: 15 additions & 0 deletions Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# 同じオリジンで /api/* を app に、それ以外を vela に振り分ける。
# PYXIS_SITE_ADDRESS に公開のドメインを書くと Caddy が証明書を取って https で開き、:80 なら http で開く。
# アクセスログは取らない (外部プレイヤーの URL はパスに再生用のトークンを含む)。
{$PYXIS_SITE_ADDRESS} {
handle /api/* {
# SSE (/api/events) を溜めない。WebSocket (/api/live/ws) と Range はそのまま通る
reverse_proxy app:8080 {
flush_interval -1
}
}

handle {
reverse_proxy vela:3000
}
}
Loading
Loading