74 lines
2.2 KiB
Bash
74 lines
2.2 KiB
Bash
#!/bin/bash
|
|
# MinIO deployment script
|
|
# Target server: gateway server (192.168.1.200 / 14.215.128.96)
|
|
# API port : 9100 (S3-compatible)
|
|
# Console : 9101
|
|
#
|
|
# Usage: ./deploy.sh [up|down|status|init|logs]
|
|
|
|
set -e
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
# All buckets used by backend microservices
|
|
BUCKETS=(
|
|
app-releases # admin-service — APK/IPA packages
|
|
kyc-documents # compliance-service — KYC verification files
|
|
coupon-images # issuer-service — coupon artwork
|
|
issuer-documents # issuer-service — prospectus / legal docs
|
|
sar-reports # compliance-service — SAR export files
|
|
avatars # user-service — profile pictures
|
|
exports # clearing-service — finance report exports
|
|
)
|
|
|
|
# Buckets that should be publicly readable (no auth needed for download)
|
|
# app-releases: APK/IPA packages downloaded directly by mobile apps via oss.gogenex.com
|
|
PUBLIC_BUCKETS=(app-releases coupon-images avatars)
|
|
|
|
_init_buckets() {
|
|
local user="${MINIO_ROOT_USER:-genex-admin}"
|
|
local pass="${MINIO_ROOT_PASSWORD:-genex-minio-secret}"
|
|
|
|
docker exec genex-minio mc alias set local http://localhost:9000 "$user" "$pass"
|
|
|
|
for bucket in "${BUCKETS[@]}"; do
|
|
docker exec genex-minio mc mb --ignore-existing "local/${bucket}"
|
|
echo " bucket ready: ${bucket}"
|
|
done
|
|
|
|
for bucket in "${PUBLIC_BUCKETS[@]}"; do
|
|
docker exec genex-minio mc anonymous set download "local/${bucket}"
|
|
echo " public download enabled: ${bucket}"
|
|
done
|
|
}
|
|
|
|
case "${1:-up}" in
|
|
up)
|
|
docker compose -f "$SCRIPT_DIR/docker-compose.yml" up -d
|
|
echo "Waiting for MinIO to be ready..."
|
|
sleep 4
|
|
_init_buckets
|
|
echo ""
|
|
echo "MinIO is running:"
|
|
echo " S3 API : http://192.168.1.200:9100"
|
|
echo " Console : http://192.168.1.200:9101"
|
|
;;
|
|
down)
|
|
docker compose -f "$SCRIPT_DIR/docker-compose.yml" down
|
|
;;
|
|
status)
|
|
docker compose -f "$SCRIPT_DIR/docker-compose.yml" ps
|
|
;;
|
|
init)
|
|
# Re-create buckets without restarting the container
|
|
_init_buckets
|
|
;;
|
|
logs)
|
|
docker compose -f "$SCRIPT_DIR/docker-compose.yml" logs -f
|
|
;;
|
|
*)
|
|
echo "Usage: $0 [up|down|status|init|logs]"
|
|
exit 1
|
|
;;
|
|
esac
|