Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker Settings #6

Open
rocky4546 opened this issue Apr 5, 2021 · 15 comments
Open

Docker Settings #6

rocky4546 opened this issue Apr 5, 2021 · 15 comments
Labels
question Further information is requested

Comments

@rocky4546
Copy link
Owner

rocky4546 commented Apr 5, 2021

The .alpine and .slim-buster Docker file gives the following error:
ERROR: Config file missing, Exiting...
Adding the following line to either makes the docker run without error.
COPY *.ini /app/
Question is... how is it working for the developers when it seems to be missing the line?

@rocky4546
Copy link
Owner Author

This issue is to mainly determine the end structure to use to support the different environments especially docker.

As for folder structure, an effective docker container would provide the static files to the /apps area while providing the data and cache area that changes to an area mounted externally. Since the configuration definition files are static, they should be moved into the lib folder. I recommend placing them into a resource folder that would contain other resources such as a language area. The other non-python area is the web area that contains the html, javascript, images, and css files that are directly provided to the web port.

The web interface is unique, in that, it also contains dynamic files that are created based on other data. These could be templates or even python CGI type files. It would make sense to place the dynamic files somewhere near the web static files.

The config.ini file should be searched in the ./data area or the top level folder, but since the data area is unknown until after the config file is loaded, the config.ini file path must be passed into the application as an argument if not in a default location.

@rocky4546 rocky4546 added the question Further information is requested label Apr 5, 2021
@rocky4546
Copy link
Owner Author

Here is what I have determine. With the Dockerfile NOT containing the ini file, the following command can be used once the container is built.
sudo docker run -p 6077:6077 -v [location of the data area]:/app/data -rm tvh8.0.0-alpha001
This command will run the docker app with the data folder containing the data files from an external mount point. This allows for the data and cache to be updated. Note the config.ini file is located in the data folder. The 6077:6077 also provides an external port so the website can be used externally.

EMBY: automatic detection requires

  1. HDHomerun protocol to be enabled
  2. web-admin port on port 80
  3. IP of the App is on the same primary network as Emby (Docker 172.* network does not work due to Emby broadcasting on 255.255.255.255 local network only)

EMBY: manual detection requires

  1. HDHomerun protocol to be enabled
    This will work with Docker 172 networks

PLEX: automatic detection requires

  1. HDHomerun protocol enabled
  2. SSDP protocol enabled
  3. web-admin port on port 80
  4. IP of the App is on the same primary network as Plex

PLEX: manual detection requires

  1. HDHomerun protocol enabled
    This will work with Docker 172 networks

For Docker, first build the container with
sudo docker build . -f Dockerfile_tvh_crypt.alpine -t [tag to use]
Then to run the container
sudo docker run -p 6077:6077 -v [location of data directory on server]:/app/data --rm [tag used earlier]

For the config.ini file associated with Docker... there are no special changes for Docker.

@rocky4546 rocky4546 changed the title Docker getting ERROR: missing config file Docker Settings Apr 6, 2021
@rocky4546
Copy link
Owner Author

There is a chance if Plex or Emby was installed in a Docker container that the ability to communicate across the 172 network between Emby/Plex and the app is possible. This would make it possible that the automatic detection would be enabled. Complexity of the docker install of Emby/Plex is very high, so it will not be tested.

@cookieisland
Copy link
Contributor

cookieisland commented Apr 12, 2021

For the alpine and slim buster dockerfiles I use them with docker-compose and I provide with an ini and key file via a volume statement. That way I keep my configuration files in my docker directory and out of the source directory. Here is what my docker-compose file looks like:

tvheadend-locast:
   build:
     context: /home/cookieisland/source/tvheadend-locast
     dockerfile: Dockerfile_tvh_crypt.slim-buster
   image: tvheadend-locast
   container_name: tvheadend-locast
   environment:
     TZ: "America/Los_Angeles"
   network_mode: "host"
   cpu_shares: 2048
   restart: unless-stopped
   volumes:
     - /home/cookieisland/docker/tvheadend-locast/config/config.ini:/app/config/config.ini
     - /home/cookieisland/docker/tvheadend-locast/config/key.txt:/root/.locast/key.txt

