···11+# Garage {#module-services-garage}
22+33+[Garage](https://garagehq.deuxfleurs.fr/)
44+is an open-source, self-hostable S3 store, simpler than MinIO, for geodistributed stores.
55+The server setup can be automated using
66+[services.garage](#opt-services.garage.enable). A
77+ client configured to your local Garage instance is available in
88+ the global environment as `garage-manage`.
99+1010+The current default by NixOS is `garage_0_8` which is also the latest
1111+major version available.
1212+1313+## General considerations on upgrades {#module-services-garage-upgrade-scenarios}
1414+1515+Garage provides a cookbook documentation on how to upgrade:
1616+<https://garagehq.deuxfleurs.fr/documentation/cookbook/upgrading/>
1717+1818+::: {.warning}
1919+Garage has two types of upgrades: patch-level upgrades and minor/major version upgrades.
2020+2121+In all cases, you should read the changelog and ideally test the upgrade on a staging cluster.
2222+2323+Checking the health of your cluster can be achieved using `garage-manage repair`.
2424+:::
2525+2626+::: {.warning}
2727+Until 1.0 is released, patch-level upgrades are considered as minor version upgrades.
2828+Minor version upgrades are considered as major version upgrades.
2929+i.e. 0.6 to 0.7 is a major version upgrade.
3030+:::
3131+3232+ - **Straightforward upgrades (patch-level upgrades).**
3333+ Upgrades must be performed one by one, i.e. for each node, stop it, upgrade it : change [stateVersion](#opt-system.stateVersion) or [services.garage.package](#opt-services.garage.package), restart it if it was not already by switching.
3434+ - **Multiple version upgrades.**
3535+ Garage do not provide any guarantee on moving more than one major-version forward.
3636+ E.g., if you're on `0.7`, you cannot upgrade to `0.9`.
3737+ You need to upgrade to `0.8` first.
3838+ As long as [stateVersion](#opt-system.stateVersion) is declared properly,
3939+ this is enforced automatically. The module will issue a warning to remind the user to upgrade to latest
4040+ Garage *after* that deploy.
4141+4242+## Advanced upgrades (minor/major version upgrades) {#module-services-garage-advanced-upgrades}
4343+4444+Here are some baseline instructions to handle advanced upgrades in Garage, when in doubt, please refer to upstream instructions.
4545+4646+ - Disable API and web access to Garage.
4747+ - Perform `garage-manage repair --all-nodes --yes tables` and `garage-manage repair --all-nodes --yes blocks`.
4848+ - Verify the resulting logs and check that data is synced properly between all nodes.
4949+ If you have time, do additional checks (`scrub`, `block_refs`, etc.).
5050+ - Check if queues are empty by `garage-manage stats` or through monitoring tools.
5151+ - Run `systemctl stop garage` to stop the actual Garage version.
5252+ - Backup the metadata folder of ALL your nodes, e.g. for a metadata directory (the default one) in `/var/lib/garage/meta`,
5353+ you can run `pushd /var/lib/garage; tar -acf meta-v0.7.tar.zst meta/; popd`.
5454+ - Run the offline migration: `nix-shell -p garage_0_8 --run "garage offline-repair --yes"`, this can take some time depending on how many objects are stored in your cluster.
5555+ - Bump Garage version in your NixOS configuration, either by changing [stateVersion](#opt-system.stateVersion) or bumping [services.garage.package](#opt-services.garage.package), this should restart Garage automatically.
5656+ - Perform `garage-manage repair --all-nodes --yes tables` and `garage-manage repair --all-nodes --yes blocks`.
5757+ - Wait for a full table sync to run.
5858+5959+Your upgraded cluster should be in a working state, re-enable API and web access.
6060+6161+## Maintainer information {#module-services-garage-maintainer-info}
6262+6363+As stated in the previous paragraph, we must provide a clean upgrade-path for Garage
6464+since it cannot move more than one major version forward on a single upgrade. This chapter
6565+adds some notes how Garage updates should be rolled out in the future.
6666+This is inspired from how Nextcloud does it.
6767+6868+While patch-level updates are no problem and can be done directly in the
6969+package-expression (and should be backported to supported stable branches after that),
7070+major-releases should be added in a new attribute (e.g. Garage `v0.8.0`
7171+should be available in `nixpkgs` as `pkgs.garage_0_8_0`).
7272+To provide simple upgrade paths it's generally useful to backport those as well to stable
7373+branches. As long as the package-default isn't altered, this won't break existing setups.
7474+After that, the versioning-warning in the `garage`-module should be
7575+updated to make sure that the
7676+[package](#opt-services.garage.package)-option selects the latest version
7777+on fresh setups.
7878+7979+If major-releases will be abandoned by upstream, we should check first if those are needed
8080+in NixOS for a safe upgrade-path before removing those. In that case we shold keep those
8181+packages, but mark them as insecure in an expression like this (in
8282+`<nixpkgs/pkgs/tools/filesystem/garage/default.nix>`):
8383+```
8484+/* ... */
8585+{
8686+ garage_0_7_3 = generic {
8787+ version = "0.7.3";
8888+ sha256 = "0000000000000000000000000000000000000000000000000000";
8989+ eol = true;
9090+ };
9191+}
9292+```
9393+9494+Ideally we should make sure that it's possible to jump two NixOS versions forward:
9595+i.e. the warnings and the logic in the module should guard a user to upgrade from a
9696+Garage on e.g. 22.11 to a Garage on 23.11.
+191-128
nixos/modules/services/web-servers/garage-doc.xml
···11-<chapter xmlns="http://docbook.org/ns/docbook"
22- xmlns:xlink="http://www.w3.org/1999/xlink"
33- xmlns:xi="http://www.w3.org/2001/XInclude"
44- version="5.0"
55- xml:id="module-services-garage">
66- <title>Garage</title>
77- <para>
88- <link xlink:href="https://garagehq.deuxfleurs.fr/">Garage</link>
99- is an open-source, self-hostable S3 store, simpler than MinIO, for geodistributed stores.
1010- The server setup can be automated using
1111- <link linkend="opt-services.garage.enable">services.garage</link>. A
1212- client configured to your local Garage instance is available in
1313- the global environment as <literal>garage-manage</literal>.
1414- </para>
1515- <para>
1616- The current default by NixOS is <literal>garage_0_8</literal> which is also the latest
1717- major version available.
1818- </para>
1919- <section xml:id="module-services-garage-upgrade-scenarios">
2020- <title>General considerations on upgrades</title>
2121-11+<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="module-services-garage">
22+ <title>Garage</title>
223 <para>
2323- Garage provides a cookbook documentation on how to upgrade:
2424- <link xlink:href="https://garagehq.deuxfleurs.fr/documentation/cookbook/upgrading/">https://garagehq.deuxfleurs.fr/documentation/cookbook/upgrading/</link>
44+ <link xlink:href="https://garagehq.deuxfleurs.fr/">Garage</link> is
55+ an open-source, self-hostable S3 store, simpler than MinIO, for
66+ geodistributed stores. The server setup can be automated using
77+ <link linkend="opt-services.garage.enable">services.garage</link>. A
88+ client configured to your local Garage instance is available in the
99+ global environment as <literal>garage-manage</literal>.
2510 </para>
2626-2727- <warning>
2828- <para>Garage has two types of upgrades: patch-level upgrades and minor/major version upgrades.</para>
2929-3030- <para>In all cases, you should read the changelog and ideally test the upgrade on a staging cluster.</para>
3131-3232- <para>Checking the health of your cluster can be achieved using <literal>garage-manage repair</literal>.</para>
3333- </warning>
3434-3535-3636- <warning>
3737- <para>Until 1.0 is released, patch-level upgrades are considered as minor version upgrades.
3838- Minor version upgrades are considered as major version upgrades.
3939- i.e. 0.6 to 0.7 is a major version upgrade.</para>
4040- </warning>
4141-4242- <itemizedlist>
4343- <listitem>
4444- <formalpara>
4545- <title>Straightforward upgrades (patch-level upgrades)</title>
1111+ <para>
1212+ The current default by NixOS is <literal>garage_0_8</literal> which
1313+ is also the latest major version available.
1414+ </para>
1515+ <section xml:id="module-services-garage-upgrade-scenarios">
1616+ <title>General considerations on upgrades</title>
1717+ <para>
1818+ Garage provides a cookbook documentation on how to upgrade:
1919+ <link xlink:href="https://garagehq.deuxfleurs.fr/documentation/cookbook/upgrading/" role="uri">https://garagehq.deuxfleurs.fr/documentation/cookbook/upgrading/</link>
2020+ </para>
2121+ <warning>
2222+ <para>
2323+ Garage has two types of upgrades: patch-level upgrades and
2424+ minor/major version upgrades.
2525+ </para>
2626+ <para>
2727+ In all cases, you should read the changelog and ideally test the
2828+ upgrade on a staging cluster.
2929+ </para>
3030+ <para>
3131+ Checking the health of your cluster can be achieved using
3232+ <literal>garage-manage repair</literal>.
3333+ </para>
3434+ </warning>
3535+ <warning>
3636+ <para>
3737+ Until 1.0 is released, patch-level upgrades are considered as
3838+ minor version upgrades. Minor version upgrades are considered as
3939+ major version upgrades. i.e. 0.6 to 0.7 is a major version
4040+ upgrade.
4141+ </para>
4242+ </warning>
4343+ <itemizedlist spacing="compact">
4444+ <listitem>
4545+ <para>
4646+ <emphasis role="strong">Straightforward upgrades (patch-level
4747+ upgrades).</emphasis> Upgrades must be performed one by one,
4848+ i.e. for each node, stop it, upgrade it : change
4949+ <link linkend="opt-system.stateVersion">stateVersion</link> or
5050+ <link linkend="opt-services.garage.package">services.garage.package</link>,
5151+ restart it if it was not already by switching.
5252+ </para>
5353+ </listitem>
5454+ <listitem>
5555+ <para>
5656+ <emphasis role="strong">Multiple version upgrades.</emphasis>
5757+ Garage do not provide any guarantee on moving more than one
5858+ major-version forward. E.g., if you're on
5959+ <literal>0.7</literal>, you cannot upgrade to
6060+ <literal>0.9</literal>. You need to upgrade to
6161+ <literal>0.8</literal> first. As long as
6262+ <link linkend="opt-system.stateVersion">stateVersion</link> is
6363+ declared properly, this is enforced automatically. The module
6464+ will issue a warning to remind the user to upgrade to latest
6565+ Garage <emphasis>after</emphasis> that deploy.
6666+ </para>
6767+ </listitem>
6868+ </itemizedlist>
6969+ </section>
7070+ <section xml:id="module-services-garage-advanced-upgrades">
7171+ <title>Advanced upgrades (minor/major version upgrades)</title>
7272+ <para>
7373+ Here are some baseline instructions to handle advanced upgrades in
7474+ Garage, when in doubt, please refer to upstream instructions.
7575+ </para>
7676+ <itemizedlist spacing="compact">
7777+ <listitem>
7878+ <para>
7979+ Disable API and web access to Garage.
8080+ </para>
8181+ </listitem>
8282+ <listitem>
8383+ <para>
8484+ Perform
8585+ <literal>garage-manage repair --all-nodes --yes tables</literal>
8686+ and
8787+ <literal>garage-manage repair --all-nodes --yes blocks</literal>.
8888+ </para>
8989+ </listitem>
9090+ <listitem>
9191+ <para>
9292+ Verify the resulting logs and check that data is synced
9393+ properly between all nodes. If you have time, do additional
9494+ checks (<literal>scrub</literal>,
9595+ <literal>block_refs</literal>, etc.).
9696+ </para>
9797+ </listitem>
9898+ <listitem>
9999+ <para>
100100+ Check if queues are empty by
101101+ <literal>garage-manage stats</literal> or through monitoring
102102+ tools.
103103+ </para>
104104+ </listitem>
105105+ <listitem>
106106+ <para>
107107+ Run <literal>systemctl stop garage</literal> to stop the
108108+ actual Garage version.
109109+ </para>
110110+ </listitem>
111111+ <listitem>
112112+ <para>
113113+ Backup the metadata folder of ALL your nodes, e.g. for a
114114+ metadata directory (the default one) in
115115+ <literal>/var/lib/garage/meta</literal>, you can run
116116+ <literal>pushd /var/lib/garage; tar -acf meta-v0.7.tar.zst meta/; popd</literal>.
117117+ </para>
118118+ </listitem>
119119+ <listitem>
120120+ <para>
121121+ Run the offline migration:
122122+ <literal>nix-shell -p garage_0_8 --run "garage offline-repair --yes"</literal>,
123123+ this can take some time depending on how many objects are
124124+ stored in your cluster.
125125+ </para>
126126+ </listitem>
127127+ <listitem>
128128+ <para>
129129+ Bump Garage version in your NixOS configuration, either by
130130+ changing
131131+ <link linkend="opt-system.stateVersion">stateVersion</link> or
132132+ bumping
133133+ <link linkend="opt-services.garage.package">services.garage.package</link>,
134134+ this should restart Garage automatically.
135135+ </para>
136136+ </listitem>
137137+ <listitem>
138138+ <para>
139139+ Perform
140140+ <literal>garage-manage repair --all-nodes --yes tables</literal>
141141+ and
142142+ <literal>garage-manage repair --all-nodes --yes blocks</literal>.
143143+ </para>
144144+ </listitem>
145145+ <listitem>
146146+ <para>
147147+ Wait for a full table sync to run.
148148+ </para>
149149+ </listitem>
150150+ </itemizedlist>
46151 <para>
4747- Upgrades must be performed one by one, i.e. for each node, stop it, upgrade it : change <link linkend="opt-system.stateVersion">stateVersion</link> or <link linkend="opt-services.garage.package">services.garage.package</link>, restart it if it was not already by switching.
152152+ Your upgraded cluster should be in a working state, re-enable API
153153+ and web access.
48154 </para>
4949- </formalpara>
5050- </listitem>
5151-5252- <listitem>
5353- <formalpara>
5454- <title>Multiple version upgrades</title>
155155+ </section>
156156+ <section xml:id="module-services-garage-maintainer-info">
157157+ <title>Maintainer information</title>
55158 <para>
5656- Garage do not provide any guarantee on moving more than one major-version forward.
5757- E.g., if you're on <literal>0.7</literal>, you cannot upgrade to <literal>0.9</literal>.
5858- You need to upgrade to <literal>0.8</literal> first.
5959-6060- As long as <link linkend="opt-system.stateVersion">stateVersion</link> is declared properly,
6161- this is enforced automatically. The module will issue a warning to remind the user to upgrade to latest
6262- Garage <emphasis>after</emphasis> that deploy.
6363- </para>
6464- </formalpara>
6565- </listitem>
6666-</itemizedlist>
6767-</section>
6868-6969-<section xml:id="module-services-garage-advanced-upgrades">
7070- <title>Advanced upgrades (minor/major version upgrades)</title>
7171- <para>Here are some baseline instructions to handle advanced upgrades in Garage, when in doubt, please refer to upstream instructions.</para>
7272-7373- <itemizedlist>
7474- <listitem><para>Disable API and web access to Garage.</para></listitem>
7575- <listitem><para>Perform <literal>garage-manage repair --all-nodes --yes tables</literal> and <literal>garage-manage repair --all-nodes --yes blocks</literal>.</para></listitem>
7676- <listitem><para>Verify the resulting logs and check that data is synced properly between all nodes.
7777- If you have time, do additional checks (<literal>scrub</literal>, <literal>block_refs</literal>, etc.).</para></listitem>
7878- <listitem><para>Check if queues are empty by <literal>garage-manage stats</literal> or through monitoring tools.</para></listitem>
7979- <listitem><para>Run <literal>systemctl stop garage</literal> to stop the actual Garage version.</para></listitem>
8080- <listitem><para>Backup the metadata folder of ALL your nodes, e.g. for a metadata directory (the default one) in <literal>/var/lib/garage/meta</literal>,
8181- you can run <literal>pushd /var/lib/garage; tar -acf meta-v0.7.tar.zst meta/; popd</literal>.</para></listitem>
8282- <listitem><para>Run the offline migration: <literal>nix-shell -p garage_0_8 --run "garage offline-repair --yes"</literal>, this can take some time depending on how many objects are stored in your cluster.</para></listitem>
8383- <listitem><para>Bump Garage version in your NixOS configuration, either by changing <link linkend="opt-system.stateVersion">stateVersion</link> or bumping <link linkend="opt-services.garage.package">services.garage.package</link>, this should restart Garage automatically.</para></listitem>
8484- <listitem><para>Perform <literal>garage-manage repair --all-nodes --yes tables</literal> and <literal>garage-manage repair --all-nodes --yes blocks</literal>.</para></listitem>
8585- <listitem><para>Wait for a full table sync to run.</para></listitem>
8686- </itemizedlist>
8787-8888- <para>
8989- Your upgraded cluster should be in a working state, re-enable API and web access.
9090- </para>
9191-</section>
9292-9393-<section xml:id="module-services-garage-maintainer-info">
9494- <title>Maintainer information</title>
9595-9696- <para>
9797- As stated in the previous paragraph, we must provide a clean upgrade-path for Garage
9898- since it cannot move more than one major version forward on a single upgrade. This chapter
9999- adds some notes how Garage updates should be rolled out in the future.
100100-101101- This is inspired from how Nextcloud does it.
102102- </para>
103103-104104- <para>
105105- While patch-level updates are no problem and can be done directly in the
106106- package-expression (and should be backported to supported stable branches after that),
107107- major-releases should be added in a new attribute (e.g. Garage <literal>v0.8.0</literal>
108108- should be available in <literal>nixpkgs</literal> as <literal>pkgs.garage_0_8_0</literal>).
109109- To provide simple upgrade paths it's generally useful to backport those as well to stable
110110- branches. As long as the package-default isn't altered, this won't break existing setups.
111111- After that, the versioning-warning in the <literal>garage</literal>-module should be
112112- updated to make sure that the
113113- <link linkend="opt-services.garage.package">package</link>-option selects the latest version
114114- on fresh setups.
115115- </para>
116116-117117- <para>
118118- If major-releases will be abandoned by upstream, we should check first if those are needed
119119- in NixOS for a safe upgrade-path before removing those. In that case we shold keep those
120120- packages, but mark them as insecure in an expression like this (in
121121- <literal><nixpkgs/pkgs/tools/filesystem/garage/default.nix></literal>):
122122-<programlisting>
159159+ As stated in the previous paragraph, we must provide a clean
160160+ upgrade-path for Garage since it cannot move more than one major
161161+ version forward on a single upgrade. This chapter adds some notes
162162+ how Garage updates should be rolled out in the future. This is
163163+ inspired from how Nextcloud does it.
164164+ </para>
165165+ <para>
166166+ While patch-level updates are no problem and can be done directly
167167+ in the package-expression (and should be backported to supported
168168+ stable branches after that), major-releases should be added in a
169169+ new attribute (e.g. Garage <literal>v0.8.0</literal> should be
170170+ available in <literal>nixpkgs</literal> as
171171+ <literal>pkgs.garage_0_8_0</literal>). To provide simple upgrade
172172+ paths it's generally useful to backport those as well to stable
173173+ branches. As long as the package-default isn't altered, this won't
174174+ break existing setups. After that, the versioning-warning in the
175175+ <literal>garage</literal>-module should be updated to make sure
176176+ that the
177177+ <link linkend="opt-services.garage.package">package</link>-option
178178+ selects the latest version on fresh setups.
179179+ </para>
180180+ <para>
181181+ If major-releases will be abandoned by upstream, we should check
182182+ first if those are needed in NixOS for a safe upgrade-path before
183183+ removing those. In that case we shold keep those packages, but
184184+ mark them as insecure in an expression like this (in
185185+ <literal><nixpkgs/pkgs/tools/filesystem/garage/default.nix></literal>):
186186+ </para>
187187+ <programlisting>
123188/* ... */
124189{
125190 garage_0_7_3 = generic {
126126- version = "0.7.3";
127127- sha256 = "0000000000000000000000000000000000000000000000000000";
191191+ version = "0.7.3";
192192+ sha256 = "0000000000000000000000000000000000000000000000000000";
128193 eol = true;
129194 };
130195}
131196</programlisting>
132132- </para>
133133-134134- <para>
135135- Ideally we should make sure that it's possible to jump two NixOS versions forward:
136136- i.e. the warnings and the logic in the module should guard a user to upgrade from a
137137- Garage on e.g. 22.11 to a Garage on 23.11.
138138- </para>
139139- </section>
140140-197197+ <para>
198198+ Ideally we should make sure that it's possible to jump two NixOS
199199+ versions forward: i.e. the warnings and the logic in the module
200200+ should guard a user to upgrade from a Garage on e.g. 22.11 to a
201201+ Garage on 23.11.
202202+ </para>
203203+ </section>
141204</chapter>
+2
nixos/modules/services/web-servers/garage.nix
···99in
1010{
1111 meta = {
1212+ # Don't edit the docbook xml directly, edit the md and generate it:
1313+ # `pandoc garage-doc.md -t docbook --top-level-division=chapter --extract-media=media -f markdown-smart --lua-filter ../../../../doc/build-aux/pandoc-filters/myst-reader/roles.lua --lua-filter ../../../../doc/build-aux/pandoc-filters/docbook-writer/rst-roles.lua > garage-doc.xml`
1214 doc = ./garage-doc.xml;
1315 maintainers = with pkgs.lib.maintainers; [ raitobezarius ];
1416 };