SongKong Jaikoz

SongKong and Jaikoz Music Tagger Community Forum

Docker compose - any examples?

I see people running on synology and some on unraid, but I need a “normal” docker compose file. The FAQ seems to reference running on synology only. I would prefer to run on my main media server which is ubuntu running portainer and I have all my dockers run on a single compose.

I can’t find any up to date repositories (nothing recent on github).

Anyone running this program in docker?

We have instructions for qnap, synology and unraid because these are the docker systems we have tested against but they are just standard docker buillds, there are standard docker containers for linux intel and linux arm32 and we use dockerhub, does this help - https://hub.docker.com/repository/docker/songkong/songkong/general

You run a container for an image as follows:

docker run -v /CONFIGFOLDER:/songkong -v /MUSICFOLDER:/music -p 4567:4567 songkong/songkong

SongKong usually runs on port 4567, has two volumes that should be mapped:

  • /music - This is where your music files are stored (replace MUSICFOLDER with real folder)
  • /songkong - this will be where SongKong stores its preferences, license, logs, reports and internal database (replace /CONFIGFOLDER wiht real folder)
1 Like

That will work, thank you. I’ve been trying a docker container of MusicBrainz Picard, but I have a license for SongKong so I want to try it too. I’ll generate a compose file and try it out. Does Songkong require the “musicfolder” path or can I name it whatever I want and choose it inside the interface? (I have all my network folders mapped through /data for atomic moves)

You should replace MUSICFOLDER with the actual folder containing your music folders, then when you start songkong the web-gui will show it as /music, and under /music will be your actual music files.

Quick note, unlike Picard you can start SongKong in your docker then open it from a regular web browser to control from somewhere else if you like (i.e. windows PC, Ipad etc).

So for anyone else that comes along:

  1. it does not appear that songkong will allow you to map a folder internally other than as /music. Of course you can select whatever folder you want to map, but songkong seems to insist that it be called /music internally. This is potentially a problem related to atomic moves but I don’t think I will be moving files, just editing metadata so this I don’t think will be a problem, but it would be nice if I could select ANY folder from within the GUI interface and not just /music
  2. I can use Picard Musicbrainz in docker and a pseudo GUI interface access via a remote desktop type inteface. SongKong gives a direct port based GUI interface - MUCH nicer.

Exploring more, thank you PaulTaylor!

Regarding 1. I don’t understand the issue, but Im not a docker expert.

The problem we were trying to solve was that the SongKong docker running in the virtual docker environment needs to have access to your music files running in the real environment. So the -v option is just mapping your real folder to a virtual folder that SongKong then uses, I cant see another solution.

So if you have a real folder called /home/peter/mymusic containing two artist folders beatles and rollingstones and you configure -v /home/peter/mymusic:/music then in the songkong webui you will see /music containing two folders beatles and rollingstones . If you were to rename the beatles folder within songkong to /music/the_beatles you would actually be renaming /home/peter/mymusic/beatles to /home/peter/mymusic/the_beatles.

It very similar to mounting a remote fileystem in Windows to Z: , on Windows don’t see the original mount point instead see Z: but it is still working on the original

So with all that said, what do you mean

This is potentially a problem related to atomic moves

I understand docker mapping. The issue is that your program seems to require the external folder to be mapped to a fixed internal name (/music)

Let’s say I have my final music library at: /tank/media/music I also have a directory /tank/media/downloads where music is downloaded. If I move a file from one of those directories to the other, then docker realizes they are under the same file system and it will do an atomic move where the file is not physically copied but it’s position is just updated. It’s basically instant.

If I map /tank/media/music to /music then docker has no idea that /music is in the same file system and so any move will involve an actual copy which takes much much longer.

These are called hardlinks and trash has a great explanation here; https://trash-guides.info/Hardlinks/Hardlinks-and-Instant-Moves/

The solution for SongKong would be to allow ANY attached directory to be searched. Instead of making me map to /music let me map to /tank/media/music and then select that. Songkong will only see one directory but the docker file system outside of songkong can work more effectively.

Ok but the folder you map to /music doesn’t have to be the music root. You could map /tank/media to /music/ then SongKong would see /tank/media/music as /music/music and /tank/media/downloads as /music/downloads. Would Docker then know they were same fs if you moved files between them?

No, that’s the point. the internal map must include the mapping that other containers would see as external mapping.

i.e
Other container:
tank/media/music:/data/music

Songkong container mapping:
/tank/media/music : /data/media/music

The above will work because the top level directory is the same.

Songkong container mapping:
/tank/media/music:/music

this will not work. Even though the external mapped drive is physically in the same path, my understanding as per the trash guide above is that because the internal mapping does not include the external path, it will not allow atomic moves.

