Configure Docker registry integration for CHORUS Services

Registry Configuration:
- Updated docker-compose.yml to use registry.home.deepblack.cloud images
- Created build-and-push.sh script for automated image building/pushing
- Enhanced chorus.sh with registry operations (login, build, pull)
- Added docker-compose.dev.yml for development with local builds
- Added docker-compose.swarm.yml for production deployment

Production Features:
- Docker Swarm deployment with Traefik integration
- All services available at *.home.deepblack.cloud domains
- Production-grade resource limits and placement constraints
- SSL/TLS certificates via Let's Encrypt
- Load balancing and high availability

Development Features:
- ./chorus.sh dev - Local builds with live reloading
- ./chorus.sh build - Build and push to registry
- ./chorus.sh deploy - Production swarm deployment
- Registry authentication with credentials

Images stored at:
- registry.home.deepblack.cloud/tony/chorus-whoosh-backend:latest
- registry.home.deepblack.cloud/tony/chorus-whoosh-frontend:latest
- registry.home.deepblack.cloud/tony/chorus-bzzz-coordinator:latest
- registry.home.deepblack.cloud/tony/chorus-slurp-api:latest
- registry.home.deepblack.cloud/tony/chorus-slurp-rl-tuner:latest

Ready for both development and production deployment.
This commit is contained in:
tony
2025-08-01 09:23:26 +10:00
parent 2090a94f58
commit ecca86b0fe
6 changed files with 619 additions and 33 deletions

166
build-and-push.sh Executable file
View File

@@ -0,0 +1,166 @@
#!/bin/bash
# CHORUS Services - Build and Push Script
# Builds all Docker images and pushes them to the local registry
set -e
REGISTRY="registry.home.deepblack.cloud"
REGISTRY_USER="tony"
REGISTRY_PASS="silverfrond[1392]"
TAG="latest"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Print colored output
print_info() {
echo -e "${BLUE}[INFO]${NC} $1"
}
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
# Docker registry login
docker_login() {
print_info "Logging into Docker registry: $REGISTRY"
echo "$REGISTRY_PASS" | docker login "$REGISTRY" --username "$REGISTRY_USER" --password-stdin
print_success "Successfully logged into registry"
}
# Build and push a single image
build_and_push() {
local name=$1
local context=$2
local dockerfile=${3:-"Dockerfile"}
local image_name="$REGISTRY/tony/chorus-${name}:$TAG"
print_info "Building $name from $context"
if [ -f "$context/$dockerfile" ]; then
docker build -t "$image_name" -f "$context/$dockerfile" "$context"
print_success "Built $image_name"
print_info "Pushing $image_name to registry"
docker push "$image_name"
print_success "Pushed $image_name"
else
print_error "Dockerfile not found: $context/$dockerfile"
return 1
fi
}
# Main build process
main() {
print_info "Starting CHORUS Services build and push process"
# Login to registry
docker_login
# Build and push all images
print_info "Building all CHORUS Services components..."
# WHOOSH Backend
if [ -d "modules/whoosh/backend" ]; then
build_and_push "whoosh-backend" "modules/whoosh/backend"
else
print_warning "WHOOSH backend directory not found - skipping"
fi
# WHOOSH Frontend
if [ -d "modules/whoosh/frontend" ]; then
build_and_push "whoosh-frontend" "modules/whoosh/frontend"
else
print_warning "WHOOSH frontend directory not found - skipping"
fi
# BZZZ Coordinator
if [ -d "modules/bzzz" ]; then
build_and_push "bzzz-coordinator" "modules/bzzz"
else
print_warning "BZZZ directory not found - skipping"
fi
# SLURP API
if [ -d "modules/slurp/hcfs-python" ]; then
build_and_push "slurp-api" "modules/slurp/hcfs-python"
else
print_warning "SLURP API directory not found - skipping"
fi
# SLURP RL Tuner
if [ -d "modules/slurp" ] && [ -f "modules/slurp/Dockerfile.rl-tuner" ]; then
build_and_push "slurp-rl-tuner" "modules/slurp" "Dockerfile.rl-tuner"
else
print_warning "SLURP RL Tuner dockerfile not found - skipping"
fi
print_success "All CHORUS Services images built and pushed successfully!"
# List pushed images
print_info "Pushed images:"
echo " - $REGISTRY/tony/chorus-whoosh-backend:$TAG"
echo " - $REGISTRY/tony/chorus-whoosh-frontend:$TAG"
echo " - $REGISTRY/tony/chorus-bzzz-coordinator:$TAG"
echo " - $REGISTRY/tony/chorus-slurp-api:$TAG"
echo " - $REGISTRY/tony/chorus-slurp-rl-tuner:$TAG"
}
# Handle command line arguments
case "${1:-}" in
"login")
docker_login
;;
"whoosh-backend")
docker_login
build_and_push "whoosh-backend" "modules/whoosh/backend"
;;
"whoosh-frontend")
docker_login
build_and_push "whoosh-frontend" "modules/whoosh/frontend"
;;
"bzzz")
docker_login
build_and_push "bzzz-coordinator" "modules/bzzz"
;;
"slurp-api")
docker_login
build_and_push "slurp-api" "modules/slurp/hcfs-python"
;;
"slurp-rl-tuner")
docker_login
build_and_push "slurp-rl-tuner" "modules/slurp" "Dockerfile.rl-tuner"
;;
"help"|"-h"|"--help")
echo "CHORUS Services Build and Push Script"
echo ""
echo "Usage: $0 [COMMAND]"
echo ""
echo "Commands:"
echo " (no args) Build and push all images"
echo " login Login to Docker registry only"
echo " whoosh-backend Build and push WHOOSH backend only"
echo " whoosh-frontend Build and push WHOOSH frontend only"
echo " bzzz Build and push BZZZ coordinator only"
echo " slurp-api Build and push SLURP API only"
echo " slurp-rl-tuner Build and push SLURP RL Tuner only"
echo " help Show this help message"
;;
*)
main
;;
esac