From a354ee6b708e2cb436a3a8795b35f5abcb325b35 Mon Sep 17 00:00:00 2001 From: rocky4546 <24759693+rocky4546@users.noreply.github.com> Date: Fri, 5 Jan 2024 11:57:01 -0600 Subject: [PATCH] Minor changes to Docker files --- .dockerignore | 3 +- entrypoint.sh => Docker_entrypoint.sh | 2 +- Dockerfile | 2 +- Dockerfile_l2p | 14 -------- Dockerfile_tvh | 14 -------- README.md | 48 ++++++++------------------ docker-compose.yml | 19 +++++++--- lib/common/utils.py | 2 +- lib/db/datamgmt/data_mgmt_html.py | 2 +- lib/resources/config_defn/clients.json | 6 ++-- 10 files changed, 39 insertions(+), 73 deletions(-) rename entrypoint.sh => Docker_entrypoint.sh (92%) delete mode 100644 Dockerfile_l2p delete mode 100644 Dockerfile_tvh diff --git a/.dockerignore b/.dockerignore index b2d4b07..a4a7458 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,4 +3,5 @@ !lib !plugins !requirements.txt -!entrypoint.sh +!Docker_entrypoint.sh +!LICENSE \ No newline at end of file diff --git a/entrypoint.sh b/Docker_entrypoint.sh similarity index 92% rename from entrypoint.sh rename to Docker_entrypoint.sh index 09138e4..d7fdea4 100755 --- a/entrypoint.sh +++ b/Docker_entrypoint.sh @@ -11,7 +11,7 @@ echo "Starting with UID : $USER_ID" addgroup -S -g $GROUP_ID $USERNAME adduser -S -D -H -h /app -u $USER_ID -G $USERNAME $USERNAME -blockUpdate="/app/do_not_updagrade_from_WEBUI_on_Docker" +blockUpdate="/app/Do_Not_Upgrade_from_WEBUI_on_Docker" oldKeyFile="/root/.cabernet/key.txt" newKeyFile="/app/.cabernet/key.txt" diff --git a/Dockerfile b/Dockerfile index f294fc0..3b091cd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,4 +11,4 @@ RUN apk add --no-cache --update bash tzdata ffmpeg curl su-exec && \ VOLUME /app/data /app/plugins_ext /app/.cabernet EXPOSE 6077 5004 -ENTRYPOINT ["entrypoint.sh"] +ENTRYPOINT ["Docker_entrypoint.sh"] diff --git a/Dockerfile_l2p b/Dockerfile_l2p deleted file mode 100644 index 001ac47..0000000 --- a/Dockerfile_l2p +++ /dev/null @@ -1,14 +0,0 @@ -FROM python:3.8-alpine -LABEL maintainer="Thomas Gorgolione " - -RUN apk add --no-cache --update ffmpeg -COPY *.py /app/ -COPY cache/ /app/cache/ -COPY data/ /app/data/ -COPY lib/ /app/lib/ -COPY plugins /app/plugins -COPY plugins_ext /app/plugins_ext -COPY known_stations.json /app/ -RUN touch /app/is_container - -ENTRYPOINT ["python3", "/app/tvh_main.py"] diff --git a/Dockerfile_tvh b/Dockerfile_tvh deleted file mode 100644 index 001ac47..0000000 --- a/Dockerfile_tvh +++ /dev/null @@ -1,14 +0,0 @@ -FROM python:3.8-alpine -LABEL maintainer="Thomas Gorgolione " - -RUN apk add --no-cache --update ffmpeg -COPY *.py /app/ -COPY cache/ /app/cache/ -COPY data/ /app/data/ -COPY lib/ /app/lib/ -COPY plugins /app/plugins -COPY plugins_ext /app/plugins_ext -COPY known_stations.json /app/ -RUN touch /app/is_container - -ENTRYPOINT ["python3", "/app/tvh_main.py"] diff --git a/README.md b/README.md index e19c484..23bb327 100644 --- a/README.md +++ b/README.md @@ -15,18 +15,9 @@ By default this app doesn't provide any video sources, only the plugins access t - Launch the app by running the command "python3 tvh_main.py". This should create a data folder and a config.ini inside that folder - Bring up browser and go to http://ip address:6077/ - From Plugins, install PlutoTV plugin -- Stop the app -- Edit the data/config.ini and add the following lines (Update: This is suppose to automatically happen in 0.9.14) -
-[plutotv_default]
-label = PlutoTV Instance
-
-- Launch the app by running the command "python3 tvh_main.py" -- Bring up browser and go to http://ip address:6077/ +- Restart Cabernet twice from Scheduled Tasks > Applications > Restart - Go to settings and make changes you want. - Logging: Change log level from warning to info if needed -- Enable the PlutoTV instance in the Settings page -- Restart the app (from the Scheduler/Applications) to have the plugin fully activate - From XML/JSON Links try some of the links ### 3. Services @@ -50,28 +41,16 @@ You can either use docker-compose or the docker cli. - armhf not available due to python cryptography only supports 64bit systems. [Cryptography supported platforms](https://cryptography.io/en/latest/installation/#supported-platforms) -#### docker-compose +#### a. Using docker-compose +To install Cabernet: ``` -version: '2.4' -services: - cabernet: - container_name: cabernet - image: ghcr.io/cabernetwork/cabernet:latest - environment: - - TZ="Etc/UTC" # optional - - PUID=1000 # optional - - PGID=1000 # optional - ports: - - "6077:6077" - - "5004:5004" - restart: unless-stopped - volumes: - - /path/to/cabernet/data:/app/data # optional - - /path/to/cabernet/plugins_ext:/app/plugins_ext # optional - - /path/to/cabernet/secrets:/app/.cabernet # optional +1. Grab the cabernet source and unpack into a folder +2. Edit docker-compose.yml and set the volume folder locations +3. docker-compose pull cabernet +4. docker-compose up -d cabernet ``` -#### docker cli +#### b. docker cli ``` docker run -d \ --name=cabernet \ @@ -87,8 +66,7 @@ docker run -d \ ghcr.io/cabernetwork/cabernet:latest ``` -#### Parameters - +##### Parameters | Parameter | Function | | :----: | :----: | | -p 6077 | Cabernet WebUI | @@ -100,7 +78,11 @@ docker run -d \ | -v /app/plugins_ext | External Plugins | | -v /app/.cabernet | Where encryption key is stored | -#### Updating Info +#### c. Other Docker Info +Cabernet configuration setting Clients > Web Sites > plex_docker_ip should be set to your computers IP address and not the internal IP inside the docker container. This will allow the channels.m3u file to have the correct IP address for streaming. + + +#### d. Updating Info **Via Docker Compose:** - Update the image: @@ -124,7 +106,7 @@ docker-compose up -d cabernet - You can also remove the old dangling images: ```docker image prune``` -#### Via Watchtower auto-updater +#### e. Via Watchtower auto-updater ``` docker run --rm \ -v /var/run/docker.sock:/var/run/docker.sock \ diff --git a/docker-compose.yml b/docker-compose.yml index cf65942..dfd32f7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,19 @@ +# Things to review/change: +# PUID/PGID change to the user running Cabernet +# Volumes: All volume paths are to be updated. The secrets folder +# contains the private key for encryption and should be protected. +# example volumes: +# - ../docker/cabernet/data:/app/data # App data (Optional) +# - ../docker/cabernet/plugins_ext:/app/plugins_ext # Plugins Data (Optional) +# - ../docker/cabernet/secrets:/app/.cabernet # Ecryption key data (Optional) +# This will add a docker folder at the same level as the cabernet source +# with the external folders for docker + version: '2.4' services: cabernet: container_name: cabernet - image: ghcr.io/cabernetwork/cabernet:latest + image: ghcr.io/cabernetwork/cabernet:dev environment: - TZ="Etc/UTC" # Timezone (Optional) - PUID=1000 # UserID (Optional) @@ -12,6 +23,6 @@ services: - "5004:5004" # Port used to stream restart: unless-stopped volumes: - - /path/to/cabernet/data:/app/data # App data (Optional) - - /path/to/cabernet/plugins_ext:/app/plugins_ext # Plugins Data (Optional) - - /path/to/cabernet/secrets:/app/.cabernet # Ecryption key data (Optional) + - ../docker/cabernet/data:/app/data # App data (Optional) + - ../docker/cabernet/plugins_ext:/app/plugins_ext # Plugins Data (Optional) + - ../docker/cabernet/secrets:/app/.cabernet # Ecryption key data (Optional) diff --git a/lib/common/utils.py b/lib/common/utils.py index e08464f..2c52b6b 100644 --- a/lib/common/utils.py +++ b/lib/common/utils.py @@ -37,7 +37,7 @@ import lib.common.exceptions as exceptions -VERSION = '0.9.14.03' +VERSION = '0.9.15.00-DEV01' CABERNET_URL = 'https://github.com/cabernetwork/cabernet' CABERNET_ID = 'cabernet' CABERNET_REPO = 'manifest.json' diff --git a/lib/db/datamgmt/data_mgmt_html.py b/lib/db/datamgmt/data_mgmt_html.py index a26f8c0..f6b3240 100644 --- a/lib/db/datamgmt/data_mgmt_html.py +++ b/lib/db/datamgmt/data_mgmt_html.py @@ -335,7 +335,7 @@ def backups(self): return html def del_backup(self, _folder): - valid_regex = re.compile('^([a-zA-Z0-9_.]+$)') + valid_regex = re.compile('^([a-zA-Z0-9_.-]+$)') if not valid_regex.match(_folder): self.logger.info('Invalid backup folder to delete: {}'.format(_folder)) return diff --git a/lib/resources/config_defn/clients.json b/lib/resources/config_defn/clients.json index 1a140bc..04b918c 100644 --- a/lib/resources/config_defn/clients.json +++ b/lib/resources/config_defn/clients.json @@ -20,11 +20,11 @@ "help": "Default: 0.0.0.0. Use instead of plex_accessible_ip. 0.0.0.0 means bind to all IPs and use the main IP address for json data" }, "plex_accessible_ip":{ - "label": "plex_accessible_ip", + "label": "plex_docker_ip", "type": "string", "default": "0.0.0.0", "level": 1, - "help": "The IP provided to the clients for http requests" + "help": "The IP provided to the clients for http requests. If using docker and video does not play, try changing this to your computer's IP" }, "bind_ip":{ "label": "bind_ip", @@ -35,7 +35,7 @@ "help": null }, "plex_accessible_port":{ - "label": "plex_accessible_port", + "label": "streaming_port", "type": "integer", "default": 5004, "level": 1,