Config and init scripts for Garage

Initial commit

Chris Walker 03285476

+94
+9
README.md
···
··· 1 + # garage-setup 2 + 3 + Basic setup script for [Garage](https://garagehq.deuxfleurs.fr),within my Geospatial homelab. It specifically: 4 + 5 + 1. Creates a basic 20Gb layout for Garage, 6 + 2. Assigns the basic layout at v1, 7 + 3. Create buckets for overture/, pmtiles/ and osm/, 8 + 4. Creates a general `homelab-key`, 9 + 5. Assigns the key to all buckets created in step 3).
+26
conf/garage.toml
···
··· 1 + metadata_dir = "/var/lib/garage/meta" 2 + data_dir = "/var/lib/garage/data" 3 + 4 + replication_factor = 1 5 + 6 + rpc_bind_addr = "[::]:3901" 7 + rpc_public_addr = "127.0.0.1:3901" 8 + rpc_secret = "aa7830ba2627b93b82acc4baac5de26b7a65eaa4e2ff564823396f4ad07f19f7" 9 + 10 + [s3_api] 11 + s3_region = "homelab" 12 + api_bind_addr = "[::]:3900" 13 + root_domain = ".s3.garage.localhost" 14 + 15 + [s3_web] 16 + bind_addr = "[::]:3902" 17 + root_domain = ".web.garage.localhost" 18 + index = "index.html" 19 + 20 + [k2v_api] 21 + api_bind_addr = "[::]:3904" 22 + 23 + [admin] 24 + api_bind_addr = "[::]:3903" 25 + admin_token = "Wg5HLY2pq2YPP3RYPL/VnviafdBrRWlvwTaxPoq9X/k=" 26 + metrics_token = "0eo0BMr9zT/uLyEDVd2yBZ3rlll8j1drToe56V6dcww="
+43
garage-setup.sh
···
··· 1 + #!/usr/bin/env bash 2 + 3 + # 4 + # Note this assumes that a configuration file for garage can be 5 + # found at /etc/garage.toml. 6 + # 7 + 8 + KEY=homelab-key 9 + 10 + # Prerequisites - check garage is running, and that config can be 11 + # located. 12 + if [ ! -f /etc/garage.toml ]; then 13 + echo "cannot file garage.toml configuration in /etc, exiting." 14 + exit 1 15 + fi 16 + 17 + # Set status and node ID 18 + node_id=$(sudo garage status | awk 'NR ==3 { print $1}') 19 + 20 + # Create and assign layouts. 21 + sudo garage layout assign -z homelab -c 20G "${node_id}" 22 + sudo garage layout apply --version 1 23 + 24 + # Create `homelab-key` key. 25 + sudo garage key create "${KEY}" 26 + # TODO - catch/emit key_id and secret 27 + 28 + # Create buckets and assign key to them. 29 + declare -a buckets=( 30 + "overture" 31 + "pmtiles" 32 + "osm" 33 + ) 34 + 35 + for bucket in "${buckets[@]}"; do 36 + sudo garage bucket create "${bucket}" 37 + sudo garage bucket allow \ 38 + --read \ 39 + --write \ 40 + --owner \ 41 + "${bucket}" \ 42 + --key "${KEY}" 43 + done
+16
systemd/garage.service
···
··· 1 + [Unit] 2 + Description=Garage Object Storage 3 + After=network-online.target 4 + Wants=network-online.target 5 + 6 + [Service] 7 + Environment='RUST_LOG=garage=info' 'RUST_BACKTRACE=1' 8 + ExecStart=/usr/local/bin/garage server 9 + StateDirectory=garage 10 + DynamicUser=true 11 + ProtectHome=true 12 + NoNewPrivileges=true 13 + LimitNOFILE=42000 14 + 15 + [Install] 16 + WantedBy=multi-user.target