|
| 1 | +#!/bin/bash |
| 2 | +set -e |
| 3 | + |
| 4 | +# Colors for output |
| 5 | +RED='\033[0;31m' |
| 6 | +GREEN='\033[0;32m' |
| 7 | +YELLOW='\033[1;33m' |
| 8 | +NC='\033[0m' # No Color |
| 9 | + |
| 10 | +# Configuration |
| 11 | +GITHUB_REPO="BetterStackHQ/opentelemetry-demo" |
| 12 | +BRANCH="main" |
| 13 | +PROJECT_NAME="opentelemetry-demo-deinstrumented" |
| 14 | +COMPOSE_FILE_URL="https://raw.githubusercontent.com/${GITHUB_REPO}/${BRANCH}/docker-compose.yml" |
| 15 | +ENV_FILE_URL="https://raw.githubusercontent.com/${GITHUB_REPO}/${BRANCH}/.env" |
| 16 | +WORK_DIR="/tmp/${PROJECT_NAME}" |
| 17 | + |
| 18 | +echo -e "${GREEN}OpenTelemetry Demo Installer${NC}" |
| 19 | +echo "===============================" |
| 20 | +echo "" |
| 21 | + |
| 22 | +# Check for Docker |
| 23 | +if ! command -v docker &> /dev/null; then |
| 24 | + echo -e "${RED}Error: Docker is not installed${NC}" |
| 25 | + echo "Please install Docker first: https://docs.docker.com/get-docker/" |
| 26 | + exit 1 |
| 27 | +fi |
| 28 | + |
| 29 | +# Determine Docker Compose command |
| 30 | +DOCKER_COMPOSE="" |
| 31 | +if docker compose version &> /dev/null; then |
| 32 | + DOCKER_COMPOSE="docker compose" |
| 33 | + echo -e "${GREEN}✓${NC} Found Docker Compose (plugin)" |
| 34 | +elif command -v docker-compose &> /dev/null; then |
| 35 | + DOCKER_COMPOSE="docker-compose" |
| 36 | + echo -e "${GREEN}✓${NC} Found docker-compose (standalone)" |
| 37 | +else |
| 38 | + echo -e "${RED}Error: Docker Compose is not installed${NC}" |
| 39 | + echo "Please install Docker Compose: https://docs.docker.com/compose/install/" |
| 40 | + exit 1 |
| 41 | +fi |
| 42 | + |
| 43 | +# Create working directory |
| 44 | +echo -e "${YELLOW}→${NC} Creating working directory: ${WORK_DIR}" |
| 45 | +mkdir -p "${WORK_DIR}" |
| 46 | +cd "${WORK_DIR}" |
| 47 | + |
| 48 | +# Download docker-compose.yml |
| 49 | +echo -e "${YELLOW}→${NC} Downloading docker-compose.yml..." |
| 50 | +if ! curl -fsSL "${COMPOSE_FILE_URL}" -o docker-compose.yml; then |
| 51 | + echo -e "${RED}Error: Failed to download docker-compose.yml${NC}" |
| 52 | + exit 1 |
| 53 | +fi |
| 54 | +echo -e "${GREEN}✓${NC} Downloaded docker-compose.yml" |
| 55 | + |
| 56 | +# Download .env file |
| 57 | +echo -e "${YELLOW}→${NC} Downloading .env file..." |
| 58 | +if ! curl -fsSL "${ENV_FILE_URL}" -o .env; then |
| 59 | + echo -e "${RED}Error: Failed to download .env file${NC}" |
| 60 | + exit 1 |
| 61 | +fi |
| 62 | +echo -e "${GREEN}✓${NC} Downloaded .env file" |
| 63 | + |
| 64 | +# Pull images |
| 65 | +echo "" |
| 66 | +echo -e "${YELLOW}→${NC} Pulling Docker images (this may take a few minutes)..." |
| 67 | +${DOCKER_COMPOSE} -p "${PROJECT_NAME}" pull |
| 68 | + |
| 69 | +# Start containers |
| 70 | +echo "" |
| 71 | +echo -e "${YELLOW}→${NC} Starting containers..." |
| 72 | +${DOCKER_COMPOSE} -p "${PROJECT_NAME}" up -d |
| 73 | + |
| 74 | +# Check if containers are running |
| 75 | +echo "" |
| 76 | +echo -e "${GREEN}✓${NC} OpenTelemetry Demo is starting!" |
| 77 | +echo "" |
| 78 | +echo "Services are being launched. You can check the status with:" |
| 79 | +echo " ${DOCKER_COMPOSE} -p ${PROJECT_NAME} ps" |
| 80 | +echo "" |
| 81 | +echo "To view logs:" |
| 82 | +echo " ${DOCKER_COMPOSE} -p ${PROJECT_NAME} logs -f" |
| 83 | +echo "" |
| 84 | +echo "To stop the demo:" |
| 85 | +echo " ${DOCKER_COMPOSE} -p ${PROJECT_NAME} down" |
| 86 | +echo "" |
| 87 | +echo "The demo will be available at:" |
| 88 | +echo " → Frontend: http://localhost:8080" |
| 89 | +echo " → Load Generator UI: http://localhost:8089" |
| 90 | +echo " → Feature Flags UI: http://localhost:4000" |
0 commit comments