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
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Pyxis

日本のテレビ放送を録画して観るサーバを、Docker の入った Linux 1 台に立てる。\
録画と配信は [Carina](https://github.com/NewWorldOrg/Carina)、画面は [Vela](https://github.com/NewWorldOrg/Vela) が受け持つ。\
Pyxis はその 2 つを、動作を確かめた版の組で固定して配る。\
チューナーは [Puppis](https://github.com/NewWorldOrg/Puppis)、録画と配信は [Carina](https://github.com/NewWorldOrg/Carina)、画面は [Vela](https://github.com/NewWorldOrg/Vela) が受け持つ。\
Pyxis はその 3 つを、動作を確かめた版の組で固定して配る。\
Kubernetes に立てるなら、同じ版の組を固定した Helm チャートが `charts/pyxis` にある。

立てると、ブラウザから次のことをする。
Expand All @@ -19,7 +19,7 @@ Kubernetes に立てるなら、同じ版の組を固定した Helm チャート

| サービス | イメージ | 役割 |
| --- | --- | --- |
| `driver` | Carina | 特権で動く。チューナーを占有し、スクランブルを解いて録画ファイルを書く |
| `driver` | Puppis | 特権で動く。チューナーを占有し、スクランブルを解いて録画ファイルを書く |
| `app` | Carina | 番組表・予約・ライブ・エンコード・ライブラリの API。特権は持たない |
| `migrate` | Carina | 起動のたびにデータベースのスキーマを当てて終わる |
| `prepare` | Carina | `app` が書く置き場の所有者を合わせて終わる |
Expand Down Expand Up @@ -261,7 +261,7 @@ kubectl -n tv logs deploy/carina-app -c app | grep 'Sign in as'
| `driver.pcscd.enabled` | ホストの `/run/pcscd` を読み取り専用で渡すか | `false` |
| `driver.socket.hostPath` | driver と app が共有するソケットのディレクトリのホスト側のパス | `/run/pyxis` |
| `driver.hostNetwork` | ホストのネットワークで動かすか。カードを貸す driver は `true` | `false` |
| `driver.lendingKey.existingSecret` | カードの貸し借りの鍵を持つ Secret。`/etc/carina/lending.key` に所有者だけが読める形で置く | 空 |
| `driver.lendingKey.existingSecret` | カードの貸し借りの鍵を持つ Secret。`/etc/puppis/lending.key` に所有者だけが読める形で置く | 空 |
| `driver.terminationGracePeriodSeconds` | 止めるときに録画の終わりを待つ秒数。`shutdownGraceHours` より長くする | `25200` |
| `app.publicOrigin` | ブラウザから届くアドレス。OIDC でサインインするときに要る | 空 |
| `app.knownNetworks` | `X-Forwarded-*` を信じる前段の網の一覧。Ingress のコントローラの Pod がいる網を書く | 空 |
Expand Down Expand Up @@ -336,7 +336,7 @@ driver:
address: 0.0.0.0
hostNames:
- lender.example.com
keyFile: /etc/carina/lending.key
keyFile: /etc/puppis/lending.key
hostDevices:
- /dev/dvb/adapter0
pcscd:
Expand Down Expand Up @@ -453,9 +453,9 @@ docker compose logs driver

## 版

| Pyxis | Carina app | Carina driver | Vela | PostgreSQL | Caddy |
| Pyxis | Carina | Puppis | Vela | PostgreSQL | Caddy |
| --- | --- | --- | --- | --- | --- |
| 未リリース | v1.0.0 | v1.0.0 | v1.0.0 | 18.6 | 2.11.7 |
| 未リリース | v2.0.0 | v0.1.1 | v1.0.0 | 18.6 | 2.11.7 |

イメージの版は `compose.yml` と `charts/pyxis/values.yaml` に数字で書いてあり、`latest` は使わない。\
2 か所が同じ版であることは CI が確かめる。\
Expand All @@ -466,5 +466,5 @@ Pyxis の版は、その組で起動・録画・再生を確かめてから付
AGPL-3.0-only。著作権者は NewWorldOrg で、全文は `LICENSE` にある。

Pyxis が持つのは設定だけで、ソフトウェアは各イメージの側にある。\
イメージに同梱した他のソフトウェアとそのライセンスは、イメージの中の `/usr/share/doc/carina/` と `/usr/share/doc/vela/` で読める。\
イメージに同梱した他のソフトウェアとそのライセンスは、イメージの中の `/usr/share/doc/puppis/`・`/usr/share/doc/carina/`・`/usr/share/doc/vela/` で読める。\
PostgreSQL と Caddy は公式のイメージをそのまま使う。
8 changes: 5 additions & 3 deletions charts/pyxis/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
apiVersion: v2
name: pyxis
description: A recording server for Japanese digital broadcasting, with Carina and Vela pinned to a verified set of image versions
description: A recording server for Japanese digital broadcasting, with Puppis, Carina and Vela pinned to a verified set of image versions
type: application
version: 0.1.0
appVersion: 0.1.0
kubeVersion: ">=1.25.0-0"
home: https://github.com/NewWorldOrg/Pyxis
sources:
- https://github.com/NewWorldOrg/Pyxis
- https://github.com/NewWorldOrg/Puppis
- https://github.com/NewWorldOrg/Carina
- https://github.com/NewWorldOrg/Vela
keywords:
- dtv
- recording
- puppis
- carina
- vela
annotations:
# この版が固定するイメージの組。compose.yml と values.yaml の image と同じ値にする
images/carina-app: ghcr.io/newworldorg/carina:app-v1.0.0
images/carina-driver: ghcr.io/newworldorg/carina:driver-v1.0.0
images/carina-app: ghcr.io/newworldorg/carina:v2.0.0
images/puppis-driver: ghcr.io/newworldorg/puppis:v0.1.1
images/vela: ghcr.io/newworldorg/vela:v1.0.0
images/postgres: postgres:18.6-alpine
2 changes: 1 addition & 1 deletion charts/pyxis/ci/driver-only-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ driver:
address: 0.0.0.0
hostNames:
- lender.example.com
keyFile: /etc/carina/lending.key
keyFile: /etc/puppis/lending.key
hostDevices:
- /dev/dvb/adapter0
pcscd:
Expand Down
10 changes: 4 additions & 6 deletions charts/pyxis/templates/driver-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,13 @@ spec:
image: {{ printf "%s:%s" $driver.image.repository $driver.image.tag | quote }}
imagePullPolicy: {{ $driver.image.pullPolicy }}
env:
- name: CARINA_ROLE
value: driver
- name: CARINA_DRIVER_CONFIG
value: /etc/carina/driver.json
- name: PUPPIS_DRIVER_CONFIG
value: /etc/puppis/driver.json
securityContext:
privileged: true
volumeMounts:
- name: config
mountPath: /etc/carina/driver.json
mountPath: /etc/puppis/driver.json
subPath: driver.json
readOnly: true
- name: socket
Expand All @@ -55,7 +53,7 @@ spec:
{{- end }}
{{- if $driver.lendingKey.existingSecret }}
- name: lending-key
mountPath: /etc/carina/lending.key
mountPath: /etc/puppis/lending.key
subPath: {{ $driver.lendingKey.key }}
readOnly: true
{{- end }}
Expand Down
8 changes: 4 additions & 4 deletions charts/pyxis/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ driver:
enabled: true
image:
# driver のイメージ
repository: ghcr.io/newworldorg/carina
repository: ghcr.io/newworldorg/puppis
# driver のイメージのタグ。compose.yml と同じ版にする
tag: driver-v1.0.0
tag: v0.1.1
# イメージを引く条件
pullPolicy: IfNotPresent
# driver.json の中身をそのまま書く。socketGroupId はチャートが carina.gid で入れ、socketPath は既定 (/run/carina/driver.sock) のままにする
Expand Down Expand Up @@ -51,7 +51,7 @@ driver:
lendingKey:
# カードの貸し借りの鍵を持つ Secret の名前。空なら渡さない
existingSecret: ""
# その Secret の中の鍵のキー。/etc/carina/lending.key に所有者だけが読める形で置く
# その Secret の中の鍵のキー。/etc/puppis/lending.key に所有者だけが読める形で置く
key: key
# 止めるときに録画の終わりを待つ秒数。config.shutdownGraceHours より長くする
terminationGracePeriodSeconds: 25200
Expand All @@ -67,7 +67,7 @@ app:
# app と migrate のイメージ
repository: ghcr.io/newworldorg/carina
# app のイメージのタグ。compose.yml と同じ版にする
tag: app-v1.0.0
tag: v2.0.0
# イメージを引く条件
pullPolicy: IfNotPresent
# ブラウザからこのサーバに届くアドレス (https://tv.example.com)。OIDC の redirect URI の元になる
Expand Down
15 changes: 7 additions & 8 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ services:

# app は uid 10001 で動くので、app が書く置き場の所有者をその番号にそろえてから app を上げる (中のファイルには触らない)
prepare:
image: ghcr.io/newworldorg/carina:app-v1.0.0
image: ghcr.io/newworldorg/carina:v2.0.0
logging: *logging
restart: 'no'
entrypoint: ['chown', '10001:10001', '/var/lib/carina/keys', '/srv/encodes', '/srv/thumbnails', '/srv/captions']
Expand All @@ -35,7 +35,7 @@ services:
- captions:/srv/captions

migrate:
image: ghcr.io/newworldorg/carina:app-v1.0.0
image: ghcr.io/newworldorg/carina:v2.0.0
logging: *logging
restart: 'no'
environment:
Expand All @@ -46,7 +46,7 @@ services:
condition: service_healthy

app:
image: ghcr.io/newworldorg/carina:app-v1.0.0
image: ghcr.io/newworldorg/carina:v2.0.0
logging: *logging
restart: unless-stopped
environment:
Expand Down Expand Up @@ -92,22 +92,21 @@ services:
condition: service_started

driver:
image: ghcr.io/newworldorg/carina:driver-v1.0.0
image: ghcr.io/newworldorg/puppis:v0.1.1
logging: *logging
# 要求による停止は 0、それ以外は 70 で終わるので on-failure は使わない
restart: unless-stopped
privileged: true
# 録画中に止められると録画の終わり (上限 shutdownGraceHours、既定 6 時間) まで待つ。それより長くする
stop_grace_period: 7h
environment:
CARINA_ROLE: driver
CARINA_DRIVER_CONFIG: /etc/carina/driver.json
PUPPIS_DRIVER_CONFIG: /etc/puppis/driver.json
volumes:
- ./driver/driver.json:/etc/carina/driver.json:ro
- ./driver/driver.json:/etc/puppis/driver.json:ro
- driver-run:/run/carina
- ${CARINA_RECORDINGS_DIR:?}:/srv/recordings
healthcheck:
test: ['CMD', '/opt/carina/driver/Carina.Driver', '--probe']
test: ['CMD', '/opt/puppis/Puppis.Driver', '--probe']
interval: 30s
timeout: 15s
retries: 3
Expand Down
2 changes: 1 addition & 1 deletion scripts/check-versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ check_subset 'Chart.yaml' "$(chart_images)"

while IFS= read -r image; do
case "$image" in
*/carina:* | */vela:* | postgres:*) ;;
*/carina:* | */puppis:* | */vela:* | postgres:*) ;;
*) continue ;;
esac
if ! values_images | grep -qxF "$image"; then
Expand Down
Loading