cabernetwork / cabernet

Cabernet allows control of IPTV streams. Plugins supports DaddyLive, Pluto TV, XUMO, M3U/XMLTV.XML files (SamsungTV, STIRR, DistroTV, Plex TV)
https://cabernetwork.github.io
MIT License
176 stars 23 forks source link

Docker instructions are NOT working for cabernet, please help. #60

Closed Nostradamus1973 closed 1 year ago

Nostradamus1973 commented 1 year ago

Good morning Everyone,

I'm new to docker(and loving it), however, I'm having a terrible time trying to get this working in Portainer or as a docker itself.

Can someone please help me? I'm running Kubuntu 22.10 as an OS.

I really think this script could be amazing giving its' feature set, unfortunately the Docker instructions make little to no sense to me and I can't get Cabernet installed.

Thank you and have a nice day.

rocky4546 commented 1 year ago

First I am not an expert on Docker. I did get it running and tested, but I rely on others to let me know when it has an issue. That being said, I am running Ubuntu 20 and find it simple to run either in MS Windows or Linux as a service rather than a Docker. If you want to see the work we did on Docker, it is located here before moving to Cabernet. That may help. https://github.com/rocky4546/tvheadend-locast/issues/6 The file most people use is Dockerfile_tvh_crypt.alpine. Also, we do push updates on each commit to http://ghcr.io/cabernetwork/cabernet:latest so it should have the latest version. If you are interested in setting up Cabernet as a service, let me know.

cookieisland commented 1 year ago

I am using docker on Ubuntu 18.04.6 LTS. I do not use the docker image on ghcr.io because it does not contain the tvguide EPG provider.

What I do is clone the repos for cabernet and the tvguide epg from github. Here are the two github repos and the location I clone them to: https://github.com/cabernetwork/cabernet which I clone to /home/cookieisland/source/cabernet https://github.com/cabernetwork/provider_epg_tvguide which I clone to /home/cookieisland/source/provider_epg_tvguide

I then created a location to save the cabernet data directory and a file for the crypt key. In my case I create /home/cookieisland/docker/cabernet/config/data for my cabernet data directory and an empty file named /home/cookieisland/docker/cabernet/config/key.txt for the crypt key.

Then I use the following in my docker-compose.yaml file:

cabernet:
    build:
      context: /home/cookieisland/source/cabernet
      dockerfile: Dockerfile_tvh_crypt.alpine
    image: cabernet
    container_name: cabernet
    network_mode: host
    environment:
      - TZ="America/Los_Angeles"
      - PUID=1000
      - PGID=1000
    cpu_shares: 2048
    restart: unless-stopped
    volumes:
      - /home/cookieisland/docker/cabernet/config/data:/app/data
      - /home/cookieisland/docker/cabernet/config/key.txt:/root/.cabernet/key.txt

I also have an automated BASH script that updates the docker image whenever I want to pull the latest cabernet and tvguide repos. It ensures cabernet and tvguide are up to date and copies the correct tvguide subdirectory into the cabernet plugins_ext directory. The script looks like this:

#!/bin/bash
cd /home/cookieisland/source/provider_epg_tvguide
git pull
cd /home/cookieisland/source/cabernet
git pull
cp -ruv --preserve /home/cookieisland/source/provider_epg_tvguide/provider_epg_tvguide plugins_ext
cd /home/cookieisland/compose/htpc
docker compose up --build -d
rocky4546 commented 1 year ago

thank you cookieisland

Nostradamus1973 commented 1 year ago

@cookieisland Thank you for those instructions, I'm going to give it a try now.

Nostradamus1973 commented 1 year ago

Okay, so I did as you said, I changed the folders accordingly and used my username instead where applicable. When I went to edit my docker compose I saw this:

#locast2plex:
#   image: tgorg/locast2plex
#    ports:
#      - "6077:6077"
#      - "1900:1900/udp"
#    restart: unless-stopped
#    volumes:
 #     - ./config.ini:/app/config/config.ini

As you can see, I commented them out as I didn't want any confliction. Should I have left it? Also, once I finish what you you described, how do I start the docker? As I said before I'm new to docker, I would prefer to bring it in natively in portainer, however if it can only be start via command line then I'm down with that too. As for as your bash script, did you place it in /opt and add it to autostart? Or, are you running it as some sort of cron job? Thanks again

Nostradamus1973 commented 1 year ago

Another update, I've been pulling my hair out over this without any luck. LOL I keep doing things over and over and changing little things and not making any progress. This is a first for me with dockers, normally I would say docker has been good to me with ease of use and simplicity, Cabernet isn't following the same prescription.

