-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
executable file
·58 lines (50 loc) · 1.86 KB
/
docker-entrypoint.sh
File metadata and controls
executable file
·58 lines (50 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
set -e
# Skyhigh Traffic Forge Docker Entrypoint
CONFIG_DIR="${SKYHIGH_CONFIG_DIR:-/etc/skyhigh-traffic-forge}"
OUTPUT_DIR="${SKYHIGH_OUTPUT_DIR:-/var/log/skyhigh-traffic-forge}"
# Ensure output directory exists (for volume mounts)
mkdir -p "$OUTPUT_DIR"
# Get version from VERSION file or Python package
if [ -f /app/VERSION ]; then
VERSION=$(cat /app/VERSION)
else
VERSION=$(skyhigh-traffic-forge --version 2>/dev/null | cut -d' ' -f2 || echo "unknown")
fi
# Check if this is the first run (no config exists)
if [ ! -f "$CONFIG_DIR/enterprise.yaml" ]; then
echo "=========================================="
echo "Skyhigh Traffic Forge v${VERSION}"
echo "First Run Setup"
echo "=========================================="
echo ""
echo "No configuration found in $CONFIG_DIR"
echo ""
# If the first argument is "init", just run it
if [ "$1" = "init" ]; then
exec skyhigh-traffic-forge "$@"
fi
# Otherwise, show help
echo "To initialize configuration, run:"
echo " docker run -v /path/to/config:$CONFIG_DIR skyhigh-traffic-forge init"
echo ""
echo "Or to use the default configuration:"
echo " docker run -v /path/to/config:$CONFIG_DIR skyhigh-traffic-forge init --force"
echo ""
echo "After initialization, edit $CONFIG_DIR/enterprise.yaml"
echo "to match your organization's settings."
echo ""
echo "Then run the traffic generator:"
echo " docker run -v /path/to/config:$CONFIG_DIR \\"
echo " -v /path/to/logs:$OUTPUT_DIR \\"
echo " skyhigh-traffic-forge generate --mode realtime"
echo ""
exit 1
fi
# If config exists, run the command with proper directories
# Add output-dir if not already specified
if [[ ! " $@ " =~ " --output-dir " ]]; then
exec skyhigh-traffic-forge "$@" --output-dir "$OUTPUT_DIR"
else
exec skyhigh-traffic-forge "$@"
fi