tunarr icon indicating copy to clipboard operation
tunarr copied to clipboard

Unraid Application

Open adrianipopescu opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe. Have the ability to easily install the application on Unraid Docker

Describe the solution you'd like Build a template and publish it on the Unraid CA store

Describe alternatives you've considered Manual deployments in Podman on a VM / Docker CLI, but not fun and it isn't persisted.

Additional context Could be very useful to also bring more community attention / contributions to the project.

adrianipopescu avatar May 14 '24 13:05 adrianipopescu

Thanks for the suggestion! I'm going to mark this as "help wanted" for now, since (if I'm reading correctly) getting the necessary generated config to submit your app for approval to the CA suggests that you must use Unraid (https://forums.unraid.net/topic/57181-docker-faq/#comment-566084). That said, I'm sure there are plenty of examples out there that we could cargo cult off of; but we'd still appreciate any help here!

chrisbenincasa avatar May 16 '24 11:05 chrisbenincasa

I write a lot of Unraid templates, and came here specifically to figure out how to set up this container to write a template for it. Running into a Node issue inside the container following the dev compose file. If you have a better compose stack that I can follow, I can translate that into an Unraid template and get this on the Unraid CA store immediately.

nwithan8 avatar May 26 '24 03:05 nwithan8

Thanks! That dev compose is a WIP (and it's meant for running the dev app in a local container for debugging, etc).

The compose file in the docs is probably closer to what you want: https://tunarr.com/getting-started/setup/

I'm not sure how this translates to Unraid templates, but there are a couple options that are dependent on the user's personal setup (e.g. changing the image / runtime params for hw accel, adding in the dizquetv folder as a volume if they are migrating, exposed port etc):

Here is another example I just tested out locally

version: '3.8'
services:
  tunarr:
    # image: chrisbenincasa/tunarr:edge
    # Uncomment along with runtime below to enable HW accel
    image: chrisbenincasa/tunarr:edge-nvidia
    container_name: tunarr
    ports:
      - 8088:8000
    # Uncomment if using the Nvidia container
    runtime: nvidia
    # volumes:
      # The host path is relative to the location of the compose file
      # This can also use an absolute path. 
      # 
      # Uncomment if migrating from dizquetv. Chnage the host path
      # to the location of your dizquetv "database"
      # - ./.dizquetv:/.dizquetv

chrisbenincasa avatar May 28 '24 20:05 chrisbenincasa

Thanks! That dev compose is a WIP (and it's meant for running the dev app in a local container for debugging, etc).

The compose file in the docs is probably closer to what you want: https://tunarr.com/getting-started/setup/

I'm not sure how this translates to Unraid templates, but there are a couple options that are dependent on the user's personal setup (e.g. changing the image / runtime params for hw accel, adding in the dizquetv folder as a volume if they are migrating, exposed port etc):

Here is another example I just tested out locally

version: '3.8'
services:
  tunarr:
    # image: chrisbenincasa/tunarr:edge
    # Uncomment along with runtime below to enable HW accel
    image: chrisbenincasa/tunarr:edge-nvidia
    container_name: tunarr
    ports:
      - 8088:8000
    # Uncomment if using the Nvidia container
    runtime: nvidia
    # volumes:
      # The host path is relative to the location of the compose file
      # This can also use an absolute path. 
      # 
      # Uncomment if migrating from dizquetv. Chnage the host path
      # to the location of your dizquetv "database"
      # - ./.dizquetv:/.dizquetv

Thanks, I'll test it out

nwithan8 avatar May 29 '24 23:05 nwithan8

Got it, needed to permanently mount /tunarr/server/build/.tunarr:

version: '3.8'
services:
  tunarr:
    image: chrisbenincasa/tunarr:edge
    container_name: tunarr
    ports:
      - 8088:8000
    volumes:
      - /mnt/user/appdata/tunarr/dizquetv_migration:/.dizquetv
      - /mnt/user/appdata/tunarr/data:/tunarr/server/build/.tunarr

Drafting up an Unraid template now.

nwithan8 avatar May 30 '24 22:05 nwithan8

image

Template is done and tested. Should be live in the Community Apps store in a few hours.

Template is currently marked as Beta, which might spook some users, but until you have a latest tag for the container and the project is considered stable, we'll mark the template as Beta (the template itself isn't in beta, the underlying application is, it gets confusing)

nwithan8 avatar May 30 '24 23:05 nwithan8

Wow this is awesome! Thanks a ton! Curious, how will this handle different builds? Eventually, we'll have a stable image build (docker tag latest), then also this edge build, and perhaps a "next" build that has semi stable features. Can unraid expose different builds in the template for users to choose from?

chrisbenincasa avatar May 30 '24 23:05 chrisbenincasa

Wow this is awesome! Thanks a ton! Curious, how will this handle different builds? Eventually, we'll have a stable image build (docker tag latest), then also this edge build, and perhaps a "next" build that has semi stable features. Can unraid expose different builds in the template for users to choose from?

Yes, when installing, it prompts users to select which branch (Docker tag) to use:

image

In fact, since there's currently not a "latest" tag, clicking "Default" will cause problems for the end user. I'm not aware of a way to override that from a template; I believe it's just an expectation that all Docker containers inherently should have a "latest" tag.

nwithan8 avatar May 31 '24 16:05 nwithan8

I did have the latest problem, there should be a way to update what tag the default gets on the unraid template, I think.

I'm also unable to connect the plex server which is also running on unraid. Clicking connect to plex brings up the sign in but then it never gets added to Tunearr. I can see if I can run tunearr on another device to see if it will connect to my plex that way and if it's just an issue with the unraid version.

turnercore avatar May 31 '24 18:05 turnercore

It seems the migration isn't working correctly with the current template. No migration is being initiated when being pointed to the dizquetv appdata folder

sharri46 avatar Jun 03 '24 13:06 sharri46

It seems the migration isn't working correctly with the current template. No migration is being initiated when being pointed to the dizquetv appdata folder

@chrisbenincasa The template currently maps dizqueTV's parent folder to /.dizqueTV inside the container as read-only. Does it need to be read-write?

nwithan8 avatar Jun 03 '24 16:06 nwithan8

No, Tunarr doesn't require write permissions to the .dizquetv directory. The migration is read-only

chrisbenincasa avatar Jun 03 '24 18:06 chrisbenincasa

Then I'm confused about why the migration may not be running.

nwithan8 avatar Jun 03 '24 19:06 nwithan8

Having the same issue with the migration. Not seeing that running on my new install as well.

josway avatar Jun 03 '24 21:06 josway

Hmm, perhaps something regressed. I'll try either later today or tomorrow morning. Though I won't be able to test the unraid setup specifically.

chrisbenincasa avatar Jun 03 '24 21:06 chrisbenincasa

Oh one other thing... it could be because the Tunarr database directory exists already. The migration is skipped in that case in order to not overwrite any existing Tunarr data (subsequent runs). Does the unraid setup pre create this directory or something? Maybe we need a better method of tracking when to migrate (a db field).

See the init db directory function in this file. https://github.com/chrisbenincasa/tunarr/blob/main/server/src/server.ts

chrisbenincasa avatar Jun 03 '24 21:06 chrisbenincasa

Oh one other thing... it could be because the Tunarr database directory exists already. The migration is skipped in that case in order to not overwrite any existing Tunarr data (subsequent runs). Does the unraid setup pre create this directory or something? Maybe we need a better method of tracking when to migrate (a db field).

See the init db directory function in this file. https://github.com/chrisbenincasa/tunarr/blob/main/server/src/server.ts

Yes, Unraid would create any paths that don't already exist, so it would precreate the associated /tunarr/server/build/.tunarr path: https://github.com/nwithan8/unraid_templates/blob/750fa251daa2762a9204824f9a76c969720e73d3/templates/tunarr.xml#L51

nwithan8 avatar Jun 03 '24 22:06 nwithan8

Ah thanks for the context. That is most likely it then. Let me file an issue to capture this. This might be a little tricky since we try to the treat the whole directory as "one", even though it includes several files with different parts of the state. But so long as we have a universal marker for "first run" that works in all envs we should be good. I'll think on it.

chrisbenincasa avatar Jun 03 '24 22:06 chrisbenincasa

Opened #474 to track the full solution. It'll be the next thing I tackle.

chrisbenincasa avatar Jun 03 '24 23:06 chrisbenincasa

This should be fixed/improved with #476. Let me know if you see any issues. I just kicked off a manual edge release to get this in the build ASAP: https://github.com/chrisbenincasa/tunarr/actions/runs/9366211897

chrisbenincasa avatar Jun 04 '24 11:06 chrisbenincasa

Fresh install of the container on Unraid does seem to be processing the .dizquetv migration properly now 👍🏻

(I have some bad settings in my old DizqueTV installation, so migration failed for some entries. After manually cleaning up my DizqueTV plex-servers.json file, the import went faster the second time):

image

nwithan8 avatar Jun 04 '24 16:06 nwithan8

Huh... the legacy migrator doesn't attempt to verify the Plex settings, it'll just blindly migrate them. This is likely coming from some other data fixers that happen afterward. Are there any more details in the logs? Otherwise, can you rerun with debug logs enabled (easiest way is the LOG_LEVEL env var) and see where exactly that is failing?

It's probably the right thing that it failed outright by being unable to reach your configured Plex server, but we should discover why

chrisbenincasa avatar Jun 04 '24 17:06 chrisbenincasa

I had similar results where the migrator started, even processed channels and then Plex through a 404 and things locked up. I am seeing the UI Route is the issue but also seeing that on my DizqueTV container right now as well.

josway avatar Jun 04 '24 17:06 josway

@josway happy to look further if you provide some debug logs -- check out my previous comment on how.

chrisbenincasa avatar Jun 04 '24 19:06 chrisbenincasa

@nwithan8 - did you get your issue resolve? I'm surprised there are locations in the code where a Plex request would cause the server to not start. If you are still having issues I'd love to check out some debug logs.

chrisbenincasa avatar Jun 04 '24 19:06 chrisbenincasa

@nwithan8 - did you get your issue resolve? I'm surprised there are locations in the code where a Plex request would cause the server to not start. If you are still having issues I'd love to check out some debug logs.

I ended up just deleting old/dead/bad Plex servers from the dizqueTV config file. The migration then went smoothly, web UI loaded, everything good.

nwithan8 avatar Jun 04 '24 19:06 nwithan8

@chrisbenincasa Same for me as with @nwithan8. Bad Plex Server data hung everything up. Once I fixed that all went smoothly.

josway avatar Jun 04 '24 20:06 josway

Gotcha, thanks! I'll try injecting some bad values and see if I can reproduce.

chrisbenincasa avatar Jun 04 '24 20:06 chrisbenincasa

@nwithan8 think we can call this complete now? Really appreciate the effort here!

chrisbenincasa avatar Jun 04 '24 21:06 chrisbenincasa

@nwithan8 think we can call this complete now? Really appreciate the effort here!

Yeah, the Unraid template aspect seems to be working just fine. The migration stuff is unrelated to Unraid, so this ticket can be closed. Let me know if you release a new Docker branch and I'll update the template accordingly. Or feel free to open a PR: https://github.com/nwithan8/unraid_templates/blob/750fa251daa2762a9204824f9a76c969720e73d3/templates/tunarr.xml

nwithan8 avatar Jun 04 '24 21:06 nwithan8