2023-02-22 15:48:51 -05:00
|
|
|
# Run ffplayout in container
|
|
|
|
|
|
|
|
The image is build with a default user/pass `admin/admin`.
|
|
|
|
|
2024-04-10 08:34:46 -04:00
|
|
|
You can take a look at the [Dockerfile](Dockerfile)
|
2023-02-22 15:48:51 -05:00
|
|
|
|
|
|
|
### /!\ as ffmpeg is compiled with `--enable-nonfree` don't push it to a public registry nor distribute the image /!\
|
|
|
|
|
|
|
|
## Storage
|
2023-03-27 11:02:51 -04:00
|
|
|
|
2023-06-21 02:17:09 -04:00
|
|
|
There are some folders/files that are important for ffplayout to work well such as:
|
2024-06-12 04:16:00 -04:00
|
|
|
- **/usr/share/ffplayout/db** => where all the data are stored (user/pass etc)
|
2023-06-21 02:17:09 -04:00
|
|
|
- **/var/lib/ffplayout/tv-media** => where the media are stored by default (configurable)
|
|
|
|
- **/var/lib/ffplayout/playlists** => where playlists are stored (configurable)
|
2023-02-22 15:48:51 -05:00
|
|
|
|
|
|
|
It may be useful to create/link volume for those folders/files.
|
|
|
|
|
|
|
|
## Docker
|
|
|
|
|
2023-05-14 15:16:09 -04:00
|
|
|
How to build the image:\
|
|
|
|
```BASH
|
|
|
|
# build default
|
|
|
|
docker build -t ffplayout-image .
|
|
|
|
|
2024-07-04 09:10:33 -04:00
|
|
|
# build with shared storage (same storage for all channels)
|
|
|
|
docker build --build-arg SHARED_STORAGE=true .
|
|
|
|
|
2023-06-21 02:12:49 -04:00
|
|
|
# build from root folder, to copy local *.rpm package
|
2024-07-04 09:10:33 -04:00
|
|
|
docker build -f docker/Dockerfile -t ffplayout-image .
|
2023-06-21 02:12:49 -04:00
|
|
|
|
2023-05-14 15:16:09 -04:00
|
|
|
# build ffmpeg from source
|
2024-07-05 09:27:53 -04:00
|
|
|
docker build -f ffmpeg.Dockerfile -t ffmpeg-build .
|
|
|
|
docker build -f nonfree.Dockerfile -t ffplayout-image:nonfree .
|
2023-06-16 12:15:27 -04:00
|
|
|
|
2024-04-10 08:34:46 -04:00
|
|
|
# build with nvidia image for hardware support
|
2024-07-05 09:27:53 -04:00
|
|
|
docker build -f nvidia.Dockerfile -t ffplayout-image:nvidia .
|
2023-05-14 15:16:09 -04:00
|
|
|
```
|
2023-02-22 15:48:51 -05:00
|
|
|
|
|
|
|
example of command to start the container:
|
|
|
|
|
2024-04-10 08:34:46 -04:00
|
|
|
```BASH
|
2024-08-22 11:23:39 -04:00
|
|
|
docker run -it -v /path/to/db:/db -v /path/to/storage:/tv-media -v /path/to/playlists:/playlists -v /path/to/public:/public -v /path/to/logging:/logging --name ffplayout -p 8787:8787 ffplayout-image
|
2024-04-10 08:34:46 -04:00
|
|
|
|
|
|
|
# run in daemon mode
|
2024-07-04 09:10:33 -04:00
|
|
|
docker run -d --name ffplayout -p 8787:8787 ffplayout-image
|
2024-04-10 08:34:46 -04:00
|
|
|
|
|
|
|
# run with docker-compose
|
|
|
|
docker-compose up -d
|
2023-06-21 02:17:09 -04:00
|
|
|
```
|
2023-02-22 15:48:51 -05:00
|
|
|
|
2023-06-21 02:17:09 -04:00
|
|
|
#### Note from CentOS docker hub page
|
2024-04-10 08:34:46 -04:00
|
|
|
There have been reports that if you're using an Ubuntu host, you will need to add `-v /tmp/$(mktemp -d):/run` to the mount.
|
2023-02-22 15:48:51 -05:00
|
|
|
|
|
|
|
## Kubernetes
|
|
|
|
|
|
|
|
basic example to run the service in k8s:
|
|
|
|
```
|
|
|
|
---
|
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: Deployment
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
app: ffplayout
|
|
|
|
name: ffplayout
|
|
|
|
namespace: ffplayout
|
|
|
|
spec:
|
|
|
|
replicas: 1
|
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
app: ffplayout
|
|
|
|
strategy:
|
|
|
|
type: Recreate
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
app: ffplayout
|
|
|
|
spec:
|
|
|
|
containers:
|
|
|
|
- name: ffplayout
|
|
|
|
securityContext:
|
|
|
|
allowPrivilegeEscalation: true
|
|
|
|
capabilities:
|
|
|
|
add:
|
|
|
|
- SYS_ADMIN
|
|
|
|
image: ffplayout-image:latest
|
|
|
|
ports:
|
|
|
|
- containerPort: 8787
|
|
|
|
name: web
|
|
|
|
protocol: TCP
|
|
|
|
volumeMounts:
|
|
|
|
- name: cgroup
|
|
|
|
mountPath: /sys/fs/cgroup
|
|
|
|
readOnly: true
|
|
|
|
- name: database-volume
|
|
|
|
mountPath: /usr/share/ffplayout/db
|
|
|
|
restartPolicy: Always
|
|
|
|
volumes:
|
|
|
|
- name: cgroup
|
|
|
|
hostPath:
|
|
|
|
path: '/sys/fs/cgroup'
|
|
|
|
type: Directory
|
2023-02-27 15:36:20 -05:00
|
|
|
- name: database-volume
|
2023-02-22 15:48:51 -05:00
|
|
|
ephemeral:
|
|
|
|
volumeClaimTemplate:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
type: my-database-volume
|
|
|
|
spec:
|
|
|
|
accessModes: [ "ReadWriteOnce" ]
|
|
|
|
storageClassName: "database-storage-class"
|
|
|
|
resources:
|
|
|
|
requests:
|
|
|
|
storage: 1Gi
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Use with traefik
|
|
|
|
|
2023-03-27 11:02:51 -04:00
|
|
|
If you are using traefik here is a sample config
|
2023-02-22 15:48:51 -05:00
|
|
|
```
|
|
|
|
---
|
|
|
|
kind: Service
|
|
|
|
apiVersion: v1
|
|
|
|
metadata:
|
|
|
|
name: ffplayout
|
|
|
|
namespace: ffplayout
|
|
|
|
spec:
|
|
|
|
ports:
|
|
|
|
- port: 8787
|
|
|
|
name: web
|
|
|
|
protocol: TCP
|
|
|
|
selector:
|
|
|
|
app: ffplayout
|
|
|
|
---
|
|
|
|
apiVersion: traefik.containo.us/v1alpha1
|
|
|
|
kind: IngressRoute
|
|
|
|
metadata:
|
|
|
|
name: ffplayout-http
|
|
|
|
namespace: ffplayout
|
|
|
|
spec:
|
|
|
|
entryPoints:
|
|
|
|
- web
|
|
|
|
routes:
|
|
|
|
- match: Host(`ffplayout.example.com`) && PathPrefix(`/`)
|
|
|
|
kind: Rule
|
|
|
|
middlewares:
|
|
|
|
- name: redirect-https
|
|
|
|
namespace: default
|
|
|
|
services:
|
|
|
|
- name: ffplayout
|
|
|
|
namespace: ffplayout
|
|
|
|
port: 8787
|
|
|
|
---
|
|
|
|
apiVersion: traefik.containo.us/v1alpha1
|
|
|
|
kind: IngressRoute
|
|
|
|
metadata:
|
|
|
|
name: ffplayout-https
|
|
|
|
namespace: ffplayout
|
|
|
|
spec:
|
|
|
|
entryPoints:
|
|
|
|
- websecure
|
|
|
|
routes:
|
|
|
|
- match: Host(`ffplayout.example.com`) && PathPrefix(`/`)
|
|
|
|
kind: Rule
|
|
|
|
services:
|
|
|
|
- name: ffplayout
|
|
|
|
namespace: ffplayout
|
|
|
|
port: 8787
|
|
|
|
tls:
|
|
|
|
certResolver: yourCert
|
2023-03-27 11:02:51 -04:00
|
|
|
```
|