feat(deploy): add center host docker compose stack for git, registry and s3 hosting

This commit is contained in:
zetaloop
2026-05-05 08:45:58 +08:00
parent d1ff2661d1
commit 2a41969771
9 changed files with 443 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
#!/usr/bin/env bash
set -euo pipefail
GARAGE="docker compose exec -T garage /garage"
NODE_ID="$($GARAGE node id -q | cut -d@ -f1 | tr -d '\r')"
echo "node id: $NODE_ID"
$GARAGE layout assign -z dc1 -c 10G "$NODE_ID"
$GARAGE layout apply --version 1
$GARAGE bucket create juwan-objectstory
$GARAGE bucket create juwan-pg-backup
KEY_INFO="$($GARAGE key create juwan-app)"
echo "$KEY_INFO"
ACCESS_KEY="$(echo "$KEY_INFO" | awk '/Key ID:/ {print $3}')"
SECRET_KEY="$(echo "$KEY_INFO" | awk '/Secret key:/ {print $3}')"
$GARAGE bucket allow --read --write --owner juwan-objectstory --key juwan-app
$GARAGE bucket allow --read --write --owner juwan-pg-backup --key juwan-app
cat <<EOF
S3_ENDPOINT=https://s3.juwan.xhttp.zip
S3_REGION=garage
S3_ACCESS_KEY=$ACCESS_KEY
S3_SECRET_KEY=$SECRET_KEY
S3_BUCKET_NAME=juwan-objectstory
EOF
+26
View File
@@ -0,0 +1,26 @@
metadata_dir = "/var/lib/garage/meta"
data_dir = "/var/lib/garage/data"
db_engine = "sqlite"
replication_factor = 1
consistency_mode = "consistent"
rpc_bind_addr = "[::]:3901"
rpc_public_addr = "garage:3901"
rpc_secret = "@RPC_SECRET@"
[s3_api]
api_bind_addr = "[::]:3900"
s3_region = "garage"
root_domain = ".s3.juwan.xhttp.zip"
[s3_web]
bind_addr = "[::]:3902"
root_domain = ".web.juwan.xhttp.zip"
index = "index.html"
[admin]
api_bind_addr = "[::]:3903"
admin_token = "@ADMIN_TOKEN@"
metrics_token = "@METRICS_TOKEN@"
metrics_require_token = true