fix init process in Docker, add path to storage section for frontend usage, fix #694

This commit is contained in:
jb-alvarado 2024-07-10 09:27:52 +02:00
parent 64dc38d46e
commit 217df52afe
6 changed files with 20 additions and 12 deletions

View File

@ -7,6 +7,7 @@ ENV DB=/db
ENV SHARED_STORAGE=${SHARED_STORAGE}
COPY README.md ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.* /tmp/
COPY scripts/run.sh /
RUN apk update && \
apk upgrade && \
@ -20,8 +21,6 @@ RUN [[ -f "/tmp/ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.gz
rm -rf /tmp/* && \
mkdir ${DB}
RUN ffplayout -u admin -p admin -m contact@example.com --storage-path "/tv-media" --playlist-path "/playlists" --hls-path "/hls" --log-path "/logging"
EXPOSE 8787
CMD ["/usr/bin/ffplayout", "-l", "0.0.0.0:8787"]
CMD ["/run.sh"]

View File

@ -9,6 +9,7 @@ ENV SHARED_STORAGE=${SHARED_STORAGE}
COPY --from=ffmpeg-build /usr/local/bin/ffmpeg /usr/local/bin/ffmpeg
COPY --from=ffmpeg-build /usr/local/bin/ffprobe /usr/local/bin/ffprobe
COPY README.md ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.* /tmp/
COPY scripts/run.sh /
RUN apk update && \
apk upgrade && \
@ -22,8 +23,6 @@ RUN [[ -f "/tmp/ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.gz
rm -rf /tmp/* && \
mkdir ${DB}
RUN ffplayout -u admin -p admin -m contact@example.com --storage-path "/tv-media" --playlist-path "/playlists" --hls-path "/hls" --log-path "/logging"
EXPOSE 8787
CMD ["/usr/bin/ffplayout", "-l", "0.0.0.0:8787"]
CMD ["/run.sh"]

View File

@ -199,6 +199,7 @@ ENV DB=/db
ENV SHARED_STORAGE=${SHARED_STORAGE}
COPY README.md ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.* /tmp/
COPY scripts/run.sh /
RUN [[ -f "/tmp/ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.gz" ]] || \
wget -q "https://github.com/ffplayout/ffplayout/releases/download/v${FFPLAYOUT_VERSION}/ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.gz" -P /tmp/ && \
@ -208,8 +209,6 @@ RUN [[ -f "/tmp/ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.gz
rm -rf /tmp/* && \
mkdir ${DB}
RUN ffplayout -u admin -p admin -m contact@example.com --storage-path "/tv-media" --playlist-path "/playlists" --hls-path "/hls" --log-path "/logging"
EXPOSE 8787
CMD ["/usr/bin/ffplayout", "-l", "0.0.0.0:8787"]
CMD ["/run.sh"]

View File

@ -406,6 +406,8 @@ impl Playlist {
#[derive(Debug, Default, Clone, Deserialize, Serialize)]
pub struct Storage {
pub help_text: String,
#[serde(skip_deserializing)]
pub path: PathBuf,
#[serde(skip_serializing, skip_deserializing)]
pub paths: Vec<PathBuf>,
pub filler: PathBuf,
@ -414,9 +416,10 @@ pub struct Storage {
}
impl Storage {
fn new(config: &models::Configuration) -> Self {
fn new(config: &models::Configuration, path: PathBuf) -> Self {
Self {
help_text: config.storage_help.clone(),
path,
paths: vec![],
filler: PathBuf::from(config.storage_filler.clone()),
extensions: config
@ -564,7 +567,6 @@ impl PlayoutConfig {
let mut processing = Processing::new(&config);
let mut ingest = Ingest::new(&config);
let mut playlist = Playlist::new(&config);
let mut storage = Storage::new(&config);
let mut text = Text::new(&config);
let task = Task::new(&config);
let mut output = Output::new(&config);
@ -579,6 +581,8 @@ impl PlayoutConfig {
.expect("Can't create storage folder");
}
let mut storage = Storage::new(&config, global.storage_path.clone());
if channel_id > 1 || !global.shared_storage {
global.playlist_path = global.playlist_path.join(channel_id.to_string());
global.hls_path = global.hls_path.join(channel_id.to_string());

@ -1 +1 @@
Subproject commit 18518dd53acb2b78c2bf7f3ac199f038fc225fd9
Subproject commit c0d6f02d739f8554cf3a6c4ee090f8b346b26e31

7
scripts/run.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
if [ ! -f /db/ffplayout.db ]; then
ffplayout -u admin -p admin -m contact@example.com --storage-path "/tv-media" --playlist-path "/playlists" --hls-path "/hls" --log-path "/logging" --shared-storage
fi
/usr/bin/ffplayout -l "0.0.0.0:8787"