I keep getting errors: Deployment error failed to deploy a stack: (root) Additional property cabernet is not allowed Currently my docker-compose.yaml looks like this:

cabernet:
    build:
      context: /home/nostradamus/source/cabernet
      dockerfile: Dockerfile_tvh_crypt.alpine
    image: cabernet
    container_name: cabernet
    network_mode: host
    environment:
      - TZ="America/New_York"
      - PUID=1000
      - PGID=1000
    cpu_shares: 2048
    restart: unless-stopped
    volumes:
      - /home/nostradamus/dockers/cabernet/config/data:/app/data
      - /home/nostradamus/dockers/cabernet/config/key.txt:/root/.cabernet/key.txt

When I go to deploy the stack within portainer I also get an unable to map volumes if I comment-out the first line "cabernet;" and add a ' in the beginning of the volumes and at end like this:

volumes:
      - '/home/nostradamus/dockers/cabernet/config/data:/app/data'
      - '/home/nostradamus/dockers/cabernet/config/key.txt:/root/.cabernet/key.txt'

Thanks again for all your help.

Nostradamus1973 commented 1 year ago

Would anyone be able to help me via Discord or Telegram? I figured real-time is always better to get things working. Especially because I'm really excited to get rolling on this app. Thx

cookieisland commented 1 year ago

Since my docker-compose uses "network:host" there is no need to expose the ports. It is good you commented out the locast2plex stuff. Locast does not exist anymore so that part of you docker-compose.yaml file is of no use. Also I only provided you with an excerpt of the docker-compose.yaml file. I assumed you had the other necessary stuff. Yours should look something like this:

version: '2.4'
services:
  cabernet:
    build:
      context: /home/nostradamus/source/cabernet
      dockerfile: Dockerfile_tvh_crypt.alpine
    image: cabernet
    container_name: cabernet
    network_mode: host
    environment:
      - TZ="America/New_York"
      - PUID=1000
      - PGID=1000
    cpu_shares: 2048
    restart: unless-stopped
    volumes:
      - /home/nostradamus/dockers/cabernet/config/data:/app/data
      - /home/nostradamus/dockers/cabernet/config/key.txt:/root/.cabernet/key.txt

Since the bash script is run on demand I put it in my home directory and only run it when I want to update cabernet to the latest version.

To start the docker container you just need to cd to the directory where you have your docker-compose.yaml file, which in my case is /home/cookieisland/compose/htpc, and then issue the following command: docker compose up -d

Alternatively if you need to rebuild the container then use this command (it will take some time to buid the container): docker compose up --build -d

I don't use portainer much so I can't help you there.

rocky4546 commented 1 year ago

Is there a docker-compose that we should have in the repo. I agree the locast stuff is outdated.

cookieisland commented 1 year ago

That makes sense @rocky4546

Lets hear from @Nostradamus1973 to see if the latest one I posted worked for him and if so that or a variant of it can be posted..... Maybe I can add some comments/instructions to it similar to the messages I sent previously. But lets see if he was able to get it working first.

Nostradamus1973 commented 1 year ago

Good morning Everyone,

So, I managed to change the docker compose file and Viola, it's running! But, now that it's running, I can't visit localhost:6077 to access the webserver. Should there be something like this in my yaml file?:

ports:
      - "5004:5004"    # Port used to stream
      - "6077:6077"    # Web Interface Port
      - "65001:65001"  # HDHomeRun Port 

Thank you for all your help and time.

rocky4546 commented 1 year ago

The 1900 and 65001 ports are really not needed. 65001 is the UDP port for HDHomerun devices, but most media server either have not implemented it or is not implemented correctly. So, that port is basically not needed. The 1900 port is for SSDP, which provides the DLNA interface. SSDP is implemented, but DLNA not quite there. The plan is to get DLNA available for cabernet so we can push video to other devices, but not for now. Both are enabled/disabled in the client settings, but probably not seen a need to enable at this time. I would keep the 6077 and 5004 ports only.

cookieisland commented 1 year ago

Yes, go ahead and put those ports statements in but 5004 and 6077 only. You should probably remove the 'network_mode:host' statement as well. Otherwise the ports statement(s) may be ignored.

Can you provide a log from your docker container? To get the log from your docker container use this command: docker logs cabernet

Nostradamus1973 commented 1 year ago

@rocky4546 Thx for the info. I changed my docker compose to this:

version: '2.4'
services:
  cabernet:
    build:
      context: /home/nostradamus/source/cabernet
      dockerfile: Dockerfile_tvh_crypt.alpine
    image: cabernet
    ports:
      - "5004:5004"    # Port used to stream
      - "6077:6077"    # Web Interface Port
    container_name: cabernet
    network_mode: host
    environment:
      - TZ="America/New_York"
      - PUID=1000
      - PGID=1000
    cpu_shares: 2048
    restart: unless-stopped
    volumes:
      - /home/nostradamus/dockers/cabernet/config/data:/app/data
      - /home/nostradamus/dockers/cabernet/config/key.txt:/root/.cabernet/key.txt

Unfortunately I still can't see any published ports.

nostradamus@xxxxxx:~$ docker logs cabernet

> eplustv@2.0.8 start
> ts-node index.ts

=== E+TV v2.0.8 starting ===
== ESPN+ Auth ==
Please open a browser window and go to: https://www.espn.com/watch/activate
Enter code:  XLMSBN

And here is a screenshot of Portainer running cabernet:

Thx again for your help.

cookieisland commented 1 year ago

Please remove the 'network_mode:host" statement from your yaml file.

The output from 'docker logs cabernet' is very strange. It looks like you are running EPlusTV and not cabernet. Can you do the following command and provide the output here? ls -al /home/nostradamus/source/cabernet

rocky4546 commented 1 year ago

Note: I will be pushing out a 0.9.12.0 today. It will move all plugins to plugin_ext. You may want to keep working with 0.9.11.* until you get things up and running.

Nostradamus1973 commented 1 year ago

@cookieisland I removed the 'network_mode:host" statement from my yaml file. Here is the output: nostradamus@xxxxxxxxxx:~$ ls -al /home/nostradamus/source/cabernet total 96 drwxrwxr-x 8 nostradamus nostradamus 4096 Apr 2 11:43 . drwxrwxr-x 4 nostradamus nostradamus 4096 Apr 2 11:43 .. drwxrwxr-x 3 nostradamus nostradamus 4096 Apr 2 11:43 build -rw-rw-r-- 1 nostradamus nostradamus 4146 Apr 2 11:43 CHANGELOG.md -rw-rw-r-- 1 nostradamus nostradamus 1554 Apr 2 11:43 CONTRIBUTING.md -rw-rw-r-- 1 nostradamus nostradamus 182 Apr 2 11:43 docker-compose.yml -rw-rw-r-- 1 nostradamus nostradamus 381 Apr 2 11:43 Dockerfile -rw-rw-r-- 1 nostradamus nostradamus 364 Apr 2 11:43 Dockerfile_l2p -rw-rw-r-- 1 nostradamus nostradamus 364 Apr 2 11:43 Dockerfile_tvh -rw-rw-r-- 1 nostradamus nostradamus 631 Apr 2 11:43 Dockerfile_tvh_crypt.alpine -rw-rw-r-- 1 nostradamus nostradamus 883 Apr 2 11:43 Dockerfile_tvh_crypt.slim-buster -rw-rw-r-- 1 nostradamus nostradamus 324 Apr 2 11:43 .dockerignore drwxrwxr-x 8 nostradamus nostradamus 4096 Apr 2 11:43 .git drwxrwxr-x 3 nostradamus nostradamus 4096 Apr 2 11:43 .github -rw-rw-r-- 1 nostradamus nostradamus 428 Apr 2 11:43 .gitignore drwxrwxr-x 15 nostradamus nostradamus 4096 Apr 2 11:43 lib -rw-rw-r-- 1 nostradamus nostradamus 1097 Apr 2 11:43 LICENSE drwxrwxr-x 6 nostradamus nostradamus 4096 Apr 2 11:43 plugins drwxrwxr-x 2 nostradamus nostradamus 4096 Apr 2 11:43 plugins_ext -rw-rw-r-- 1 nostradamus nostradamus 1597 Apr 2 11:43 README.md -rw-rw-r-- 1 nostradamus nostradamus 33 Apr 2 11:43 requirements.txt -rw-rw-r-- 1 nostradamus nostradamus 2961 Apr 2 11:43 TVHEADEND.md -rw-rw-r-- 1 nostradamus nostradamus 1794 Apr 2 11:43 tvh_main.py

Thank you

cookieisland commented 1 year ago

The directory looks good. However your docker cabernet container is running EPlusTV and not cabernet. I recommend that you delete your current cabernet container and images. I suspect you can do that via portainer but I will give you some command lines to clean things up.

These two commands should stop cabernet and then delete all stopped containers, images, etc. The bad thing is if you have other stopped docker containers it will delete them too and you may have to recreate them.

docker compose stop cabernet
docker system prune -af

