linuxserver / docker-jellyfin

GNU General Public License v3.0
647 stars 97 forks source link

Cannot change logging directory with environment variable #98

Closed Miwer closed 3 years ago

Miwer commented 3 years ago

linuxserver.io


Expected Behavior

Jellyfin should log to the directory specified by environment variable JELLYFIN_LOG_DIR as specified in official Jellyfin documentation: https://jellyfin.org/docs/general/administration/configuration.html#log-directory

Current Behavior

Jellyfin does NOT log to directory specified in environment variable. Environment variables seems hardcoded into docker image.

Steps to Reproduce

add environment variable JELLYFIN_LOG_DIR to docker compose file.

Environment

OS: Openmediavault 5 CPU architecture: x86_64 How docker service was installed: OS provided

Command used to create docker container (run/create/compose/screenshot)

version: "2.1"
services:
  jellyfin:
    image: ghcr.io/linuxserver/jellyfin
    container_name: jellyfin
    environment:
      - PUID=1001
      - PGID=100
      - TZ=Europe/Copenhagen
      - UMASK=<022> #optional
      - JELLYFIN_LOG_DIR=/cache/log
    volumes:
      - /storage/appdata/jellyfin-config:/config
      - /storage/media:/storage/media
      - /tempdata/appcache/jellyfin/cache:/cache
    ports:
      - 8096:8096
      - 8920:8920 #optional
    devices:
      - /dev/dri:/dev/dri #optional
    restart: unless-stopped

Docker logs

[s6-finish] sending all processes the TERM signal.,
[s6-finish] sending all processes the KILL signal and exiting.,
[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] 10-adduser: executing... ,
usermod: no changes,
,
-------------------------------------,
          _         (),
         | |  ___   _    __,
         | | / __| | |  /  \,
         | | \__ \ | | | () |,
         |_| |___/ |_|  \__/,
