You have one application bucket in Montreal and a copy of the same bucket someone hand-rsynced to Toronto for “disaster recovery” — except the rsync stopped working three months ago and nobody noticed. The single-zone Garage you stood up to absorb backups was fine when DR was a wish, but the customer is now in a contract that names two regions. Garage was built exactly for this: zone-aware replication, where the cluster understands that node A and node B are in zone montreal and node C is in zone toronto, and a write of replication factor 3 produces one copy per zone with smart placement of the third. Done right, you get a geo-distributed S3 endpoint that survives an entire zone going dark, with a single S3 API in front and no hand-rolled rsync.
What’s happening
Garage is a single Go binary that runs an S3-compatible object store on top of a self-managed cluster. Unlike MinIO (which is rack-aware but assumes a single physical location), Garage was designed for multi-DC from day one — the layout system is built around “zones” as a first-class concept, and the replication strategy makes deliberate placement decisions across them. The internal layout is a consistent-hash ring where each node declares its zone, capacity, and weight; Garage’s layout apply pass computes the placement of partitions across zones such that no single zone holds the only copy of a partition.
The classic geo-distributed pattern is three nodes split 2/1 across two zones: two nodes in the primary zone (where most traffic lives), one node in a secondary zone (DR posture, lower throughput). With replication factor 3, Garage places one copy per zone, plus the third in whichever zone has remaining capacity — so every partition has at least one replica in each zone, and losing the entire secondary zone leaves you with two replicas online for full read/write availability.
The tradeoff: cross-zone writes are slow. A PUT must acknowledge from a quorum of nodes that include at least one in each zone if you want strong cross-zone durability, and that quorum write traverses the WAN every time. For workloads that can tolerate eventual cross-zone consistency, Garage supports consistency_mode: degraded for reads — reads served by the local zone may not yet reflect a write that’s still propagating to the remote zone, but availability stays up if the remote zone is unreachable. Pick the consistency model that matches your workload, not the one that sounds safest.
The S3 IAM model in Garage is bucket-scoped: keys are created with garage key new, granted permissions on buckets with garage bucket allow, and applied to the cluster on next layout apply. There’s no IAM policy DSL — it’s RBAC by command, which keeps the surface small and the audit trail readable.
How to verify
After the installer runs on all three nodes, cluster topology shows two zones:
garage status
# ==== HEALTHY NODES ====
# ID Hostname Address Tags Zone Capacity
# abc123... g1-mtl 10.50.0.11 [] montreal 500.0 GB
# def456... g2-mtl 10.50.0.12 [] montreal 500.0 GB
# ghi789... g3-tor 10.60.0.13 [] toronto 500.0 GB
Layout has replication factor 3 across the two zones:
garage layout show
# Current cluster layout:
# Zones: montreal (1000 GB), toronto (500 GB)
# Replication factor: 3
# ...
Check that the S3 endpoint responds from each node:
curl -sk https://10.50.0.11:3900/health
# {"status":"healthy"}
curl -sk https://10.60.0.13:3900/health
# {"status":"healthy"}
Write through one zone, read from the other:
aws --endpoint-url https://s3.example.com s3 mb s3://app-uploads
echo "probe-$(date +%s)" > /tmp/probe
aws --endpoint-url https://s3-mtl.example.com s3 cp /tmp/probe s3://app-uploads/probe
aws --endpoint-url https://s3-tor.example.com s3 cp s3://app-uploads/probe -
Drill: stop Garage on the Toronto node (systemctl stop garage). Reads and writes through the Montreal endpoint stay up. garage status from Montreal shows the Toronto node as FAILED — once you restart it, it catches up automatically via gossip and Merkle tree sync.
The fix
Save the script as /root/setup-garage-node.sh and run it on each of the three nodes after editing the per-node variables at the top. The installer covers: base hardening (UFW, fail2ban, unattended-upgrades, SSH key-only), Garage 1.1 binary install, persistent data and metadata directories on a dedicated data drive, RPC encryption secret (shared across cluster — pre-generate on node 1 and copy), TLS for the S3 API, systemd unit with proper restart behavior, and a one-shot cluster-init block to run on node 1 after all three are up.
#!/usr/bin/env bash
set -euo pipefail
### Debian 12 / Ubuntu 22.04 Garage multi-zone installer (3 nodes, 2 zones)
### Run on each node after editing variables below
### Topology assumption:
### g1-mtl, g2-mtl in zone "montreal"
### g3-tor in zone "toronto"
### Replication factor 3, one copy per zone where possible
if [[ "$(id -u)" -ne 0 ]]; then
echo "Run as root."
exit 1
fi
# === EDIT PER NODE ===
NODE_NAME="g1-mtl" # g1-mtl | g2-mtl | g3-tor
NODE_IP="10.50.0.11"
NODE_ZONE="montreal" # montreal | toronto
NODE_CAPACITY="500G"
GARAGE_VERSION="1.1.0"
# Cluster-wide values (SAME on every node)
RPC_SECRET="CHANGE_ME_64_HEX_CHARS_RUN_OPENSSL_RAND_HEX_32_ON_NODE1"
ADMIN_TOKEN="CHANGE_ME_LONG_RANDOM_ADMIN_TOKEN"
S3_DOMAIN="s3.example.com"
# Peer list (used at first start so nodes find each other)
PEER_LIST=(
"10.50.0.11:3901"
"10.50.0.12:3901"
"10.60.0.13:3901"
)
# Data drive (Garage writes data + metadata here; XFS or ext4)
DATA_MOUNT="/var/lib/garage"
# =====================
echo
echo "========================================"
echo "Garage ${NODE_NAME} (${NODE_IP}, ${NODE_ZONE})"
echo "========================================"
echo
echo "==> Updating base OS"
export DEBIAN_FRONTEND=noninteractive
apt-get -y update
apt-get -y upgrade
apt-get -y install \
curl wget ca-certificates gnupg jq xfsprogs lvm2 \
ufw fail2ban unattended-upgrades chrony \
lsof net-tools dnsutils tcpdump openssl
systemctl enable --now chrony
echo "==> Unattended security updates"
cat > /etc/apt/apt.conf.d/52unattended-upgrades-local <<'APT'
Unattended-Upgrade::Origins-Pattern {
"origin=Debian,codename=${distro_codename},label=Debian-Security";
"origin=Ubuntu,codename=${distro_codename},label=Ubuntu-Security";
};
Unattended-Upgrade::Automatic-Reboot "false";
APT
dpkg-reconfigure -fnoninteractive unattended-upgrades
echo "==> SSH key-only"
sed -i 's|^[#[:space:]]*PermitRootLogin.*|PermitRootLogin prohibit-password|' /etc/ssh/sshd_config
sed -i 's|^[#[:space:]]*PasswordAuthentication.*|PasswordAuthentication no|' /etc/ssh/sshd_config
sshd -t && systemctl restart ssh
echo "==> fail2ban"
cat > /etc/fail2ban/jail.d/sshd.local <<'FAIL2BAN'
[sshd]
enabled = true
port = ssh
backend = systemd
maxretry = 4
findtime = 10m
bantime = 1h
FAIL2BAN
systemctl enable --now fail2ban
echo "==> Kernel/sysctl"
cat > /etc/sysctl.d/99-garage.conf <<'SYSCTL'
fs.file-max = 4194304
vm.swappiness = 1
vm.dirty_background_ratio = 5
vm.dirty_ratio = 20
net.core.somaxconn = 8192
net.ipv4.tcp_max_syn_backlog = 16384
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.ip_local_port_range = 10240 65535
SYSCTL
sysctl --system
cat > /etc/security/limits.d/99-garage.conf <<'LIMITS'
garage soft nofile 1048576
garage hard nofile 1048576
garage soft nproc 65535
garage hard nproc 65535
LIMITS
echo "==> Creating garage user"
if ! id garage >/dev/null 2>&1; then
groupadd -r garage
useradd -M -r -g garage -s /sbin/nologin garage
fi
echo "==> UFW (allow intra-cluster + S3 from VPC)"
ufw --force reset
ufw default deny incoming
ufw default allow outgoing
ufw allow 22/tcp
for peer in "${PEER_LIST[@]}"; do
ip="${peer%%:*}"
ufw allow from "${ip}" to any port 3900 proto tcp # S3 API
ufw allow from "${ip}" to any port 3901 proto tcp # RPC
ufw allow from "${ip}" to any port 3902 proto tcp # S3 web (static site)
ufw allow from "${ip}" to any port 3903 proto tcp # admin
done
# S3 endpoint reachable from VPC subnets — adjust to your CIDR
ufw allow from 10.50.0.0/16 to any port 3900 proto tcp
ufw allow from 10.60.0.0/16 to any port 3900 proto tcp
echo "==> Mounting data dir"
mkdir -p "${DATA_MOUNT}/meta" "${DATA_MOUNT}/data"
# If you have a dedicated drive, format/mount it before running this script.
chown -R garage:garage "${DATA_MOUNT}"
echo "==> Downloading Garage ${GARAGE_VERSION}"
curl -sSL "https://garagehq.deuxfleurs.fr/_releases/v${GARAGE_VERSION}/x86_64-unknown-linux-musl/garage" \
-o /usr/local/bin/garage
chmod +x /usr/local/bin/garage
echo "==> Internal TLS (self-signed; replace with real CA when ready)"
mkdir -p /etc/garage/tls
if [[ ! -f /etc/garage/tls/server.crt ]]; then
openssl req -x509 -newkey rsa:4096 -nodes \
-keyout /etc/garage/tls/server.key \
-out /etc/garage/tls/server.crt \
-days 825 \
-subj "/CN=${NODE_NAME}.${S3_DOMAIN}/O=Garage Cluster" \
-addext "subjectAltName=IP:${NODE_IP},DNS:${NODE_NAME}.${S3_DOMAIN},DNS:${S3_DOMAIN},DNS:*.${S3_DOMAIN}"
fi
chown -R garage:garage /etc/garage/tls
chmod 600 /etc/garage/tls/server.key
echo "==> Writing garage.toml"
PEER_TOML=""
for peer in "${PEER_LIST[@]}"; do
PEER_TOML+="\"${peer}\","
done
PEER_TOML="${PEER_TOML%,}"
cat > /etc/garage.toml <<EOF
metadata_dir = "${DATA_MOUNT}/meta"
data_dir = "${DATA_MOUNT}/data"
db_engine = "lmdb"
replication_factor = 3
consistency_mode = "consistent"
rpc_bind_addr = "[::]:3901"
rpc_public_addr = "${NODE_IP}:3901"
rpc_secret = "${RPC_SECRET}"
bootstrap_peers = [${PEER_TOML}]
[s3_api]
s3_region = "garage"
api_bind_addr = "[::]:3900"
root_domain = ".${S3_DOMAIN}"
[s3_web]
bind_addr = "[::]:3902"
root_domain = ".web.${S3_DOMAIN}"
index = "index.html"
[admin]
api_bind_addr = "[::]:3903"
admin_token = "${ADMIN_TOKEN}"
metrics_token = "${ADMIN_TOKEN}"
[k2v_api]
api_bind_addr = "[::]:3904"
EOF
chown garage:garage /etc/garage.toml
chmod 600 /etc/garage.toml
echo "==> systemd unit"
cat > /etc/systemd/system/garage.service <<'GARAGE'
[Unit]
Description=Garage Data Store
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=garage
Group=garage
ExecStart=/usr/local/bin/garage server
Environment="RUST_BACKTRACE=1" "RUST_LOG=garage=info"
Restart=on-failure
RestartSec=5
LimitNOFILE=1048576
TasksMax=infinity
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target
GARAGE
systemctl daemon-reload
systemctl enable --now garage
echo "==> Waiting for Garage to come up"
for i in {1..30}; do
if /usr/local/bin/garage status >/dev/null 2>&1; then break; fi
sleep 2
done
ufw --force enable
echo
echo "========================================"
echo "Garage running on ${NODE_NAME}."
echo "Node ID:"
echo "========================================"
/usr/local/bin/garage node id 2>/dev/null || true
echo
echo "Next steps:"
echo "1. After all 3 nodes are up, on node1 only run the layout assignment."
echo "2. After layout apply, create the application bucket and key."
echo
cat <<'INIT'
# === ON NODE 1 ONLY, AFTER ALL 3 NODES ARE RUNNING ===
# Collect the node IDs (first 8 chars of each)
garage status
# Assign each node a zone and capacity (replace IDs with the ones from garage status)
garage layout assign abc123 -z montreal -c 500G -t g1-mtl
garage layout assign def456 -z montreal -c 500G -t g2-mtl
garage layout assign ghi789 -z toronto -c 500G -t g3-tor
# Show the proposed layout
garage layout show
# Apply the layout (replication-factor 3 across 2 zones)
garage layout apply --version 1
# Wait until the cluster settles
garage status
# Create application bucket + scoped key
garage bucket create app-uploads
garage key new --name app-writer
# Capture the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY from output
garage bucket allow --read --write --owner app-uploads --key <KEY_ID>
# Configure CORS if needed (for browser-direct uploads)
garage bucket website --allow app-uploads
# Verify with awscli
export AWS_ACCESS_KEY_ID=<KEY_ID>
export AWS_SECRET_ACCESS_KEY=<SECRET>
echo "probe-$(date +%s)" > /tmp/probe
aws --endpoint-url https://10.50.0.11:3900 --no-verify-ssl s3 cp /tmp/probe s3://app-uploads/probe
aws --endpoint-url https://10.60.0.13:3900 --no-verify-ssl s3 cp s3://app-uploads/probe -
# Same content from both zones = cross-zone replication is working
INIT
Make it executable and run on each node:
chmod 700 /root/setup-garage-node.sh
/root/setup-garage-node.sh
On node 1 only, run the post-init block: collect the node IDs from garage status, assign each node to its zone with garage layout assign, and apply the layout with replication factor 3. Garage gossips the layout to the other nodes; within a couple of minutes, the cluster reports HEALTHY for all three nodes. Create the application bucket and a scoped key with garage bucket create and garage key new, then confirm cross-zone replication by writing through Montreal and reading the same content from Toronto.
For the S3 endpoint in front of clients, run HAProxy or Caddy with two regional DNS records: s3-mtl.example.com points at the two Montreal nodes, s3-tor.example.com points at Toronto. Most clients hit the local-region endpoint; the cluster does the cross-zone work behind the scenes. If you need a single global S3 endpoint, run a layer-7 proxy with geo-DNS — but the simpler pattern is application code that knows which region it lives in and uses the local endpoint.
Operational notes. Garage’s Merkle tree sync handles temporary node loss gracefully: when a downed node returns, it discovers the deltas it missed via gossip and pulls them from peers. Capacity rebalancing happens via garage layout assign with new weights, then garage layout apply — the rebalance is online. Don’t run layout apply while a previous one is still propagating (garage status reports “syncing”). Watch your inter-zone WAN cost: every cross-zone write copies bytes between datacenters, and if your workload is write-heavy that bill adds up.
Stand up Garage multi-zone with WAN-cost monitoring, layout drills, and TLS rotation under Stack Harbor’s environment management, on our managed cloud compute — or tell us your zone topology and we’ll plan capacity and replication strategy together.