Skip to content

Add docker support#17

Open
CoryManson wants to merge 20 commits intotrackstacker:mainfrom
CoryManson:docker
Open

Add docker support#17
CoryManson wants to merge 20 commits intotrackstacker:mainfrom
CoryManson:docker

Conversation

@CoryManson
Copy link

@CoryManson CoryManson commented Mar 27, 2025

Hi there,

I've added docker support using a linuxserver.io base alpine image. I've tested this on my unraid server and it appears to work well, I'm by no means a docker expert.

  • Add github workflow to build and publish to dockerhub (This may require some changes to work best for you)
  • Add dockerfile
  • Adds wrapper python script to read config and only execute meloday script when time period changes. executes every 10 mins with some reasonable output.
  • Add Init services to docker image, copies config.yml and assets to /config volume so it can be edited via the host system

The main branch on my fork is a bit of a hard fork, only containing the needed files for the docker build, retrieves meloday files from the parent repo.

https://hub.docker.com/r/cozza38/meloday

Hope this helps!

image

@Eric-sson
Copy link

I can confirm this works. Great work and thanks for providing this! :)

@CoryManson
Copy link
Author

On my Unraid server I've had the script stall at 3am for the past 2 nights in a row. The wrapper script seems to be still running, I think meloday.py may be getting stuck. I'll look further into debugging it.

Additionally, I think I may have come across a bug with moodmap.json, meloday.py seems to expect it to be in the same directory as the script and not in the assets directory. To workaround this in the docker container I used a symlink.

@Eric-sson
Copy link

Yes I had the same. Restarted the container yesterday morning but this morning it was again stalled.

@CoryManson
Copy link
Author

I can see in the container that the wrapper is still alive, meloday.py is running (329 minutes) and it has the CPU pinned at 100%

image

@CoryManson
Copy link
Author

Have been making progress on this, appears that for myself I've never played music during the "Dawn" period so there's no history. Meloday fetches 0 tracks and is getting stuck in a loop. Explains the CPU pinning to 100%

@CoryManson
Copy link
Author

This appears to be working for me now. I had to add a break to meloday.py to stop the script executing when it was unable to fetch enough songs to build the playlist. In my situation, I have no play history for "Dawn" so meloday simply was unable to find any songs and got caught in an infinite loop.

Will give it a couple more days to confirm.

@Eric-sson
Copy link

@CoryManson could you update the main branch of the docker support you have build?

@CoryManson
Copy link
Author

@Eric-sson I've temporarily repointed https://hub.docker.com/r/cozza38/meloday to my source branch on this PR for you

@CoryManson
Copy link
Author

Mine has been running without fault for a few days now. Hope it's working for you :)

@Eric-sson
Copy link

@CoryManson I can confirm as well that mine is running flawlessly for a couple of days :-)

@jupys
Copy link

jupys commented Oct 20, 2025

hey, sorry for the silly question but im still a docker novice. i typically run compose files due to my stack, and was wondering if you could help me with generating a compose for your fork? thanks a lot for putting in all this effort!

edit: looks like i might have figured it out? copying the config.yml pre-configured into the volume below, then starting the container works. now to just wait till tonight to test!

meloday:
      container_name: meloday
      image: cozza38/meloday
      volumes:
          - ./config:/config
      restart: unless-stopped

@CoryManson
Copy link
Author

Glad you got it figured out :)

@jupys
Copy link

jupys commented Oct 20, 2025

thanks! and thanks again for this fork!

did you figure out how to get timezone setting? current period is dawn for me, but it's actually 2PM hahaha

edit: i should really try for longer than 5 minutes before asking things hahaha, got local time working with compose using the good ol' volume:

meloday:
      container_name: meloday
      image: cozza38/meloday
      volumes:
          - ./config:/config
          - /etc/localtime:/etc/localtime
      restart: unless-stopped

@CoryManson
Copy link
Author

CoryManson commented Oct 20, 2025

It should use the system time by default, you may also be able to set a TZ env var for docker:

    environment:
      - TZ=America/New_York

@jupys
Copy link

jupys commented Oct 24, 2025

hey again! sorry, i tried to open an issue on your fork but it wont let me. just wanted to see if there was any way to get more logs, as my install has started to freeze up. maybe you could pop in a debug via config that will show alllll working logs?

2025-10-24 13:11:28,787 - INFO - Loading configuration file.
2025-10-24 13:11:28,815 - INFO - Current time period: Afternoon, Last time period: None
2025-10-24 13:11:28,816 - INFO - Time period changed to: Afternoon
2025-10-24 13:11:28,816 - INFO - Executing meloday.py script.

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