,
,
Brought to you by linuxserver.io,
-------------------------------------,
,
To support the app dev(s) visit:,
Jellyfin: https://opencollective.com/jellyfin,
,
To support LSIO projects visit:,
https://www.linuxserver.io/donate/,
-------------------------------------,
GID/UID,
-------------------------------------,
,
User uid:    1001,
User gid:    100,
-------------------------------------,
,
[cont-init.d] 10-adduser: exited 0.,
[cont-init.d] 30-config: executing... ,
[cont-init.d] 30-config: exited 0.,
[cont-init.d] 40-gid-video: executing... ,
[cont-init.d] 40-gid-video: 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,
/usr/bin/with-contenv: line 3: umask: `<': invalid symbolic mode operator,
[services.d] done.,
[16:40:40] [INF] [1] Main: Jellyfin version: 10.6.4,
[16:40:40] [INF] [1] Main: Environment Variables: ["[JELLYFIN_DATA_DIR, /config/data]", "[JELLYFIN_LOG_DIR, /config/log]", "[JELLYFIN_CACHE_DIR, /config/cache]", "[JELLYFIN_CONFIG_DIR, /config]"],
[16:40:40] [INF] [1] Main: Arguments: ["/usr/lib/jellyfin/bin/jellyfin.dll", "--ffmpeg=/usr/lib/jellyfin-ffmpeg/ffmpeg", "--webdir=/usr/share/jellyfin/web"],
[16:40:40] [INF] [1] Main: Operating system: Linux,
[16:40:40] [INF] [1] Main: Architecture: X64,
[16:40:40] [INF] [1] Main: 64-Bit Process: True,
[16:40:40] [INF] [1] Main: User Interactive: True,
[16:40:40] [INF] [1] Main: Processor count: 4,
[16:40:40] [INF] [1] Main: Program data path: /config/data,
[16:40:40] [INF] [1] Main: Web resources path: /usr/share/jellyfin/web,
[16:40:40] [INF] [1] Main: Application directory: /usr/lib/jellyfin/bin/,
[16:40:40] [INF] [1] Emby.Server.Implementations.AppBase.BaseConfigurationManager: Setting cache path: /cache/cache,
[16:40:40] [INF] [1] Emby.Server.Implementations.ApplicationHost: Loading assemblies,
[16:40:40] [INF] [1] Emby.Server.Implementations.ApplicationHost: Loaded assembly Jellyfin.Plugin.KodiSyncQueue, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null from /config/data/plugins/Kodi Sync Queue/Jellyfin.Plugin.KodiSyncQueue.dll,
[16:40:40] [INF] [1] Emby.Server.Implementations.ApplicationHost: Loaded assembly LiteDB, Version=4.1.4.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27 from /config/data/plugins/Kodi Sync Queue/LiteDB.dll,
[16:40:41] [INF] [1] Jellyfin.Plugin.KodiSyncQueue.Data.DbRepo: Jellyfin.Plugin.KodiSyncQueue IS NOW STARTING!!!,
[16:40:41] [INF] [1] Jellyfin.Plugin.KodiSyncQueue.Data.DbRepo: Creating DB Repository...,
[16:40:41] [INF] [1] Main: Kestrel listening on all interfaces,
[16:40:41] [WRN] [1] Microsoft.AspNetCore.DataProtection.Repositories.EphemeralXmlRepository: Using an in-memory repository. Keys will not be persisted to storage.,
[16:40:41] [WRN] [1] Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager: Neither user profile nor HKLM registry available. Using an ephemeral key repository. Protected data will be unavailable when application exits.,
[16:40:41] [WRN] [1] Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager: No XML encryptor configured. Key {d23d9b98-32cf-4144-ac80-fac3be9a91bb} may be persisted to storage in unencrypted form.,
[16:40:41] [INF] [1] Emby.Server.Implementations.ApplicationHost: Running startup tasks,
[16:40:41] [INF] [1] Jellyfin.Plugin.KodiSyncQueue.ScheduledTasks.FireRetentionTask: Retention Task Scheduled!,
[16:40:41] [INF] [1] Emby.Server.Implementations.ScheduledTasks.TaskManager: Daily trigger for Remove Old Sync Data set to fire at 03/10/2021 00:01, which is 7:20:18.3797889 from now.,
[16:40:41] [INF] [1] Emby.Server.Implementations.ScheduledTasks.TaskManager: Daily trigger for Udtræk Kapitel billeder set to fire at 03/10/2021 02:00, which is 9:19:18.3773863 from now.,
[16:40:41] [INF] [1] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Found ffmpeg version 4.3.1,
[16:40:41] [INF] [1] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Available decoders: ["h264", "h264_qsv", "h264_cuvid", "hevc", "hevc_qsv", "hevc_cuvid", "mpeg2video", "mpeg2_qsv", "mpeg2_cuvid", "mpeg4", "mpeg4_cuvid", "msmpeg4", "vc1_qsv", "vc1_cuvid", "vp8_cuvid", "vp8_qsv", "vp9_cuvid", "vp9_qsv", "aac", "ac3", "mp3"],
[16:40:41] [INF] [1] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Available encoders: ["libx264", "h264_amf", "h264_nvenc", "h264_qsv", "h264_v4l2m2m", "h264_vaapi", "libx265", "hevc_amf", "hevc_nvenc", "hevc_qsv", "hevc_vaapi", "mpeg4", "msmpeg4", "libvpx", "libvpx-vp9", "aac", "ac3", "libmp3lame", "libopus", "libvorbis", "srt"],
[16:40:41] [INF] [1] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Available hwaccel types: ["vdpau", "cuda", "vaapi", "qsv", "drm", "opencl"],
[16:40:41] [INF] [1] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: FFmpeg: Custom: /usr/lib/jellyfin-ffmpeg/ffmpeg,
[16:40:41] [INF] [1] Emby.Server.Implementations.ApplicationHost: ServerId: d2c1e2cb5e7e451789e6c62ef05f3ffd,
[16:40:41] [INF] [1] Emby.Server.Implementations.ApplicationHost: Executed all pre-startup entry points in 0:00:00.073969,
[16:40:41] [INF] [1] Emby.Server.Implementations.ApplicationHost: Core startup complete,
github-actions[bot] commented 3 years ago

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

tobbenb commented 3 years ago

We set that env variable to /config/log when we start Jellyfin, so it's overwriting your env variable.

lldsolitude commented 3 years ago

I have been running into the same problem. I have been trying to migrate from native install to this docker image, but since I cannot set JELLYFIN_CACHE_DIR, JELLYFIN_CONFIG_DIR, JELLYFIN_DATA_DIR and JELLYFIN_LOG_DIR env variables without having them overridden by the hardcoded settings in the docker image, I will have to add all my libraries and download metadata all over again which is very time consuming. Could you please not hardcode the settings in the image and make it possible to modify the env variables when creating the container?

aptalca commented 3 years ago

We don't support all the env vars jellyfin accepts, because we use some of them to do our automation.

If you're migrating, then move your existing files into the expected locations after creating the container.

Miwer commented 3 years ago

My reason for separating the log dir to a volume outside the config dir, is because I don't want my storage snapshots taking up data from the logfiles. I also moved cache and transcode files to a separate storage volume without snapshots. This was configurable from inside jellyfin, but log dir sadly is not. Is it possible to use a symlink in the underlying file system, or will this cause trouble with this image?

lldsolitude commented 3 years ago

We don't support all the env vars jellyfin accepts, because we use some of them to do our automation.

If you're migrating, then move your existing files into the expected locations after creating the container.

I'm afraid simply moving the files won't be enough since absolute paths are used in the metadata nfo files to point to the image files. If I can't set env vars then is it possible to specify command line options when starting the Jellyfin binary? They can override the env vars.

aptalca commented 3 years ago

Both of you can likely use custom mount points to accomplish what you're trying to do.

We have to maintain a balance between customizability and convenience (standardization). We are not trying to provide an image that is highly customizable as it also creates a much bigger support burden for our relatively small team.

If you need to customize further than what we allow, see here: https://blog.linuxserver.io/2019/09/14/customizing-our-containers/