-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·88 lines (76 loc) · 2.61 KB
/
Copy pathrun.sh
File metadata and controls
executable file
·88 lines (76 loc) · 2.61 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
# HRBuddy
# run.sh
set -e # Exit on error
# Detecting the Operating System
if [[ "$OSTYPE" == "darwin"* ]]; then
# Ensure Docker is actually running before trying to connect
if ! docker info > /dev/null 2>&1; then
echo "[INFO] Docker Desktop is not running. Launching it now..."
open -a Docker
echo "Please wait for Docker to start, then re-run this script."
exit 1
fi
# Set the host variable to the standard macOS socket location
export DOCKER_HOST="unix:///var/run/docker.sock"
export HRBUDDY_CONFIG="config/apple_mlx_config.json"
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
OS="linux"
export HRBUDDY_CONFIG="config/default_config.json"
echo "[INFO] Running on Linux"
else
echo "[ERROR] Unsupported OS. Exiting."
exit 1
fi
# Check and install Docker
if ! command -v docker &> /dev/null; then
echo "[INFO] Docker not found. Installing..."
if [ "$OS" == "macos" ]; then
# Check for Homebrew first
if ! command -v brew &> /dev/null; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
brew install --cask docker # Installs Docker Desktop
echo "[ACTION] Please open Docker from your Applications folder to finish setup."
open /Applications/Docker.app
else
curl -fsSL https://get.docker.com -o get-docker.sh && sudo sh get-docker.sh
sudo usermod -aG docker $USER
fi
else
echo "[OK] Docker is already installed."
fi
# Check and Install Ollama
if ! command -v ollama &> /dev/null; then
echo "[INFO] Ollama not found. Installing..."
if [ "$OS" == "macos" ]; then
brew install ollama
else
curl -fsSL https://ollama.com/install.sh | sh
fi
else
echo "[OK] Ollama is already installed."
fi
# Patch Ollama for Docker Networking
if [ "$OS" == "linux" ]; then
CONF_DIR="/etc/systemd/system/ollama.service.d"
if [ ! -d "$CONF_DIR" ]; then
sudo mkdir -p "$CONF_DIR"
echo -e "[Service]\nEnvironment=\"OLLAMA_HOST=0.0.0.0\"" | sudo tee "$CONF_DIR/override.conf" > /dev/null
sudo systemctl daemon-reload && sudo systemctl restart ollama
fi
elif [ "$OS" == "macos" ]; then
export OLLAMA_HOST=0.0.0.0
launchctl setenv OLLAMA_HOST "0.0.0.0"
echo "[OK] macOS Ollama host set to 0.0.0.0"
fi
# Pull AI Models
echo "[INFO] Pulling AI models..."
ollama serve > /dev/null 2>&1 &
sleep 5
ollama pull llama3.2
ollama pull nomic-embed-text
# Launch Docker Compose
echo "[OK] Models ready."
echo "[INFO] Building and Launching HRBuddy Containers..."
docker compose up --build