After you run these commands then go and check portainer. You should see that all cabernet containers and images have all be deleted.

Once you have deleted all the cabernet containers, images, etc you should recreate your cabernet container and restart it. docker compose up --build -d

Hopefully when cabernet starts it will be cabernet and not EPlusTV.

cookieisland commented 1 year ago

once you get cabernet started please send the outpu of the following command: docker logs cabernet

I can talk via discord as well if you give me your id.

Nostradamus1973 commented 1 year ago

Hi @cookieisland I did as you said and completely removed it, unfortunately I can't get it to start and I have to run out and do some family stuff right now and won't be back till late.

Here's my discord handle: Nostradamus#9005 I should be available throughout the day tomorrow. Thanks a bunch for helping me out.

cookieisland commented 1 year ago

ok - i sent you a friend request on discord. we can chat tomorrow

cookieisland commented 1 year ago

I have discovered that the updates to cabernet over the last few weeks/months that allow it to update itself ends up causing bad things to happen to docker. The problem is docker does not like a container to change/update itself unless the changes are in a docker volume or in a bind mount. Eventually my entire root filesystem was full because /var/lib/docker/overlay2 kept growing and growing. Deleting the cabernet container didn't free up the space either so it was quite problematic. The problem that occurs is described here:

https://buisteven.medium.com/debugging-docker-overlay2-out-of-space-d1edc2ea412f

I really like docker because it gives a unique run time environment to each app preventing one app from messing up another so I have enhanced my docker configuration to fix the problem. I simply install cabernet's entire source code tree to a directory on the host and then map it to /app in the container. Previously I only mapped /app/data but now I am mapping the entire /app directory to the host. Now when cabernet updates itself it is not updating the file system in the container, instead it is updating the host directory that I mapped with a bind mount via a volume statement in docker-compose.yaml file

In my case I placed the cabernet source outside the container in /home/cookieisland/docker/cabernet/config/app. The cabernet data directory is /app/data which on my host equates to /home/cookieisland/docker/cabernet/config/app/data

Here is my new docker-compose.yaml file.

version: '2.4'
services:
  cabernet:
    container_name: cabernet
    image: ghcr.io/cabernetwork/cabernet:latest
    environment:
      - TZ="America/Los_Angeles"
      - PUID=1000
      - PGID=1000
    ports:
      - "6077:6077"
      - "5004:5004"
    restart: unless-stopped
    volumes:
      - /home/cookieisland/docker/cabernet/config/app:/app
      - /home/cookieisland/docker/cabernet/config/key.txt:/root/.cabernet/key.txt
rocky4546 commented 1 year ago

Well that makes things simpler. thanks for looking into this. I will update the yml file, but I suspect a header needs to be added as a comment (if possible) to explain how to setup and use.

Does the filename need to change to .yaml or leave it as .yml?

cookieisland commented 1 year ago

I will test for a few days and see if things work well. I am hoping that even if you make an update to ghcr.io/cabernetwork/cabernet:latest my new docker-compose.yaml will override it and wait for me to update cabernet via cabernet's update process.

cookieisland commented 1 year ago

I think yml or yaml are both valid names.

cookieisland commented 1 year ago

Found an error in my docker-compose.yaml file. Timezone was not being set. I should not have quoted TZ. This should fix it. I will keep testing as well.

version: '2.4'
services:
  cabernet:
    container_name: cabernet
    image: ghcr.io/cabernetwork/cabernet:latest
    environment:
      - TZ=America/Los_Angeles
      - PUID=1000
      - PGID=1000
    ports:
      - "6077:6077"
      - "5004:5004"
    restart: unless-stopped
    volumes:
      - /home/cookieisland/docker/cabernet/config/app:/app
      - /home/cookieisland/docker/cabernet/config/key.txt:/root/.cabernet/key.txt
etofi commented 1 year ago

I am currently creating my Docker container with the following command.

docker create \
--name=cabernet \
--net=macvlan \
--ip 192.168.178.165 \
--restart always \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Europe/Berlin \
-v /volume1/docker/Cabernet/data:/app/data \
ghcr.io/cabernetwork/cabernet:latest

This all works, but unfortunately I have to install the PlutoTV addon every time there is a container update over WatchTower. That is why I have added the plugins_ext directory as a volume. Unfortunately, an installed addon is then not recognised. What am I doing wrong?

docker create \
--name=cabernet \
--net=macvlan \
--ip 192.168.178.165 \
--restart always \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Europe/Berlin \
-v /volume1/docker/Cabernet/data:/app/data \
-v /volume1/docker/Cabernet/plugins_ext:/app/plugins_ext \
ghcr.io/cabernetwork/cabernet:latest
rocky4546 commented 1 year ago