Again for your program, if things are just being modified, i don’t think this makes a difference. But if files are ever actually MOVED it makes a HUGE difference and in general for docker containers forcing a fixed path within the application (i.e. /music) is not best practice.

Cheers!

Hi, okay I see what you are saying but does it matter how other containers see it if move is being done by SongKong within SongKong container ?

If the files are files residing on a regular drive then don’t they have to be physically moved so that they are in the actual correct location regardless of what shortcuts can be done within container environment?

Ok, assuming it does matter I will explain wlhy I have done it as I have. I need to define a location to store the configuration and I need the user to define a mapping to a real location so they access their files. So if I don’t specify the name of the mount points they use /music and /songkong I don’t see how I would know what they have configured or be able to check they have actually configured something.

Yes it does matter.

Example:

Sonarr maps /tank/media/tv to /tv
SabNZBD maps /tank/media/tv/downloads to /downloads

Even though /downloads is a subdirectory of tv, and even though the operating system knows this, atomic moves will not work.

Docker must see the directories as connected to each other within the INTERNAL mapping for this to work.

This is why the traditional mapping for example of Radarr and Sonarr to /movies and /tv for example does NOT work with atomic moves even though outside of the container they may be connected and is not best practice.

What would be ideal is to be able to map to whatever we want in the container setup (in my example for singkong that would be /tank/media/music: /data/media/music and then within your program you have a top down selection that would show ALL attached directories and allow the user to select which one they want. There may be a reason in your development why you have to specify one specific directory but I don’t understand why that would be. For example if I’m running this program in windows I assume I could start at “computer” and then dial down to whatever directory my music is actually in and tell SongKong to use that, right? It’s really just the same thing - have SongKong show me ALL the attached folders available in the container and let me select which one I want to use, don’t force me to use /music.

Thanks for spending the time on this. I understand docker users are probably not a huge focus, but I run everything in docker on my server as it’s super easy to update and maintain.

Cheers.

You are giving me an example of communicating between Sonarr and SabNZBD but Im saying does it make any difference when using SongKong to move the files, if there is only one container involved ?

There is very little docker code in the code, there is a method for working out if using docker

public static boolean isDocker()
    {
        if(!isDockerChecked)
        {
            isDockerChecked = true;

            //New method
            if (Strings.nullToEmpty(System.getProperties().getProperty("docker")).contains("true"))
            {
                isDocker = true;
                return true;
            }

            //Old method
            try
            {
                Path procTable = Paths.get("/proc/1/cgroup");
                if (Files.exists(procTable))
                {
                    Boolean isInDocker = Files.lines(procTable).anyMatch(line -> line.contains("docker"));
                    if (isInDocker)
                    {
                        isDocker = true;
                        return true;
                    }
                }
            }
            catch (IOException ioe)
            {
                return false;
            }
            return false;
        }
        else
        {
            return isDocker;
        }
    }

and if we are on docker then we root the web-browser tree at /music which has hopefully been configured so its give access to your music folder.

    if(SongKong.songKong.config.isDocker())
    {
        List<Path> paths = new ArrayList<Path>();
        paths.add(Paths.get(/music));
        RemoteUICreateFolderTree cft = new RemoteUICreateFolderTree(paths, true, startFolder);
        String treeData = cft.start(1);
        return treeData;
    }

Now you say:

I don’t see how I would know what the mounted folders are, I assume there must be some api but its not clear.

I think we may be speaking a different language to each other.

Let me ask it this way:

Does your program REQUIRE that the internal name of the folder being used for music is /music? It seems to.

If I can call the program path whatever I want INSIDE the docker / SongKong (i.e data/media/music instead of /music) then everything is solved.

The issue is what SongKong calls it INSIDE the docker needs to be the same as my other dockers call it INSIDE those dockers. So consistency inside is important, and SongKong won’t let me do that as it seems to force me to call the outside folder /music inside.

Yes it does because otherwise there seems to be no way to find our what yiou have set the INSIDE value to. That is the problem, for my application within the container I do not see what -v options you have used.

Can you not provide the root directory ‘/‘ and let user pick from all included options?

Most other programs include a “standard” option like /music but then allow a user to move up the folder system and select another folder

Ok perhaps I can do that so it always starts from /, and then everything mounted will be shown under that. But it also means the whole container filesystem will also be exposed, I’m not sure if that’s a good thing.

I will have to try it.

Not sure about this but have raised issue - https://jthink.atlassian.net/browse/SONGKONG-2543

Most other media type applications I use in docker do exactly this. When I go to add a path for a folder it starts at / and shows me everything. People using docker are savvy generally enough to know what their maps are so I would go immediately to /data for my folders.

Cheers!

A post was split to a new topic: Docker Composer File