Hi,

I’m using docker-compose to host all my server services (jellyfin, qbittorrent, sonarr, etc.). I’ve recently grouped some of them into individual categories and then merged the individual docker-compose.yml file I had for each service into one per category. But is there actually any reason for not keeping them together?

The reason why is I’ve started configuring homepage and thought to myself “wouldn’t it be cool if instead of giving the server IP each time (per configured service in homepage) I’d just use the service name?” (AFAIK this only works if the containers are all in the same file).

  • MaggiWuerze
    link
    fedilink
    English
    401 year ago

    For simplicity sake alone I would say No. As long as services don’t share infrastructure (eg. a database) you shouldn’t mix them so you have an easier time updating your scripts.

    Another point is handling stacks. When you create dockers via compose you are not supposed to touch them individually. Collecting them all, or even just in categories, muddies that concept, since you have unrelated services grouped in a single stack and would need to update/up/down/… them all even if you just needed that for a single one.

    Lastly networks. Usually you’d add networks to your stacks to isolate their respective Backend into closed networks, with only the exposing container (eg. a web frontend) being in the publicly available network to increase security and avoid side effects.

    • @wplurker
      link
      English
      91 year ago

      So right now I have a single compose file with a file structure like this:

      docker/
      ├─ compose/
      │  ├─ docker-compose.yml
      ├─ config/
      │  ├─ service1/
      │  ├─ service2/
      

      Would you in that case use a structure like the following?

      docker/
      ├─ service1/
      │  ├─ config/
      │  ├─ docker-compose.yml
      ├─ service2/
      │  ├─ config/
      │  ├─ docker-compose.yml
      
      

      Or a different folder structure?

      • MaggiWuerze
        link
        fedilink
        English
        11
        edit-2
        1 year ago

        The second one is exactly what I have. One folder for each service containing it’s compose file and all persistent data belonging to that stack(unless it’s something like your media files)

        • @drudoo
          link
          English
          11 year ago

          Same, it is much easier to add/remove services and you don’t risk deleting the wrong persistence data if it is in another folder.

      • @[email protected]
        link
        fedilink
        English
        21 year ago

        The second is exactly how I do it. Keeps everything separate so easy to move individual services to another host if needed. Easy to restart a single service without taking them all down. Keeps everything neat and organized (IMO).