@cookieisland
Copy link
Contributor

wait - I just tried using your new commit and I am now also getting
ERROR: Config file missing, Exiting...

@cookieisland
Copy link
Contributor

I figured it out. After your latest commit the config.ini file now must be located in /app/config.ini. Previously it could be located in /app/config/config.ini. I modified my docker-compose volume statement and I am running again. Here is my latest docker-compose.yaml that now works again.

tvheadend-locast:
   build:
     context: /home/cookieisland/source/tvheadend-locast
     dockerfile: Dockerfile_tvh_crypt.slim-buster
   image: tvheadend-locast
   container_name: tvheadend-locast
   environment:
     TZ: "America/Los_Angeles"
   network_mode: "host"
   cpu_shares: 2048
   restart: unless-stopped
   volumes:
     - /home/cookieisland/docker/tvheadend-locast/config/config.ini:/app/config.ini
     - /home/cookieisland/docker/tvheadend-locast/config/key.txt:/root/.locast/key.txt

@rocky4546
Copy link
Owner Author

To simplify things, I moved the config file to /app/data/config.ini. That way, the cache, db and config.ini file can exist outside of the source easily. Most people will have the config.ini at the top level, but for Docker, you should put it into the data area. I use the option
-v [location of data directory on server]:/app/data
to define where the data folder resides. I had not thought about the encryption key and Docker, but I see you have it also addressed.

@rocky4546
Copy link
Owner Author

question... Almost ready to checkin an update. One change is the ability to easily define config variables such as where things are used or stored. This makes it available to change. Do you think the key location should be available in the path list? My thought is that it is suppose to be in a remote area from the app to keep the private key from being compromised. Showing where it is located is an issue for me. Just wondering, since you placed it with the config file.

@cookieisland
Copy link
Contributor

cookieisland commented Apr 13, 2021 via email

@cookieisland
Copy link
Contributor

cookieisland commented Apr 13, 2021 via email

@rocky4546
Copy link
Owner Author

Understand on the encryption. Slowly updating the wiki pages, but will update the docker page. For the next update, have a new folder called plugins at the top level. Will update docker files to add it. It has some initial data for base testing. Also, moved around a number of folders inside lib since we are moving further away from locast2plex source. I try to do some PEP cleanup each push. Once that is complete, will checkin updates.

@rocky4546
Copy link
Owner Author

rocky4546 commented Apr 13, 2021

Added a section on Docker in the Wiki installation instructions. Found a solution on the key file and added it to the Wiki. With my limited Docker knowledge, locast2plex has a docker-compose.yml file that probably needs to be updated. It uses relative paths, but using -v on the command line can only use absolute paths. Never used docker-compose, so will need to learn about that, but using relative paths may make it a more consistent solution. The key is located in the home folder, so if we can also use environment variables like $HOME, the docker-compose.yml would be able to be a stable file.

@cookieisland
Copy link
Contributor

In my opinion the best thing to do with Docker is not require your users to download and build their own image. With all the docker images I use the developer generated the image and then uploaded it to a repository like dockerhub.

Here is an example. I use tvheadend and I do not have to download source code. All I do is add the recommended docker-compose code to my docker-compose.yaml file and modify per the documentation.

https://hub.docker.com/r/linuxserver/tvheadend

@rocky4546
Copy link
Owner Author

I agree completely. Just need the time to set it up. Plans include adding debian installers, pip installer as well. I already completed a Windows installer and that is still working. Maybe after I get this plugin thing working, we can look at adding the different installers.

@cookieisland
Copy link
Contributor

No worries. tvheadend-locast works great for me and I will continue to it and test your new versions as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants