unofficial Docker Container for Record Engine

Downloads & Instructions
Post Reply
AnalogBill
Posts: 22
Joined: Wed Aug 11, 2021 6:23 am
Location: Fort Wayne, Indiana

Re: unofficial Docker Container for Record Engine

Post by AnalogBill »

Running/recording for an hour. Stopped container to look at permissions

Code: Select all

drwxrwxrwx+ 1 root root       0 Jul 14 17:32 dvr
-rwxrwxrwx+ 1 dvr   400     127 Jul 14 18:59 dvr.conf
-rwxr-xr-x  1 dvr   400 1983318 Mar  3 13:39 hdhomerun_record
drwxrwxrwx+ 1 root root      52 Jul 14 17:32 http
drwxrwxrwx+ 1 root root      54 Jul 14 17:32 php
Change max record streams to 0 and restarted. No errors.
Wonder if the other files need to be owned by root?
Previously I had chowned dvr:dvr the entire folder thinking "can't hurt". Maybe not true?

demonrik
Posts: 1591
Joined: Mon May 04, 2015 10:03 am
Device ID: 108042A1, 10814D8E
x 38

Re: unofficial Docker Container for Record Engine

Post by demonrik »

AnalogBill wrote: Thu Jul 14, 2022 5:36 pm Running/recording for an hour. Stopped container to look at permissions

Code: Select all

drwxrwxrwx+ 1 root root       0 Jul 14 17:32 dvr
-rwxrwxrwx+ 1 dvr   400     127 Jul 14 18:59 dvr.conf
-rwxr-xr-x  1 dvr   400 1983318 Mar  3 13:39 hdhomerun_record
drwxrwxrwx+ 1 root root      52 Jul 14 17:32 http
drwxrwxrwx+ 1 root root      54 Jul 14 17:32 php
Change max record streams to 0 and restarted. No errors.
Wonder if the other files need to be owned by root?
Previously I had chowned dvr:dvr the entire folder thinking "can't hurt". Maybe not true?
If it's working - leave it alone :)
those other files/folders can be left as root. They are used by the internal apps which do start as root, but then fork to dvr user once the configuration files are read.

Looks like things are running well.
Let me know if you have any other issues - I will get the user thing fixed soon along with some cleanup tasks.
Then I've gotta figure out a php8 story for alpine 3.16+ :(

AnalogBill
Posts: 22
Joined: Wed Aug 11, 2021 6:23 am
Location: Fort Wayne, Indiana

Re: unofficial Docker Container for Record Engine

Post by AnalogBill »

Yes, running well. Thanks so much for your help.
Next steps include: how to force a record engine to be primary when it has less free disk space. Quotas on dvr user had no effect. Setting the recordstreams=0 causes the engine to report freespace=Full. Not my kind of logic :lol:
Assume that at some point the docker install will have a newer record engine than my spk v1.1.1 install. May try running both on same nas and see what happens. :idea:

Online
signcarver
Expert
Posts: 11079
Joined: Wed Jan 24, 2007 1:04 am
Device ID: 10A05954 10802091 131B34B7 13231F92 1070A18E 1073ED6F 15300C36
x 35

Re: unofficial Docker Container for Record Engine

Post by signcarver »

It's all based on available space unless you hit the max streams specified then it falls over. By setting max to 0 it can't record (thus why it reports no space) but can serve recordings. Typically what you could do is archive (move) files over to the one you don't want to record as needed but set that max to 0... make sure engines can see each other to not rerecord. You may also be able to fake such by having multiple paths as it only records to first one specified so influence that directories free space.

TBlankenheim
Posts: 101
Joined: Wed May 27, 2015 9:15 am
Device ID: 107BBE13, 10782AED
Location: Madison, WI
x 2

Re: unofficial Docker Container for Record Engine

Post by TBlankenheim »

