Follow on from previous post which covered garage installation and basic usage.

See these 2 garage documents:
cookbook - exposing bucket as websote
website integrations

This post shows how to use garage to host a static website.
Note - this will only work for static sites.

# Create a bucket for the site files
garage bucket create example.com
 
# Create a key for bucket access
garage key create example-app-key
 
# Grant key to bucket
garage bucket allow --read --write --owner example.com --key example-app-key
 
# Enable website acess to bucket
garage bucket website --allow example.com
 
# Sync site files to the bucket using rclone, other utilities should work.
# rclone uses 2 definitions;
# fs        local filesystem
# garage    garage access. Run 'rclone config' to define S2 storage. See also https://rclone.org/s3/
rclone sync fs:/www/example.com/public garage:example.com
 
# Test the configuration using curl
curl -H "Host: example.com" http://localhost:3902
 
# Configure a reverse proxy for internet access using caddy
# See: https://caddyserver.com/docs/caddyfile/directives/reverse_proxy
# And: https://garagehq.deuxfleurs.fr/documentation/cookbook/reverse-proxy/
# Caddyfile for access to example.com
# Using Tailscale for access to the garage nodes
example.com {
    reverse_proxy 100.1.2.3:3902 100.1.2.4:3902 {
        health_uri       /health
        health_port      3903
        #health_interval 15s
        #health_timeout  5s
    }
}

Sync of the public files to garage bucket by rcone can be automated using incron.
Where incron would monitor the public directory for changes, if any are seen then incron coud run an action script to sync files to bucket.