linuxserver / docker-beets

GNU General Public License v3.0
118 stars 50 forks source link

[FEAT] Running the docker container without starting up a web instance #119

Closed monksy closed 1 week ago

monksy commented 4 months ago

Is this a new feature request?

Wanted change

I would like to be able to query beets without standing up a web server here. This would run it as a CLI command

Reason for change

Need for this is that the importing and collection management isn't needed as a true server sense. The need is so that I can run this sporattically when needed.

Proposed code change

Adding environment varraible Adding conditional logic in the service d to not start up the beets server. Accept the arguements as what to run from the command line.

github-actions[bot] commented 4 months ago

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

j0nnymoe commented 4 months ago

Regarding your need to run this sporattically, regardless of the web server running, it's not going to stop this functionality. Deploy the container then just run commands such as docker exec -u abc -it beets /bin/bash -c 'beet import /downloads' unless I'm missing something?

monksy commented 4 months ago

That suggestion does work. However, to script this import, that means that I would have to do a:

start exec stop/kill

To be able to script the import. That assumes that the exec doesn't have any issues.

j0nnymoe commented 4 months ago

Regardless of the web server running or not, you would need script something like that anyways?

monksy commented 4 months ago

Even in a script with it's current state you'd still have to handle the management of the webserver. In the context of a single exectution run, thats a bit excessive.

nopoz commented 3 months ago

Mount a dummy run file in your container to override the service from starting:

        volumes:
            - '/your_path/run:/etc/s6-overlay/s6-rc.d/svc-beets/run:ro' # prevent beets web service from running

Contents of the /your_path/run file:

#!/usr/bin/with-contenv bash
# shellcheck shell=bash

#exec \
#    s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 8337" \
#    s6-setuidgid abc beet web

beets web service no longer starts with the container:

# docker exec -t -i beets /bin/bash
root@5860d39bc47c:/# ps auxw | grep beet
root        45  0.0  0.0    216    76 ?        S    01:06   0:00 s6-supervise svc-beets
root       146  0.0  0.0    216    84 ?        S    01:06   0:00 /package/admin/s6-2.12.0.2/command/s6-svlisten1 -U -- /run/s6-rc/servicedirs/svc-beets /package/admin/s6-2.12.0.2/command/s6-svc -u -- /run/s6-rc/servicedirs/svc-beets
root       343  0.0  0.0   1604     4 pts/0    S+   01:07   0:00 grep beet
LinuxServer-CI commented 2 months ago

This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.