I finally got around to bringing up this docker on my Synology NAS (DS918+) as a failover to my UNRAID server. I followed the procedure posted here: viewtopic.php?p=384521#p384521
The record engine was not starting due to a permission problem. Ownership for hdhomerun_record was set to dvr:dvr, however the only permissions on the file was user execute permission (u+x).

I modified hdhomerun.sh so that read permissions were also added to hdhomerun_record. Here is the modified code:

Code: Select all

	echo ${DVR_PFX} "Downloading latest release"
	wget -qO ${DVRData}/${DVRBin}_rel ${DownloadURL}
	if [ "$BetaEngine" -eq "1" ]; then
		echo ${DVR_PFX} "Downloading latest beta"
		wget -qO ${DVRData}/${DVRBin}_beta ${BetaURL}
		echo ${DVR_PFX} "Comparing which is newest"
		if [[ ${DVRData}/${DVRBin}_rel -nt  ${DVRData}/${DVRBin}_beta ]] ; then
			echo ${DVR_PFX} "Release version is newer - selecting as record engine"
			mv ${DVRData}/${DVRBin}_rel ${DVRData}/${DVRBin}
			rm ${DVRData}/${DVRBin}_beta
			chmod u+r+x ${DVRData}/${DVRBin}
			chown ${HDHR_USER}:${HDHR_GRP} ${DVRData}/${DVRBin}
		elif [[ ${DVRData}/${DVRBin}_rel -ot  ${DVRData}/${DVRBin}_beta ]]; then
			echo ${DVR_PFX} "Beta version is newer - selecting as record engine"
			mv ${DVRData}/${DVRBin}_beta ${DVRData}/${DVRBin}
			rm ${DVRData}/${DVRBin}_rel
			chmod u+r+x ${DVRData}/${DVRBin}
			chown ${HDHR_USER}:${HDHR_GRP} ${DVRData}/${DVRBin}
		else
			echo ${DVR_PFX} "Both versions are same - using the Release version"
			mv ${DVRData}/${DVRBin}_rel ${DVRData}/${DVRBin}
			rm ${DVRData}/${DVRBin}_beta
			chmod u+r+x ${DVRData}/${DVRBin}
			chown ${HDHR_USER}:${HDHR_GRP} ${DVRData}/${DVRBin}
		fi
	else
		echo ${DVR_PFX} "Not using Beta Versions - defaulting to Release Version"
		mv ${DVRData}/${DVRBin}_rel ${DVRData}/${DVRBin}
		chmod u+r+x ${DVRData}/${DVRBin}
		chown ${HDHR_USER}:${HDHR_GRP} ${DVRData}/${DVRBin}
	fi
Not sure if that was the desired method to correct this problem, but it worked for me. My NAS is running DSM 7.1 Update 3.

Is it the expected behavior of wget to create a file with no default permissions? Just speculating!

Hope this is useful as you work on this project.

clarkss12
Posts: 1479
Joined: Sat May 11, 2013 11:51 am
Device ID: 1055A951;10781466;1080270E;153070FD;
Location: Michigan, USA
x 6
Contact:

Re: unofficial Docker Container for Record Engine

Post by clarkss12 »

I don't have a clue what I am doing. But I am trying to get your HDHomeRun engine docker to run under CoreELEC running on one of my inexpensive Android TV boxes.

I installed Docker onto my CoreELEC box. Using Putty, I pasted your command into the putty command window >>
docker run -d --name dvr \
--restart=unless-stopped \
--network host \
-v /path/to/hdhomerun/tempdata:/dvrdata \
-v /path/to/hdhomerun/recordings:/dvrrec \
demonrik/hdhrdvr-docker