In the cabernet web page, go to the Settings > Internal > Paths and make sure you have the plugins in the "Root Path" + "External Plugins Package" folder

etofi commented 1 year ago

In the cabernet web page, go to the Settings > Internal > Paths and make sure you have the plugins in the "Root Path" + "External Plugins Package" folder

I think I have this already

grafik

rocky4546 commented 1 year ago

it is possible because the plugins_ext folder is included in the app, that docker wants to control it. I could add code to auto-gen the folder if it does not exists and see if that will fix it.

So you are saying the folder /volume1/docker/Cabernet/pluginsext contains the file __init_\.py and plugin folders with subfiles, but when you look at the folder in docker, the app_plugins_ext is empty?

I just pushed out a docker image without the plugins_ext folder embedded, so you should be able to mount your volume.

dcardin commented 1 year ago

I was about to suggest auto recreating plugins_ext. Thanks for the .03 release!

etofi commented 1 year ago

I just pushed out a docker image without the plugins_ext folder embedded, so you should be able to mount your volume.

Fixed it - Thanks

Nostradamus1973 commented 1 year ago

Okay, just an update, @cookieisland has been helping me via Discord and this morning I decided to pull a new docker image and Holy Macaroni Cabernet's webserver started working just like that. Thx @cookieisland for helping me to get this working, if it's okay, can I also ask for help setting things up via Discord if I get stuck?

dcardin commented 1 year ago

Sorry for piggybacking but perhaps it would be good to have a cabernet discord, help foster discussions around the project?

rocky4546 commented 1 year ago

Glad it is working. Closing issue

Nostradamus1973 commented 1 year ago

Good morning Everyone,

I've been working with @cookieisland to get things rolling in Docker and he's been awesome, but, now I've gotten stuck on my config.ini file and it was conveyed to me that @rocky4546 is the best to try and figure out the mess I've gotten myself into. lol

@rocky4546 Would this be the best thread to continue on/in or would you like to move this into a new one?

Before I drop my config details on here, allow me to explain what's been happening with Jellyfin 10.8.9, the problems I'm experiencing are parts of my guide look good, except the numbering seems to resemble the meta data, if that makes sense. On other parts of my guide the icons are gone and others the channel name is there and the rest is void.

config.ini:


[hdhomerun]
hdhr_id = 105029CB

[display]
theme = blueradiance
display_level = 3-Advanced

[tvguide]
enabled = True

[epg]
genre = normal
epg_prettyprint = True

[daddylive_default]
label = DaddyLive Instance
enabled = True
channel-import_groups = False
player-enable_url_filter = False
epg-prefix = 3000
channel-start_ch_num = 1

[tvguide_daddylive]
label = TVGuide DaddyLive
enabled = True

[daddylive]
enabled = True
epg-plugin = ALL

[m3u_default]
enabled = True
label = m3u_default

[m3u_PlexTV]
enabled = True
label = m3u_PlexTV
channel-m3u_file = https://i.mjh.nz/Plex/us.m3u8
epg-xmltv_file = https://i.mjh.nz/Plex/us.xml

[m3u_SamsungTV]
enabled = True
label = m3u_SamsungTV
player-tuner_count = 20
channel-m3u_file = https://i.mjh.nz/SamsungTVPlus/us.m3u8
epg-xmltv_file = https://i.mjh.nz/SamsungTVPlus/us.xml
epg-prefix = 4000

[plutotv_default]
enabled = True
label = plutotv_default
epg-plugin = ALL
channel-thumbnail = colorLogoPNG
epg-enabled = True
epg-prefix = 4500
channel-start_ch_num = 1

[tvguide_plutotv]
label = TVGuide PlutoTV
enabled = True

[plutotv]
enabled = True
epg-plugin = ALL

[xumo_default]
enabled = True
label = xumo_default
epg-plugin = ALL
epg-prefix = 5000
channel-start_ch_num = 1

[xumo]
channellistid = 10006
enabled = True
epg-plugin = ALL

[tvguide_xumo]
label = TVGuide Xumo
enabled = True

[m3u_samsungtv]
enabled = 1
channel-start_ch_num = 1

[m3u_plextv]
enabled = 1
epg-xmltv_file_type = xml
epg-prefix = 3500
channel-start_ch_num = 1

[tvguide_default]
label = TVGuide Instance
enabled = True

There you go, I know it looks VERY rough, but, I was trying a few different things in an effort to get things running properly.

Thank you :)