feat: support sqlite and other database engines #6

Merged
marlon merged 2 commits from sqlite into main 2026-04-05 23:02:33 +00:00
Owner

docs adverts lmdb can become corrupted on power outages

https://garagehq.deuxfleurs.fr/documentation/reference-manual/configuration/#db_engine

docs adverts lmdb can become corrupted on power outages https://garagehq.deuxfleurs.fr/documentation/reference-manual/configuration/#db_engine
fauno added 1 commit 2026-04-03 15:07:03 +00:00
fauno requested review from marlon 2026-04-03 15:07:03 +00:00
decentral1se reviewed 2026-04-03 15:50:12 +00:00
garage.toml.tmpl Outdated
@ -1,6 +1,6 @@
metadata_dir = "/var/lib/garage/meta"
data_dir = "/var/lib/garage/data"
db_engine = "lmdb"
db_engine = "{{ env "DATABASE_ENGINE" }}"
Owner

You need to thread DATABASE_ENGINE into the compose.yml and keep the default of lmdb?

You need to thread `DATABASE_ENGINE` into the `compose.yml` and keep the default of `lmdb`?
Author
Owner

i can't parse this phrase 🤔

i can't parse this phrase 🤔
Owner

Ah, sorry, I thought you might need to add it to an environment: ... part in the compose.yml but you're using it directly in the .tmpl file. Ignore me 🙃

Ah, sorry, I thought you might need to add it to an `environment: ...` part in [the compose.yml](https://git.coopcloud.tech/coop-cloud/garage/src/branch/main/compose.yml#L5) but you're using it directly in the `.tmpl` file. Ignore me 🙃
decentral1se marked this conversation as resolved
decentral1se reviewed 2026-04-03 15:50:34 +00:00
@ -11,6 +11,7 @@ SECRET_RPC_SECRET_VERSION=v1 # length=32 charset=hex
# supported and requires deleting the existing cluster layout metadata.
REPLICATION_FACTOR=2
DATABASE_ENGINE=lmdb
Owner

Seems like it might need a release note to explain?

Seems like it might need a release note to explain?
Author
Owner

i didn't think of it because it keeps the current behaviour intact!

i didn't think of it because it keeps the current behaviour intact!
Owner

For existing deployments, you need to add DATABASE_ENGINE to your .env or your upgrade will fail.

For existing deployments, you need to add `DATABASE_ENGINE` to your `.env` or your upgrade will fail.
Author
Owner

oh yeah, but abra app deploy also warns of missing env vars, right? i'll add a release note anyway, unless there's a default value for the env template function?

oh yeah, but abra app deploy also warns of missing env vars, right? i'll add a release note anyway, unless there's a default value for the env template function?
Owner

Yes, it warns but a release note is also good because people ignore warnings 😜 I don't think you can do a default env values, no 😬 Thanks!

Yes, it warns but a release note is also good because people ignore warnings 😜 I don't think you can do a default env values, no 😬 Thanks!
marlon added 1 commit 2026-04-04 20:22:25 +00:00
Owner

I added logic in the config template to default to lmdb if DATABASE_ENGINE is not defined. Does that resolve the problem?

I added logic in the config template to default to `lmdb` if `DATABASE_ENGINE` is not defined. Does that resolve the problem?
Owner

If you tested it and it works, then that looks fine! I thought you'd have to check != "" for truthiness of a string in the golang template? There's very little documentation about how to do this kind of thing, so manual testing is probably best.

If you tested it and it works, then that looks fine! I thought you'd have to check `!= ""` for truthiness of a string in the golang template? There's very little documentation about how to do this kind of thing, so manual testing is probably best.
marlon merged commit 22e218107e into main 2026-04-05 23:02:33 +00:00
fauno deleted branch sqlite 2026-04-06 12:43:50 +00:00
Author
Owner

@marlon thanks!

@decentral1se according to docs:

{{if pipeline}} T1 {{end}}
If the value of the pipeline is empty, no output is generated;
otherwise, T1 is executed. The empty values are false, 0, any
nil pointer or interface value, and any array, slice, map, or
string of length zero.

@marlon thanks! @decentral1se [according to docs](https://pkg.go.dev/text/template#hdr-Actions): > {{if pipeline}} T1 {{end}} > If the value of the pipeline is empty, no output is generated; > otherwise, T1 is executed. The empty values are false, 0, any > nil pointer or interface value, and any array, slice, map, or > string of length zero.
Sign in to join this conversation.
No Reviewers
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

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