support multi-hdd config #5

Open
opened 2026-04-02 16:36:57 +00:00 by fauno · 7 comments
Owner

how could something like this could be achieved via .env and garage.toml.templ? or include/concatenate an external file with custom configurations?

https://garagehq.deuxfleurs.fr/documentation/operations/multi-hdd/

data_dir = [
    { path = "/path/to/old_data", read_only = true },
    { path = "/path/to/new_hdd1", capacity = "2T" },
    { path = "/path/to/new_hdd2", capacity = "4T" },
]
how could something like this could be achieved via `.env` and `garage.toml.templ`? or include/concatenate an external file with custom configurations? https://garagehq.deuxfleurs.fr/documentation/operations/multi-hdd/ ``` data_dir = [ { path = "/path/to/old_data", read_only = true }, { path = "/path/to/new_hdd1", capacity = "2T" }, { path = "/path/to/new_hdd2", capacity = "4T" }, ] ```
Owner

If you put data_dir = [{{ env "UGLY_DATA_DIR_DUMP" }}] and then your .tmpl file and then just dump a super ugly '{ path = "/path/to/old_data", read_only = true }, { path = "/path/to/new_hdd1", capacity = "2T" }, { path = "/path/to/new_hdd2", capacity = "4T" },' then you're done? This might be guaranteed to cause further headaches 😬 I can't quite think of a recipe that deals with a complex config setup like this 🤔

If you put `data_dir = [{{ env "UGLY_DATA_DIR_DUMP" }}]` and then your `.tmpl` file and then just dump a super ugly `'{ path = "/path/to/old_data", read_only = true }, { path = "/path/to/new_hdd1", capacity = "2T" }, { path = "/path/to/new_hdd2", capacity = "4T" },'` then you're done? This might be guaranteed to cause further headaches 😬 I can't quite think of a recipe that deals with a complex config setup like this 🤔
Author
Owner

thanks! but yeah we'll be dealing with quote-escaping issues then, no?

thanks! but yeah we'll be dealing with quote-escaping issues then, no?
Owner

Yes, you'd need to check the usage of ' and ". You could potentially escape \" on the .env side. There might be some obscure functionality in Golang templating to help you out here but I wouldn't know. Good luck!

Yes, you'd need to check the usage of `'` and `"`. You could potentially escape `\"` on the `.env` side. There might be some obscure functionality in Golang templating to help you out here but I wouldn't know. Good luck!
Author
Owner

@decentral1se what's the templating called? i seem to find a lot of these for golang and never the official reference

@decentral1se what's the templating called? i seem to find a lot of these for golang and never the official reference
Owner

It's a disaster in terms of docs: https://pkg.go.dev/text/template#hdr-Actions I just search online and read what other people did. Looking at other recipes... there are even features which are only implemented in swarms version of the templating which aren't even supported in the compose spec. Dog bless us all.

It's a disaster in terms of docs: https://pkg.go.dev/text/template#hdr-Actions I just search online and read what other people did. Looking at other recipes... there are even features which are only implemented in swarms version of the templating which aren't even supported in the compose spec. Dog bless us all.
Author
Owner

besides templating issues, i'm thinking disks could be mounted on $LOCAL_FOLDER_DATA/diskX so they example config would be like this:

data_dir = [
    { path = "/var/lib/garage/data/disk1", read_only = true },
    { path = "/var/lib/garage/data/disk2", capacity = "2T" },
    { path = "/var/lib/garage/data/disk3", capacity = "4T" },
]

but i'm not sure if docker will show the nested mount points to the container.

reference:

https://git.coopcloud.tech/coop-cloud/garage/src/branch/main/compose.yml#L33

besides templating issues, i'm thinking disks could be mounted on `$LOCAL_FOLDER_DATA/diskX` so they example config would be like this: ``` data_dir = [ { path = "/var/lib/garage/data/disk1", read_only = true }, { path = "/var/lib/garage/data/disk2", capacity = "2T" }, { path = "/var/lib/garage/data/disk3", capacity = "4T" }, ] ``` but i'm not sure if docker will show the nested mount points to the container. reference: https://git.coopcloud.tech/coop-cloud/garage/src/branch/main/compose.yml#L33
Author
Owner

looks like it would work, so no changes needed to compose.yml:

mkdir local_folder_data

for i in 1 2; do
  dd if=/dev/zero of=disk$i.img bs=1M count=100
  losetup /dev/loop$i disk$i.img
  mkfs.ext4 /dev/loop$i
  mkdir -p local_folder_data/disk$i
  mount /dev/loop$i local_folder_data/disk$i
done

docker run -v ./local_folder_data:/srv -it --rm alpine:latest sh

# now inside the container
touch /srv/disk1/hi
touch /srv/disk2/hi
exit

# back to host
ls -hal local_folder_data/disk*

for i in 1 2; do
  umount local_folder_data/disk$i
  losetup -d /dev/loop$i
done
looks like it would work, so no changes needed to `compose.yml`: ```sh mkdir local_folder_data for i in 1 2; do dd if=/dev/zero of=disk$i.img bs=1M count=100 losetup /dev/loop$i disk$i.img mkfs.ext4 /dev/loop$i mkdir -p local_folder_data/disk$i mount /dev/loop$i local_folder_data/disk$i done docker run -v ./local_folder_data:/srv -it --rm alpine:latest sh # now inside the container touch /srv/disk1/hi touch /srv/disk2/hi exit # back to host ls -hal local_folder_data/disk* for i in 1 2; do umount local_folder_data/disk$i losetup -d /dev/loop$i done ```
Brooke added this to the Issue tracking project 2026-05-08 19:29:39 +00:00
Brooke added the
Kind/Enhancement
Priority
Low
4
labels 2026-05-15 20:19:05 +00:00
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: coop-cloud/garage#5
No description provided.