Mirror of https://github.com/roostorg/osprey
github.com/roostorg/osprey
1#!/bin/bash
2set -e
3
4# Helper script to start Osprey with different configurations
5# Usage:
6# ./start.sh # Start with worker directly consuming from Kafka
7# ./start.sh --with-coordinator # Start with Osprey Coordinator
8# ./start.sh --help # Show this help
9
10show_help() {
11 echo "Osprey Startup Helper"
12 echo ""
13 echo "Usage: ./start.sh [OPTIONS] [COMPOSE_ARGS...]"
14 echo ""
15 echo "Options:"
16 echo " --with-coordinator Start Osprey with Coordinator (workers connect to coordinator)"
17 echo " --help, -h Show this help message"
18 echo ""
19 echo "Examples:"
20 echo " ./start.sh # Direct Kafka consumption"
21 echo " ./start.sh --with-coordinator # With coordinator"
22 echo " ./start.sh --with-coordinator up -d # With coordinator in detached mode"
23 echo " ./start.sh --with-coordinator --profile test_data up # With test data producer"
24 echo ""
25 echo "When using --with-coordinator, the following services are added:"
26 echo " - osprey-coordinator: Action distribution and load balancing"
27 echo " - etcd: Service discovery for coordinator"
28 echo ""
29}
30
31USE_COORDINATOR=false
32COMPOSE_FILES="-f docker-compose.yaml"
33COMPOSE_ARGS=()
34
35# Parse arguments
36while [[ $# -gt 0 ]]; do
37 case $1 in
38 --with-coordinator)
39 USE_COORDINATOR=true
40 shift
41 ;;
42 --help|-h)
43 show_help
44 exit 0
45 ;;
46 *)
47 # Pass remaining args to docker compose
48 COMPOSE_ARGS+=("$1")
49 shift
50 ;;
51 esac
52done
53
54if [ "$USE_COORDINATOR" = true ]; then
55 echo "Starting Osprey with Coordinator..."
56 COMPOSE_FILES="$COMPOSE_FILES -f example_docker_compose/run_osprey_with_coordinator/docker-compose.coordinator.yaml"
57else
58 echo "Starting Osprey without Coordinator (direct Kafka consumption)..."
59fi
60
61# If no compose args provided, default to 'up'
62if [ ${#COMPOSE_ARGS[@]} -eq 0 ]; then
63 COMPOSE_ARGS=("up")
64fi
65
66echo "Running: docker compose $COMPOSE_FILES ${COMPOSE_ARGS[@]}"
67echo ""
68
69exec docker compose $COMPOSE_FILES "${COMPOSE_ARGS[@]}"