This is the error that showed up..... I only know enough Linux to get into trouble.
--restart=unless-stopped \
--network host \
-v /path/to/hdhomerun/tempdata:/dvrdata \
-v /path/to/hdhomerun/recordings:/dvrrec \
demonrik/hdhrdvr-docker
Unable to find image 'demonrik/hdhrdvr-docker:latest' locally
latest: Pulling from demonrik/hdhrdvr-docker
57fb4b5f1a47: Pulling fs layer
79b2145c0dc9: Pulling fs layer
61244a46def7: Pulling fs layer
319c1bb3168f: Pulling fs layer
300b16d9af7b: Pulling fs layer
0ec55866d92c: Pulling fs layer
0ec55866d92c: Waiting
51a2c2592820: Waiting
93aa6817508e: Waiting
2baebd151fff: Pull complete
90c1cf83cb14: Pull complete
4f4fb700ef54: Pull complete
c4899a263db1: Pull complete
68c13142d0db: Pull complete
fa77ea3b6b65: Pull complete
1738a738371c: Pull complete
6319a293b766: Pull complete
3c1f5d1cbcfe: Pull complete
b24826098a2d: Pull complete
ddda957360a0: Pull complete
410f7131db70: Pull complete
ad9b2dca15dc: Pull complete
d5d926b14ed4: Pull complete
aa8c81715c8d: Pull complete
61d53f246f2b: Pull complete
e1a53b566b4b: Pull complete
cbdf7f868ff9: Pull complete
932a44f865b0: Pull complete
f8402ace9080: Pull complete
f676ffd83cc3: Pull complete
f120468ba649: Pull complete
b7118a10d047: Pull complete
Digest: sha256:e0ee3e3a483ce9bcd2f93bc2f655b595902e261350de6f64f4a25a93c878cb4e
Status: Downloaded newer image for demonrik/hdhrdvr-docker:latest
cdc425ae193a00a2fc39167af8cf949bd3cfd4fd51ac18b2944dbff697d008eb
docker: Error response from daemon: error while creating mount source path '/pat h/to/hdhomerun/tempdata': mkdir /path: read-only file system

Jsherman
Posts: 180
Joined: Mon Jul 20, 2015 1:59 am

Re: unofficial Docker Container for Record Engine

Post by Jsherman »

The part listed below initially tripped me up on my Unraid setup.

-v /path/to/hdhomerun/tempdata:/dvrdata \
-v /path/to/hdhomerun/recordings:/dvrrec \

You will need to change the "/path/to/hdhomerun/recordings" to a path where you want the recordings to be stored. Same with the Tempdata.

For example my recordings are stored in the path below...

/mnt/user/Recorded_TV/HDHomeRun/recordings

My tempdata is stored in the path below

/mnt/user/Recorded_TV/HDHomeRun/config

so my paths in the script needed to be changed from the original

-v /path/to/hdhomerun/tempdata:/dvrdata \
-v /path/to/hdhomerun/recordings:/dvrrec \

to

-v /mnt/user/Recorded_TV/HDHomeRun/config:/dvrdata \
-v /mnt/user/Recorded_TV/HDHomeRun/recordings:/dvrrec \

Hope that helps!

clarkss12
Posts: 1479
Joined: Sat May 11, 2013 11:51 am
Device ID: 1055A951;10781466;1080270E;153070FD;
Location: Michigan, USA
x 6
Contact:

Re: unofficial Docker Container for Record Engine

Post by clarkss12 »

Jsherman wrote: Sun Jul 31, 2022 12:00 am The part listed below initially tripped me up on my Unraid setup.

-v /path/to/hdhomerun/tempdata:/dvrdata \
-v /path/to/hdhomerun/recordings:/dvrrec \

You will need to change the "/path/to/hdhomerun/recordings" to a path where you want the recordings to be stored. Same with the Tempdata.

For example my recordings are stored in the path below...

/mnt/user/Recorded_TV/HDHomeRun/recordings

My tempdata is stored in the path below

/mnt/user/Recorded_TV/HDHomeRun/config

so my paths in the script needed to be changed from the original

-v /path/to/hdhomerun/tempdata:/dvrdata \
-v /path/to/hdhomerun/recordings:/dvrrec \

to

