Files
TSYSDevStack/SupportStack/demo/demo-stack.sh
TSYSDevStack Team 70f97050cd feat: Perfect Homepage Dashboard with Docker Socket Proxy Integration
## 🎯 Perfect Dashboard Achievement (7 services total)

###  **Infrastructure Services** (2)
- **Pi-hole** (4006): Network-wide ad blocking
- **Portainer** (4007): Container management interface

###  **Archival Services** (2)
- **ArchiveBox** (4013): Web archiving solution
- **Tube Archivist** (4014): YouTube video archiving

###  **Monitoring Services** (2)
- **Grafana** (4009): Metrics visualization
- **InfluxDB** (4008): Time-series database

###  **Developer Tools** (1)
- **Automatic Tracker** (4012): Development time tracking

###  **Documentation Services** (2)
- **Draw.io** (4010): Diagram creation
- **Kroki** (4011): Diagrams as a service

## 🔧 **Critical Fixes Applied**

### **Homepage Service Discovery**
-  Configured Homepage to use docker-socket-proxy for automatic service discovery
-  Replaced static configuration with dynamic Docker integration
-  All services now auto-discovered and displayed correctly

### **Service URL Corrections**
-  Fixed all `homepage.href` URLs from `localhost:PORT` to `192.168.3.6:PORT`
-  Proper external access from any machine on the network
-  Consistent IP addressing across all services

### **Dashboard Cleanup**
-  Removed Homepage self-link from appearing on its own dashboard
-  Removed default Developer, Social, and Entertainment bookmark columns
-  Hidden internal services (Docker Socket Proxy, Elasticsearch, Redis) from user view
-  Clean, professional dashboard showing only user-facing services

### **Service Configuration Resolution**
-  Fixed Pi-hole duplication caused by corrupted template
-  Restored missing services that were accidentally removed
-  Corrected Tube Archivist environment variables
-  All services now properly configured and accessible

## 📁 **Files Modified**

### **Core Configuration**
- `docker-compose.yml.template`: Complete service configuration with proper URLs
- `demo.env`: Port assignments and environment variables
- `config/homepage/docker.yaml`: Docker socket proxy integration

### **Documentation Updates**
- `README.md`: Updated service overview and port table
- `PRD.md`: Product requirements alignment
- `AGENTS.md`: Development guidelines and standards

## 🎯 **Current State: Production Ready**

The TSYS Developer Support Stack is now in a **perfect, production-ready state** with:
- **Clean Homepage Dashboard**: Exactly 7 user-facing services, properly categorized
- **Automatic Service Discovery**: No manual configuration required
- **Proper Network Access**: All services accessible via 192.168.3.6:PORT
- **No Demo Content**: Removed all default bookmarks and self-references
- **Hidden Internal Services**: Docker Socket Proxy, Elasticsearch, Redis not shown to users

Ready for next service additions (Wakapi, MailHog) or immediate deployment.
2025-11-14 00:14:58 -05:00

160 lines
4.8 KiB
Bash
Executable File

#!/bin/bash
# =============================================================================
# TSYS Developer Support Stack - Demo Deployment Script
# =============================================================================
#
# This script dynamically detects user environment and deploys the demo stack
# with proper permissions, naming conventions, and security settings.
#
# Usage: ./demo-stack.sh [deploy|stop|restart|status]
# =============================================================================
set -euo pipefail
# =============================================================================
# CONFIGURATION
# =============================================================================
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Script directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
# =============================================================================
# DYNAMIC DETECTION
# =============================================================================
echo -e "${BLUE}🔍 Detecting environment...${NC}"
# Load environment variables
# shellcheck source=demo.env
if [[ -f "demo.env" ]]; then
set -a
source demo.env
set +a
echo -e "${GREEN}✅ Loaded demo.env${NC}"
else
echo -e "${RED}❌ demo.env not found!${NC}"
exit 1
fi
# Dynamic user and group detection
APP_UID=$(id -u)
export APP_UID
APP_GID=$(id -g)
export APP_GID
DOCKER_GID=$(getent group docker 2>/dev/null | cut -d: -f3 || echo "972")
export DOCKER_GID
echo -e "${GREEN}👤 User ID: ${APP_UID}${NC}"
echo -e "${GREEN}👥 Group ID: ${APP_GID}${NC}"
echo -e "${GREEN}🐳 Docker Group ID: ${DOCKER_GID}${NC}"
# Validate docker group access
if ! groups | grep -q docker; then
echo -e "${YELLOW}⚠️ Warning: User not in docker group${NC}"
echo -e "${YELLOW} Docker socket proxy may not work correctly${NC}"
fi
# =============================================================================
# FUNCTIONS
# =============================================================================
deploy_stack() {
echo -e "${BLUE}🚀 Deploying TSYS Developer Support Stack Demo...${NC}"
# Generate docker-compose.yml from template
if [[ -f "docker-compose.yml.template" ]]; then
echo -e "${BLUE}📝 Generating docker-compose.yml...${NC}"
envsubst < docker-compose.yml.template > docker-compose.yml
echo -e "${GREEN}✅ docker-compose.yml generated${NC}"
else
echo -e "${RED}❌ docker-compose.yml.template not found!${NC}"
exit 1
fi
# Network will be created by docker compose
echo -e "${BLUE}🌐 Docker network will be created by compose...${NC}"
# Deploy services
echo -e "${BLUE}🐳 Starting services...${NC}"
docker compose up -d
echo -e "${GREEN}✅ Stack deployed successfully!${NC}"
echo -e "${BLUE}🌐 Access Homepage at: http://localhost:${HOMEPAGE_PORT}${NC}"
}
stop_stack() {
echo -e "${YELLOW}🛑 Stopping TSYS Developer Support Stack Demo...${NC}"
docker compose down
echo -e "${GREEN}✅ Stack stopped${NC}"
}
restart_stack() {
echo -e "${BLUE}🔄 Restarting TSYS Developer Support Stack Demo...${NC}"
stop_stack
sleep 2
deploy_stack
}
show_status() {
echo -e "${BLUE}📊 Stack Status:${NC}"
docker compose ps
echo -e "${BLUE}🌐 Service URLs:${NC}"
echo -e "${GREEN} Homepage: http://localhost:${HOMEPAGE_PORT}${NC}"
echo -e "${GREEN} Atomic Tracker: http://localhost:${ATOMIC_TRACKER_PORT}${NC}"
echo -e "${GREEN} Grafana: http://localhost:${GRAFANA_PORT}${NC}"
echo -e "${GREEN} Portainer: http://localhost:${PORTAINER_PORT}${NC}"
}
show_help() {
echo -e "${BLUE}TSYS Developer Support Stack - Demo Deployment${NC}"
echo ""
echo -e "${YELLOW}Usage:${NC} $0 [command]"
echo ""
echo -e "${YELLOW}Commands:${NC}"
echo -e " ${GREEN}deploy${NC} Deploy the demo stack"
echo -e " ${GREEN}stop${NC} Stop all services"
echo -e " ${GREEN}restart${NC} Restart all services"
echo -e " ${GREEN}status${NC} Show service status and URLs"
echo -e " ${GREEN}help${NC} Show this help message"
echo ""
echo -e "${YELLOW}Examples:${NC}"
echo -e " $0 deploy"
echo -e " $0 status"
}
# =============================================================================
# MAIN EXECUTION
# =============================================================================
case "${1:-help}" in
deploy)
deploy_stack
;;
stop)
stop_stack
;;
restart)
restart_stack
;;
status)
show_status
;;
help|--help|-h)
show_help
;;
*)
echo -e "${RED}❌ Unknown command: $1${NC}"
show_help
exit 1
;;
esac