-
Notifications
You must be signed in to change notification settings - Fork 522
docker & k8s
Chigusa edited this page Jun 23, 2021
·
2 revisions
bgo也可以通过docker的方式来玩,这样可以避免手动安装ffmpeg和配置的问题,请确保熟悉docker的基本操作和概念
bgo在的docker image中的配置文件为/etc/bililive-go/config.yml
,录像输出文件在/srv/bililive
(VOLUME),API监听8080
端口
-
在不指定参数时会以读配置文件的方式启动
docker run -v ~/Movies:/srv/bililive -d -p 8080:8080 chigusa/bililive-go
-
在指定参数后会忽略配置文件,以指定的参数去启动
docker run -v ~/Movies:/srv/bililive --rm chigusa/bililive-go -o /srv/bililive -i https://www.panda.tv/10300
以下是一个例子,有闲功夫我再写个helm
apiVersion: v1
kind: Namespace
metadata:
name: bililive-go
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: bgo-live-records
namespace: bililive-go
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
---
apiVersion: v1
kind: ConfigMap
metadata:
name: bililive-go
namespace: bililive-go
data:
config.yaml: |-
rpc:
enable: true
bind: :8080
debug: true
interval: 30
out_put_path: /bililive-go
feature:
use_native_flv_parser: false
live_rooms:
- https://live.bilibili.com/97558 # 免
- https://live.bilibili.com/6655 # 爽
- https://www.huya.com/114514 # 熊人
- https://live.bilibili.com/1030 # 王辣鸡
- https://cc.163.com/361433 # 秦
- https://www.huya.com/gcores # 机核
- https://www.douyu.com/12306 # 轮椅人
- https://live.bilibili.com/545189 # testv
video_split_strategies:
on_room_name_changed: false
max_duration: 0s
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: bililive-go
namespace: bililive-go
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app.kubernetes.io/name: bililive-go
template:
metadata:
labels:
app.kubernetes.io/name: bililive-go
spec:
volumes:
- name: outputs
persistentVolumeClaim:
claimName: bgo-live-records
- name: bililive-go-config
configMap:
name: bililive-go
containers:
- name: bililive-go
image: chigusa/bililive-go
imagePullPolicy: Always
command:
- /usr/bin/bililive-go
args:
- -c
- /etc/bililive-go/config.yaml
ports:
- containerPort: 8080
name: http
protocol: TCP
livenessProbe:
httpGet:
port: 8080
path: /api/info
initialDelaySeconds: 30
timeoutSeconds: 30
periodSeconds: 10
successThreshold: 1
failureThreshold: 6
readinessProbe:
httpGet:
port: 8080
path: /api/info
initialDelaySeconds: 30
timeoutSeconds: 30
periodSeconds: 10
successThreshold: 1
failureThreshold: 6
securityContext:
runAsUser: 1000
runAsGroup: 998
volumeMounts:
- mountPath: /bililive-go
name: outputs
- mountPath: /etc/bililive-go
name: bililive-go-config
---
apiVersion: v1
kind: Service
metadata:
name: bililive-go
namespace: bililive-go
labels:
app.kubernetes.io/name: bililive-go
spec:
selector:
app.kubernetes.io/name: bililive-go
type: ClusterIP
ports:
- port: 8080
protocol: TCP
targetPort: http
name: http
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: bililive-go
namespace: bililive-go
spec:
rules:
- host: bililive-go.local
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: bililive-go
port:
name: http
---
kind: ServiceMonitor
apiVersion: monitoring.coreos.com/v1
metadata:
name: bililive-go
namespace: bililive-go
labels:
app.kubernetes.io/name: bililive-go
spec:
endpoints:
- path: /api/metrics
port: http
interval: 5s
namespaceSelector:
matchNames:
- bililive-go
selector:
matchLabels:
app.kubernetes.io/name: bililive-go