notesProject/Jade/Install Garage HQ.md

Install Garage HQ

Official Quick Start

Generating a First Configuration File

metadata_dir = "/var/lib/garage/meta"
data_dir = "/var/lib/garage/data"
db_engine = "sqlite"

replication_factor = 1

rpc_bind_addr = "[::]:3901"
rpc_public_addr = "127.0.0.1:3901"
rpc_secret = "$(openssl rand -hex 32)"

[s3_api]
s3_region = "garage"
api_bind_addr = "[::]:3900"
root_domain = ".s3.garage.localhost"

[s3_web]
bind_addr = "[::]:3902"
root_domain = ".web.garage.localhost"
index = "index.html"

[k2v_api]
api_bind_addr = "[::]:3904"

[admin]
api_bind_addr = "[::]:3903"
admin_token = "$(openssl rand -base64 32)"
metrics_token = "$(openssl rand -base64 32)"

Use command openssl rand -base64 32 to generate tokens and secrets.

Launching the Garage Server with Docker

docker run \
  -d \
  --name garaged \
  -p 3900:3900 -p 3901:3901 -p 3902:3902 -p 3903:3903 \
  -v /path/to/garage.toml:/etc/garage.toml \
  -v /path/to/garage/meta:/var/lib/garage/meta \
  -v /path/to/garage/data:/var/lib/garage/data \
  dxflrs/garage:v2.0.0

After running the container, execute command alias garage="docker exec -ti <container name> /garage" to add garage CLI.

Creating a Cluster Layout

  1. Get node id: garage status
  2. Setup layout: garage layout assign -z dc1 -c 1G <node_id>
  3. Apply layout to the cluster: garage layout apply --version 1

Creating Buckets and Keys

  1. Create bucket: garage bucket create my-bucket
  2. Create key: garage key create my-app-key
  3. Allow the key to access the bucket:
garage bucket allow \
  --read \
  --write \
  --owner \
  my-bucket \
  --key my-app-key
大纲
文件