-v /mnt/user/Recorded_TV/HDHomeRun/config:/dvrdata \
-v /mnt/user/Recorded_TV/HDHomeRun/recordings:/dvrrec \

Hope that helps!
I tried those commands, but I have to learn about giving the permissions. I did that years ago, but have forgotten. Getting too old to rack my brain again.... :)

AnalogBill
Posts: 22
Joined: Wed Aug 11, 2021 6:23 am
Location: Fort Wayne, Indiana

Re: unofficial Docker Container for Record Engine

Post by AnalogBill »

You may not need to, the build script creates the dvr user and group and then sets the permissions. So after creating your mount point folders modify the docker run with the new paths, and run it again.
The script contains:

Code: Select all

# Create default user and group & patch up permissions
RUN addgroup -g 1000 dvr
RUN adduser -HDG dvr -u 1000 dvr
If your system doesn't like 1000:1000 for the user:group you can fix that.
You can check before and after by logging into your filesystem and running "ls -l"

clarkss12
Posts: 1479
Joined: Sat May 11, 2013 11:51 am
Device ID: 1055A951;10781466;1080270E;153070FD;
Location: Michigan, USA
x 6
Contact:

Re: unofficial Docker Container for Record Engine

Post by clarkss12 »

AnalogBill wrote: Sun Jul 31, 2022 8:52 am You may not need to, the build script creates the dvr user and group and then sets the permissions. So after creating your mount point folders modify the docker run with the new paths, and run it again.
The script contains:

Code: Select all

# Create default user and group & patch up permissions
RUN addgroup -g 1000 dvr
RUN adduser -HDG dvr -u 1000 dvr
If your system doesn't like 1000:1000 for the user:group you can fix that.
You can check before and after by logging into your filesystem and running "ls -l"
Ran that script, and got this message

CoreELECHK1Rbox:~ # # Create default user and group & patch up permissions
RUN addgroup -g 1000 dvr
RUN adduser -HDG dvr -u 1000 dvr
-sh: RUN: command not found
-sh: RUN: command not found
CoreELECHK1Rbox:~ #

Online
signcarver
Expert
Posts: 11079
Joined: Wed Jan 24, 2007 1:04 am
Device ID: 10A05954 10802091 131B34B7 13231F92 1070A18E 1073ED6F 15300C36
x 35

Re: unofficial Docker Container for Record Engine

Post by signcarver »

That's not something to be run from the prompt... that is part of the docker script (the user was telling you that you shouldn't have to worry about such as it is ALREADY there). If your system doesn't like 1000 change it in that file roughly around line 52 I believe.

Your problem was not specifying the correct paths of where things are going... you will have to know the folder structure of your system to know how to specify such

I believe typically in CoreELEC, your path would be something like /var/media/HardDriveName/RecordedTVFolder (you will have to find the name of the drive in /var/media and the folder at the end is the folder you wish to save your recordings to) I don't have a CoreELEC setup right now so can't really say.... in some cases it may be the old /dev/sd?? methods (the ?? would vary by system but my understanding is most drives should auto mount in /var/media now)

clarkss12
Posts: 1479
Joined: Sat May 11, 2013 11:51 am
Device ID: 1055A951;10781466;1080270E;153070FD;
Location: Michigan, USA
x 6
Contact:

Re: unofficial Docker Container for Record Engine

Post by clarkss12 »

signcarver wrote: Sun Jul 31, 2022 12:00 pm That's not something to be run from the prompt... that is part of the docker script (the user was telling you that you shouldn't have to worry about such as it is ALREADY there). If your system doesn't like 1000 change it in that file roughly around line 52 I believe.

Your problem was not specifying the correct paths of where things are going... you will have to know the folder structure of your system to know how to specify such

I believe typically in CoreELEC, your path would be something like /var/media/HardDriveName/RecordedTVFolder (you will have to find the name of the drive in /var/media and the folder at the end is the folder you wish to save your recordings to) I don't have a CoreELEC setup right now so can't really say.... in some cases it may be the old /dev/sd?? methods (the ?? would vary by system but my understanding is most drives should auto mount in /var/media now)
That is a little over my head.

