Mirakurun + EpgStation¶
環境¶
- OptiPlex 3050 SFF
- Transcend PCIe M.2 SSD TS128GMTE110S
- アースソフト PT3 x2
- Ubuntu 20.04 LTS
- Mirakurun: https://github.com/Chinachu/Mirakurun
- EpgStation: https://github.com/l3tnun/EPGStation/
Setup¶
Mirakurun + EpgStation なDockerコンテナを立てることにします。
ありがたいことに https://github.com/l3tnun/docker-mirakurun-epgstation があるので、こちらを利用します。
録画データディスクをZFSで作成¶
参考: https://qiita.com/juze9/items/563b67b9f2d67d1fa270
$ sudo apt install -y zfsutils-linux
$ ls /dev/disk/by-id/ | grep WDC
ata-WDC_WD40EZRX-00SPEB0_WD-WCC4E0985477
scsi-0ATA_WDC_WD40EZRX-00S_WD-WCC4E0985477
scsi-1ATA_WDC_WD40EZRX-00SPEB0_WD-WCC4E0985477
scsi-SATA_WDC_WD40EZRX-00S_WD-WCC4E0985477
$ sudo sgdisk -Z -o /dev/disk/by-id/scsi-SATA_WDC_WD40EZRX-00S_WD-WCC4E0985477
Caution: invalid main GPT header, but valid backup; regenerating main header
from backup!
Warning: Invalid CRC on main header data; loaded backup partition table.
Warning! Main and backup partition tables differ! Use the 'c' and 'e' options
on the recovery & transformation menu to examine the two tables.
Warning! Main partition table CRC mismatch! Loaded backup partition table
instead of main partition table!
Warning! One or more CRCs don't match. You should repair the disk!
Main header: ERROR
Backup header: OK
Main partition table: ERROR
Backup partition table: OK
Invalid partition data!
GPT data structures destroyed! You may now partition the disk using fdisk or
other utilities.
Information: Creating fresh partition table; will override earlier problems!
The operation has completed successfully.
$ sudo sgdisk -a 8 -n 1:40: -t 1:bf01 /dev/disk/by-id/scsi-SATA_WDC_WD40EZRX-00S_WD-WCC4E0985477
Found valid GPT with corrupt MBR; using GPT and will write new
protective MBR on save.
The operation has completed successfully.
$ sudo sgdisk -p /dev/disk/by-id/scsi-SATA_WDC_WD40EZRX-00S_WD-WCC4E0985477
Disk /dev/disk/by-id/scsi-SATA_WDC_WD40EZRX-00S_WD-WCC4E0985477: 7814037168 sectors, 3.6 TiB
Sector size (logical/physical): 512/4096 bytes
Disk identifier (GUID): 720F1933-9D62-4498-A6D3-35DDE4F5659A
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 7814037134
Partitions will be aligned on 8-sector boundaries
Total free space is 6 sectors (3.0 KiB)
Number Start (sector) End (sector) Size Code Name
1 40 7814037134 3.6 TiB BF01
$ sudo sgdisk -i 1 /dev/disk/by-id/scsi-SATA_WDC_WD40EZRX-00S_WD-WCC4E0985477
Partition GUID code: 6A898CC3-1DD2-11B2-99A6-080020736631 (Solaris /usr & Mac ZFS)
Partition unique GUID: D5CFE9F8-5485-4F7A-8E9C-AAC9087C00DC
First sector: 40 (at 20.0 KiB)
Last sector: 7814037134 (at 3.6 TiB)
Partition size: 7814037095 sectors (3.6 TiB)
Attribute flags: 0000000000000000
Partition name: ''
$ sudo mkdir -p /opt/rec_14
$ sudo zpool create -o ashift=12 -m /opt/rec_14 rec_14 /dev/disk/by-id/scsi-SATA_WDC_WD40EZRX-00S_WD-WCC4E0985477-part1
$ zpool list
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
rec_14 3.62T 540K 3.62T - - 0% 0% 1.00x ONLINE -
$ zpool status
pool: rec_14
state: ONLINE
scan: none requested
config:
NAME STATE READ WRITE CKSUM
rec_14 ONLINE 0 0 0
scsi-SATA_WDC_WD40EZRX-00S_WD-WCC4E0985477-part1 ONLINE 0 0 0
errors: No known data errors
$ sudo zfs set atime=off rec_14
$ sudo zfs set snapdir=visible rec_14
Mirakurun + EpgStation¶
アプリケーションのディレクトリを /opt
にするために少し書き換えて使う。
$ sudo apt install docker-compose -y
$ git clone https://github.com/l3tnun/docker-mirakurun-epgstation.git
$ cd docker-mirakurun-epgstation
$ cp docker-compose-sample.yml docker-compose.yml
$ vi docker-compose.yml
# NOTE: ファイルの変更は後述のdiffを参照
$ cp epgstation/config/config.sample.json epgstation/config/config.json
$ vi epgstation/config/config.json
# NOTE: ファイルの変更は後述のdiffを参照
$ vi mirakurun/conf/tuners.yml
# NOTE: PT3を2枚挿してるおじさんなのでadapter4 ~ adapter7を追加
$ sudo cp -rp epgstation /opt/
$ sudo cp -rp mirakurun /opt/
$ sudo mkdir -p /opt/rec_14/recorded
$ sudo chown ${USER}:${USER} /opt/rec_14/recorded
$ sudo chown -R root:root /opt/mirakurun
$ sudo docker-compose pull
$ sudo docker-compose build
$ sudo docker-compose up -d
$ sudo systemctl enable docker
Diff docker-compose.yml¶
$ diff -u docker-compose-sample.yml docker-compose.yml
--- docker-compose-sample.yml 2020-10-25 08:33:30.186997812 +0000
+++ docker-compose.yml 2020-10-25 09:37:56.291254665 +0000
@@ -9,13 +9,13 @@
- "40772:40772"
- "9229:9229"
volumes:
- - ./mirakurun/conf:/app-config
- - ./mirakurun/data:/app-data
+ - /opt/mirakurun/conf:/app-config
+ - /opt/mirakurun/data:/app-data
environment:
TZ: "Asia/Tokyo"
devices:
- - /dev/bus:/dev/bus
- - /dev/dvb:/dev/dvb
+ - /dev/bus:/dev/bus # Card reader
+ - /dev/dvb:/dev/dvb # PT3 x2
restart: always
logging:
driver: json-file
@@ -26,11 +26,11 @@
mysql:
image: mariadb:10.4
volumes:
- - mysql-db:/var/lib/mysql
+ - /opt/epgstation/mysql:/var/lib/mysql
environment:
MYSQL_USER: epgstation
- MYSQL_PASSWORD: epgstation
- MYSQL_ROOT_PASSWORD: epgstation
+ MYSQL_PASSWORD: epgstation2020
+ MYSQL_ROOT_PASSWORD: epgstation2020
MYSQL_DATABASE: epgstation
TZ: "Asia/Tokyo"
command: mysqld --character-set-server=utf8 --collation-server=utf8_unicode_ci --performance-schema=false --expire_logs_days=1
@@ -47,11 +47,11 @@
- CPUCORE=2
volumes:
- /etc/localtime:/etc/localtime:ro
- - ./epgstation/config:/app/config
- - ./epgstation/data:/app/data
- - ./epgstation/thumbnail:/app/thumbnail
- - ./epgstation/logs:/app/logs
- - ./recorded:/app/recorded
+ - /opt/epgstation/config:/app/config
+ - /opt/epgstation/data:/app/data
+ - /opt/epgstation/thumbnail:/app/thumbnail
+ - /opt/epgstation/logs:/app/logs
+ - /opt/rec_14/recorded:/app/recorded
environment:
TZ: "Asia/Tokyo"
depends_on:
@@ -60,7 +60,7 @@
ports:
- "8888:8888"
- "8889:8889"
- #user: "1000:1000"
+ user: "1000:1000"
restart: always
volumes:
Note
- USBデバイスはカードリーダー以外挿してないので
/dev/bus
を雑に全部Mirakuruに渡しています- 絞る必要がある場合は
lsusb
で対象のUSBデバイスを渡すこと
- 絞る必要がある場合は
- PCIeにはPT3しか挿していないので
/dev/dvb
を雑に全部Mirakurunに渡しています - どうせrootと管理ユーザーだけしか登録していないので
user: "1000:1000"
は決め打ちです
Fail
パスワード部分は変更を分かりやすくするためのものです
Diff epgstation/config/config.json¶
$ diff -u epgstation/config/config.sample.json epgstation/config/config.json
--- epgstation/config/config.sample.json 2020-10-25 08:33:30.186997812 +0000
+++ epgstation/config/config.json 2020-10-25 09:08:11.220966876 +0000
@@ -5,7 +5,7 @@
"host": "mysql",
"user": "epgstation",
"database": "epgstation",
- "password": "epgstation",
+ "password": "pasword0001",
"connectTimeout": 1000,
"connectionLimit": 10
},
起動チェック¶
Mirakurun
$ curl http://localhost:40772/api/version
{"current":"3.3.1","latest":"3.3.1"}
EpgStation
$ curl http://localhost:8888/api/storage
{"free":3857192714240,"used":3981967360,"total":3861174681600}
Note
適当なAPIが無かったので、とりあえず空き容量チェック用のAPIを叩く
Configuration¶
チャンネルスキャン¶
起動したらチャンネルスキャンする。
$ curl -X PUT "http://localhost:40772/api/config/channels/scan"
本筋じゃない話¶
温度確認したい¶
$ sudo apt install -y lm-sensors
$ sudo sensors-detect --auto
$ sensors
acpitz-acpi-0
Adapter: ACPI interface
temp1: +27.8°C (crit = +119.0°C)
temp2: +29.8°C (crit = +119.0°C)
coretemp-isa-0000
Adapter: ISA adapter
Package id 0: +32.0°C (high = +80.0°C, crit = +100.0°C)
Core 0: +29.0°C (high = +80.0°C, crit = +100.0°C)
Core 1: +32.0°C (high = +80.0°C, crit = +100.0°C)
最終更新日: 2021-05-19 14:16:14