1# Garage {#module-services-garage} 2 3[Garage](https://garagehq.deuxfleurs.fr/) 4is an open-source, self-hostable S3 store, simpler than MinIO, for geodistributed stores. 5The server setup can be automated using 6[services.garage](#opt-services.garage.enable). A 7 client configured to your local Garage instance is available in 8 the global environment as `garage-manage`. 9 10## General considerations on upgrades {#module-services-garage-upgrade-scenarios} 11 12Garage provides a cookbook documentation on how to upgrade: 13<https://garagehq.deuxfleurs.fr/documentation/cookbook/upgrading/> 14 15::: {.warning} 16Garage has two types of upgrades: patch-level upgrades and minor/major version upgrades. 17 18In all cases, you should read the changelog and ideally test the upgrade on a staging cluster. 19 20Checking the health of your cluster can be achieved using `garage-manage repair`. 21::: 22 23 - **Straightforward upgrades (patch-level upgrades).** 24 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. 25 - **Multiple version upgrades.** 26 Garage do not provide any guarantee on moving more than one major-version forward. 27 E.g., if you're on `0.9`, you cannot upgrade to `2.0`. 28 You need to upgrade to `1.2` first. 29 As long as [stateVersion](#opt-system.stateVersion) is declared properly, 30 this is enforced automatically. The module will issue a warning to remind the user to upgrade to latest 31 Garage *after* that deploy. 32 33## Advanced upgrades (minor/major version upgrades) {#module-services-garage-advanced-upgrades} 34 35Here are some baseline instructions to handle advanced upgrades in Garage, when in doubt, please refer to upstream instructions. 36 37 - Disable API and web access to Garage. 38 - Perform `garage-manage repair --all-nodes --yes tables` and `garage-manage repair --all-nodes --yes blocks`. 39 - Verify the resulting logs and check that data is synced properly between all nodes. 40 If you have time, do additional checks (`scrub`, `block_refs`, etc.). 41 - Check if queues are empty by `garage-manage stats` or through monitoring tools. 42 - Run `systemctl stop garage` to stop the actual Garage version. 43 - Backup the metadata folder of ALL your nodes, e.g. for a metadata directory (the default one) in `/var/lib/garage/meta`, 44 you can run `pushd /var/lib/garage; tar -acf meta-v0.7.tar.zst meta/; popd`. 45 - Run the offline migration: `nix-shell -p garage_1 --run "garage offline-repair --yes"`, this can take some time depending on how many objects are stored in your cluster. 46 - 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. 47 - Perform `garage-manage repair --all-nodes --yes tables` and `garage-manage repair --all-nodes --yes blocks`. 48 - Wait for a full table sync to run. 49 50Your upgraded cluster should be in a working state, re-enable API and web access. 51 52## Maintainer information {#module-services-garage-maintainer-info} 53 54As stated in the previous paragraph, we must provide a clean upgrade-path for Garage 55since it cannot move more than one major version forward on a single upgrade. This chapter 56adds some notes how Garage updates should be rolled out in the future. 57This is inspired from how Nextcloud does it. 58 59While patch-level updates are no problem and can be done directly in the 60package-expression (and should be backported to supported stable branches after that), 61major-releases should be added in a new attribute (e.g. Garage `v3.0.0` 62should be available in `nixpkgs` as `pkgs.garage_3`). 63To provide simple upgrade paths it's generally useful to backport those as well to stable 64branches. As long as the package-default isn't altered, this won't break existing setups. 65After that, the versioning-warning in the `garage`-module should be 66updated to make sure that the 67[package](#opt-services.garage.package)-option selects the latest version 68on fresh setups. 69 70If major-releases will be abandoned by upstream, we should check first if those are needed 71in NixOS for a safe upgrade-path before removing those. In that case we should keep those 72packages, but mark them as insecure in an expression like this (in 73`<nixpkgs/pkgs/tools/filesystem/garage/default.nix>`): 74```nix 75# ... 76{ 77 garage_1_2_0 = generic { 78 version = "1.2.0"; 79 sha256 = "0000000000000000000000000000000000000000000000000000"; 80 eol = true; 81 }; 82} 83``` 84 85Ideally we should make sure that it's possible to jump two NixOS versions forward: 86i.e. the warnings and the logic in the module should guard a user to upgrade from a 87Garage on e.g. 22.11 to a Garage on 23.11.