58
submitted 3 years ago* (last edited 3 years ago) by bronzing@lemmy.fmhy.ml to c/selfhosted@lemmy.world

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).

you are viewing a single comment's thread
view the rest of the comments
[-] czardestructo@lemmy.world 37 points 3 years ago

I have a folder that all my docker services are in. Inside the folder is a folder for each discrete service and within that folder is a unique compose file necessary to run the service. Also in the folder is all the storage folders for that service so it's completely portable, move the folder to any server and run it and you're golden. I shut down all the services with a script then I can just tar the whole docker folder and every service and its data is backed up and portable.

[-] czardestructo@lemmy.world 6 points 3 years ago

In case anyone cares here is my script, I use this for backups or shutting down the server.

#!/bin/bash

logger "Stopping Docker compose services"

services=(/home/user/docker/*)    # This creates an array of the full paths to all subdirs
#the last entry in this array is always blank line, hence the minus 1 in the for loop count below

for ((i=0; i<=(${#services[@]}-1); i++))
do
    docker compose -f ${services[i]}/docker-compose.yml down &
done

#wait for all the background commands to finish
wait 
[-] Spazztastik@lemmy.world 6 points 3 years ago

This is exactly what I do and could not be happier!

[-] MaggiWuerze@feddit.de 4 points 3 years ago

Exactly my setup and for exactly the reasons you mentioned

[-] YonatanAvhar@programming.dev 2 points 3 years ago

Exactly what I do except my master folder is ~

[-] czardestructo@lemmy.world 2 points 3 years ago

I do ~/docker so I also have a docker-prototype folder for my sandbox/messing around with non-production stuff and I have a third folder for retired docker services so I keep the recipe and data in case I go back.

[-] MalReynolds@slrpnk.net 1 points 3 years ago
[-] MalReynolds@slrpnk.net 1 points 3 years ago

To answer my own question, yes, yes it does. Should've done this ages ago...

[-] dpflug@hachyderm.io 1 points 3 years ago

@czardestructo I like the tidiness of this.

this post was submitted on 09 Jul 2023
58 points (100.0% liked)

Selfhosted

61853 readers
569 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

Detailed Rules Post

  1. Be civil.

  2. No spam.

  3. Posts are to be related to self-hosting.

  4. Don't duplicate the full text of your blog or readme if you're providing a link.

  5. Submission headline should match the article title.

  6. No trolling.

  7. Promotion posts require active participation, with an account that is at least 30 days old. F/LOSS without a paywall has exceptions, with requirements. See the rules link for details. Tags [CBH] or [AIP] are required, see the links in Rule 8 for details.

  8. AI-related discussions and AI-involved promotional posts have additional requirements for tagging, as noted in Rule 7 and the AI & Promotional Post Expanded Rules post, and find example disclosures here.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 3 years ago
MODERATORS