Skip to content

Conversation

@egladman
Copy link

linuxserver.io


  • I have read the contributing guideline and understand that I have made the correct modifications

Description:

Optionally programmatically patch Library/Application Support/Plex Media Server/Preferences.xml on start

Benefits of this PR and context:

This simplifies/automates setup for the following scenarios:

  • Running plex behind a reverse proxy with a custom tld or nonstandard port
  • Running plex with the bridge network driver (the default). Plex will treat local network traffic as remote, unless "LAN Networks" under network settings in the web GUI is set.
    • I'm against running containers with host networking, I prefer to only publish 32400

Yes all of these settings can be configured via the web GUI, but I consider this a clunky solution. I'm striving for zero human intervention.

I'd be happy to elaborate on my use case, just let me know.

How Has This Been Tested?

I'm over simplifying things with the following one-liner, but it demonstrates how it works

❯ docker run -it --env SERVER_NAME="foobar" $(docker build . --no-cache --quiet) /bin/bash -c "sleep 60 && cat /config/Library/Application\ Support/Plex\ Media\ Server/Preferences.xml"
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 01-envfile: executing... 
[cont-init.d] 01-envfile: exited 0.
[cont-init.d] 01-migrations: executing... 
[migrations] started
[migrations] no migrations found
[cont-init.d] 01-migrations: exited 0.
[cont-init.d] 10-adduser: executing... 
usermod: no changes

-------------------------------------
          _         ()
         | |  ___   _    __
         | | / __| | |  /  \
         | | \__ \ | | | () |
         |_| |___/ |_|  \__/


Brought to you by linuxserver.io
-------------------------------------

To support LSIO projects visit:
https://www.linuxserver.io/donate/
-------------------------------------
GID/UID
-------------------------------------

User uid:    911
User gid:    911
-------------------------------------

[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 40-chown-files: executing... 
[cont-init.d] 40-chown-files: exited 0.
[cont-init.d] 45-plex-claim: executing... 
[cont-init.d] 45-plex-claim: exited 0.
[cont-init.d] 50-gid-video: executing... 
[cont-init.d] 50-gid-video: exited 0.
[cont-init.d] 60-plex-update: executing... 



#######################################################
# Update routine will not run because you havent set  #
# the VERSION variable or you opted out of updates.   #
#          For more information checkout :-           #
#    https://github.com/linuxserver/docker-plex       #
#######################################################


[cont-init.d] 60-plex-update: exited 0.
[cont-init.d] 70-plex-modify-preferences: executing... 
[cont-init.d] 70-plex-modify-preferences: exited 0.
[cont-init.d] 90-custom-folders: executing... 
[cont-init.d] 90-custom-folders: exited 0.
[cont-init.d] 99-custom-scripts: executing... 
[custom-init] no custom files found exiting...
[cont-init.d] 99-custom-scripts: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
Starting Plex Media Server.
Critical: libusb_init failed
<?xml version="1.0" encoding="utf-8"?>
<Preferences FriendlyName="foobar" OldestPreviousVersion="1.25.1.5286-34f965be8" MachineIdentifier="XXXXXXXXXXXXXXXXXXXXXXXX" ProcessedMachineIdentifier="XXXXXXXXXXXXXXXXXXXXXXXX" AnonymousMachineIdentifier="XXXXXXXXXXXXXXXXXXXXXXXX" MetricsEpoch="1"/>
[cmd] /bin/bash exited 0
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.
[s6-finish] sending all processes the KILL signal and exiting.

Source / References:

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening this pull request! Be sure to follow the pull request template!

@LinuxServer-CI
Copy link
Contributor

@aptalca
Copy link
Member

aptalca commented Dec 12, 2021

Thanks for the PR, but we don't like to directly modify plex's preferences.xml because we don't control the upstream and if they make any changes, we won't even know until after something breaks.

Plus, as you said, these are all configurable via the gui. We try to create env vars for things that are necessary to get the gui up and accessible, and the rest can be done via the gui.

While I understand some people prefer to have these set up in docker arguments, I think it's much better if it's a mod, rather than built into our image: https://mods.linuxserver.io/?mod=create

@egladman
Copy link
Author

egladman commented Dec 13, 2021

That's disappointing, but I understanding not wanting to make changes to the xml. I'll probably end up maintaining my own fork, as I think this is a problem worth solving. Thanks for the quick response.

@egladman egladman closed this Dec 13, 2021
@aptalca
Copy link
Member

aptalca commented Dec 13, 2021

You don't need to maintain a fork if you submit a mod like I linked to above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants