100 líneas
2.5 KiB
Bash
Archivo Ejecutable
100 líneas
2.5 KiB
Bash
Archivo Ejecutable
#!/bin/bash
|
|
|
|
# Demo script for Buque
|
|
# This script demonstrates the main features of Buque
|
|
|
|
set -e
|
|
|
|
GREEN='\033[0;32m'
|
|
BLUE='\033[0;34m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m'
|
|
|
|
echo -e "${BLUE}=== Buque Demo ===${NC}\n"
|
|
|
|
# Function to show command and pause
|
|
run_demo_command() {
|
|
echo -e "${YELLOW}$ $1${NC}"
|
|
sleep 1
|
|
eval "$1"
|
|
echo ""
|
|
sleep 2
|
|
}
|
|
|
|
# Check if buque is installed
|
|
if ! command -v buque &> /dev/null; then
|
|
echo -e "${RED}Error: buque is not installed${NC}"
|
|
echo "Please install buque first: make install"
|
|
exit 1
|
|
fi
|
|
|
|
echo -e "${GREEN}Step 1: Initialize Buque${NC}"
|
|
run_demo_command "buque init"
|
|
|
|
echo -e "${GREEN}Step 2: Show help${NC}"
|
|
run_demo_command "buque --help"
|
|
|
|
echo -e "${GREEN}Step 3: List environments (initially empty)${NC}"
|
|
run_demo_command "buque env list"
|
|
|
|
# Create demo environment
|
|
DEMO_DIR="/tmp/buque-demo-app"
|
|
echo -e "${GREEN}Step 4: Create a demo environment${NC}"
|
|
mkdir -p "$DEMO_DIR"
|
|
|
|
cat > "$DEMO_DIR/docker-compose.yml" << 'EOF'
|
|
version: '3.8'
|
|
services:
|
|
web:
|
|
image: nginx:alpine
|
|
container_name: demo-nginx
|
|
ports:
|
|
- "8080:80"
|
|
labels:
|
|
- "buque.environment=demo"
|
|
- "buque.managed=true"
|
|
EOF
|
|
|
|
echo -e "Created demo docker-compose.yml in $DEMO_DIR"
|
|
sleep 2
|
|
|
|
echo -e "${GREEN}Step 5: Add the demo environment${NC}"
|
|
run_demo_command "buque env add demo $DEMO_DIR"
|
|
|
|
echo -e "${GREEN}Step 6: List environments again${NC}"
|
|
run_demo_command "buque env list"
|
|
|
|
echo -e "${GREEN}Step 7: Start the demo environment${NC}"
|
|
run_demo_command "buque up demo"
|
|
|
|
echo -e "${GREEN}Step 8: List running containers${NC}"
|
|
run_demo_command "buque ps demo"
|
|
|
|
echo -e "${GREEN}Step 9: Show container statistics${NC}"
|
|
run_demo_command "buque stats demo"
|
|
|
|
echo -e "${GREEN}Step 10: View logs (last 10 lines)${NC}"
|
|
run_demo_command "buque logs demo --tail 10"
|
|
|
|
echo -e "${BLUE}Demo is running! The nginx container should be accessible at http://localhost:8080${NC}"
|
|
echo -e "${YELLOW}Press Enter to continue and clean up...${NC}"
|
|
read
|
|
|
|
echo -e "${GREEN}Step 11: Stop the demo environment${NC}"
|
|
run_demo_command "buque down demo"
|
|
|
|
echo -e "${GREEN}Step 12: Remove the demo environment${NC}"
|
|
run_demo_command "buque env remove demo"
|
|
|
|
# Cleanup
|
|
rm -rf "$DEMO_DIR"
|
|
|
|
echo -e "${BLUE}=== Demo Complete! ===${NC}"
|
|
echo -e "\nYou've seen the main features of Buque:"
|
|
echo " ✓ Environment management"
|
|
echo " ✓ Container operations"
|
|
echo " ✓ Statistics monitoring"
|
|
echo " ✓ Log viewing"
|
|
echo ""
|
|
echo "Try 'buque proxy deploy' to set up nginx-proxy!"
|