demonrik
Posts: 1591
Joined: Mon May 04, 2015 10:03 am
Device ID: 108042A1, 10814D8E
x 38

Re: unofficial Docker Container for Record Engine

Post by demonrik »

clarkss12 wrote: Sun Jul 31, 2022 1:09 pm That is a little over my head.
I would recommend you install Portainer first.
see https://docs.portainer.io/v/ce-2.9/star ... cker/linux

This will help remove some of the confusion for you.

Once that is installed you need to consider a few things
  • you need a folder to store config files somewhere in the system, create it, and get the full path name to it - e.g. SSH to the device and cd to that folder then execute the command 'pwd' without the ' of course
  • will need somewhere to record files to - so again create a folder and get the full path
  • make sure your dvr user owns these folders -> for each folder, cd to it and execute the command 'chown -R dvr:dvr .'
Now you have all the info and setup done, is time to shift to portainer.
See my post here for Asustor - is basically the same once you get to Portainer
Just remember to add the environment variable for the DVRUI_PORT if you need to move off port 80

Am working on the user ID bit - hoping to fix that today which will help a lot when it comes to running the container on synology

demonrik
Posts: 1591
Joined: Mon May 04, 2015 10:03 am
Device ID: 108042A1, 10814D8E
x 38

Re: unofficial Docker Container for Record Engine

Post by demonrik »

TBlankenheim wrote: Fri Jul 29, 2022 8:58 pm I finally got around to bringing up this docker on my Synology NAS (DS918+) as a failover to my UNRAID server. I followed the procedure posted here: viewtopic.php?p=384521#p384521
The record engine was not starting due to a permission problem. Ownership for hdhomerun_record was set to dvr:dvr, however the only permissions on the file was user execute permission (u+x).

I modified hdhomerun.sh so that read permissions were also added to hdhomerun_record. Here is the modified code:
<snip>
Not sure if that was the desired method to correct this problem, but it worked for me. My NAS is running DSM 7.1 Update 3.

Is it the expected behavior of wget to create a file with no default permissions? Just speculating!

Hope this is useful as you work on this project.
I think something has changed with wget
I've done similar - modified it now to u+rwx for the binary.
Should be updated soon - having some issues with docker desktop on my build server, so I'd hold off update until later today as partial builds are being pushed up but not complete.

demonrik
Posts: 1591
Joined: Mon May 04, 2015 10:03 am
Device ID: 108042A1, 10814D8E
x 38

Re: unofficial Docker Container for Record Engine

Post by demonrik »

NEW VERSION
whoop - PUID/PGID is working!!
Latest build just pushed to dockerhub - some repos like Unraid may take a few hours to see the update.

Important
If no PUID/PGID is specified through environment variables then it will default to root for the dvr engine.
I see 1 or 2 issues there, and am working through it. but wanted to get the update out.

Recommendation for Updating
I would suggest you stop the existing container and blow up the /dvrdata folder - i.e. remove all the files in there and start with a fresh install
You can modify the dvr.conf once the update has completed.

Example new command line with the 2 new environment variables in red
docker run -d --name dvr \
--network host \
-e DVRUI_PORT=59080 \
-e PUID=1000 \
-e PGID=1000 \
-v /dvr/deploy/data:/dvrdata \
-v /dvr/recordings:/dvrrec \
demonrik:hdhrdvr-docker:latest
replacing DVRUI_PORT, PUID, and PGID and volume mappings (all the stuff in green) with your own values.
As ever --network host remains a mandatory setting to find your tuners.

If using some GUI or Portainer - make sure to add the Environment Variables

Note - the container will chown everything in /dvrdata and /dvrrec to the PUID/PGID if used.

EDIT: removed typo in the command line example
Last edited by demonrik on Mon Aug 01, 2022 8:19 am, edited 2 times in total.

Post Reply