linuxserver / docker-flexget

GNU General Public License v3.0
4 stars 2 forks source link

[BUG] Flexget daemon manager not working when config.yaml is not at default location #14

Closed terrytw closed 1 month ago

terrytw commented 1 month ago

Is there an existing issue for this?

Current Behavior

When config.yaml is not at the default /config/.flexget directory, if you run flexget daemon status, the flexget daemon manager will report:

2024-09-17 14:00:53 CRITICAL manager                       Failed to find configuration file config.yml
2024-09-17 14:00:53 INFO     manager                       Tried to read from: /, /config/.flexget, /config/.config/flexget
Could not instantiate manager: No configuration file found.

Flexget is still running, but you can't manually execute tasks like flexget execute --tasks download, it will report the same error.

On the same note, when log file is not at the same directory as config.yaml, an empty flexget.log is created alongside config.yaml

Expected Behavior

Able to run flexget execute manually, and no empty log file being created.

Steps To Reproduce

Just run the docker container

Environment

- OS: Synology
- How docker service was installed: via Synology store

CPU architecture

x86-64

Docker creation

Sample docker run command:

docker run -d \
  --name flexget1 \
  --hostname flexget1 \
  -e TZ=********** \
  -e FG_WEBUI_PASSWORD=********* \
  -e FG_LOG_LEVEL=info \
  -e FG_LOG_FILE=/config/log/flexget.log \
  -e FG_CONFIG_FILE=/config/config.yml \
  -e PUID=1026 \
  -e PGID=101 \
  ghcr.io/linuxserver/flexget

Container logs

Container logs are normal and as expected.
github-actions[bot] commented 1 month ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

thespad commented 1 month ago

If you're using a custom config file location you have to pass that to flexget when running from the CLI, e.g. flexget -c /config/flexget.yml daemon status

I can't replicate the log issue, the log file gets created in the default location regardless of where the config file is (unless you change the log location).

terrytw commented 1 month ago

unless you change the log location

Yes exactly, when the log file is not at the default location (e.g. use -e FG_LOG_FILE=/config/log/flexget.log), there will be 2 log files, 1 is at /config/log/flexget.log and that is the real one, a second empty one is also created next to the config file.

aptalca commented 1 month ago

I don't understand what the issue is here. We start the process/service in a specific way where we define the config file location as well as the log file location. Those paths and files are created as part of the container init: https://github.com/linuxserver/docker-flexget/blob/main/root/etc/s6-overlay/s6-rc.d/svc-flexget/run#L4-L7

If you exec into the container later, and run manual commands where you define different things as parameters, or not define them at all, you will have files created elsewhere.

We don't support running manual commands inside the container unless we tell you to or document in the readme because doing so often conflicts with our init and intended behaviors.

terrytw commented 1 month ago

There are 2 separate issues here, I thought they were the symptoms of the same issue, but it turns out they are not.

  1. Fail to run manual command, that has been addressed, thanks to @thespad
  2. An empty log file is created, that has nothing to do with running manual command.

Just try this:

docker run -d \
  --name flexget1 \
  --hostname flexget1 \
  -e FG_WEBUI_PASSWORD=asdg987YSA68dsg \
  -e FG_LOG_LEVEL=info \
  -e FG_LOG_FILE=/config/log/flexget.log \
  -e FG_CONFIG_FILE=/config/config.yml \
  -v /path/to/data:/data \
  -v /path/to/config:/config \
  ghcr.io/linuxserver/flexget

Change only the mount path on host, and leave everything else as is. You don't have to run any manual command.

There will 2 log files, 1 in /config (empty), 1 in /config/log (real)

Changing log file with docker environment variable is documented in the readme. It should be supported without unintended outcome.

aptalca commented 1 month ago

Change only the mount path on host, and leave everything else as is. You don't have to run any manual command.

Thanks, that's something we can act on. I think I identified the issue, just need to do some testing.

aptalca commented 1 month ago

Yup, our bad. It's this line that causes the creation of that log file: https://github.com/linuxserver/docker-flexget/blob/main/root/etc/s6-overlay/s6-rc.d/init-flexget-config/run#L32

If you set a WebUI password, our init runs the flexget command without defining a log file so flexget creates one in the home folder and that is never used ever again.