-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·698 lines (592 loc) · 23.3 KB
/
install.sh
File metadata and controls
executable file
·698 lines (592 loc) · 23.3 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
# Create .env file template
# RTGS Lab Tools Installation/Update Script
# Works on Windows (Git Bash/WSL), macOS, and Linux
set -e # Exit on any error
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Function to print colored output
print_status() {
echo -e "${BLUE}[INFO]${NC} $1"
}
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
print_header() {
echo -e "\n${BLUE}================================${NC}"
echo -e "${BLUE} RTGS Lab Tools Installation${NC}"
echo -e "${BLUE}================================${NC}\n"
}
print_update_header() {
echo -e "\n${BLUE}================================${NC}"
echo -e "${BLUE} RTGS Lab Tools Update${NC}"
echo -e "${BLUE}================================${NC}\n"
}
# Check if this is an existing installation
check_existing_installation() {
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
VENV_PATH="$SCRIPT_DIR/venv"
if [[ -d "$VENV_PATH" && -f "$SCRIPT_DIR/pyproject.toml" ]]; then
print_status "Existing installation detected"
return 0
else
return 1
fi
}
# Check for local git changes
check_git_status() {
print_status "Checking for local changes..."
if [[ ! -d ".git" ]]; then
print_error "Not a git repository. Cannot perform update."
exit 1
fi
# Check if there are uncommitted changes (unstaged changes only)
# Use git status --porcelain instead of git diff-index to properly handle all cases
if [[ -n "$(git status --porcelain)" ]]; then
print_error "You have uncommitted local changes."
print_error "Please commit or stash your changes before updating:"
print_error ""
git status --porcelain
print_error ""
print_error "Commands to handle your changes:"
print_error " To commit: git add . && git commit -m 'Your message'"
print_error " To stash: git stash"
exit 1
fi
# Check if there are untracked files that could conflict
UNTRACKED_FILES=$(git ls-files --others --exclude-standard)
if [[ -n "$UNTRACKED_FILES" ]]; then
print_warning "You have untracked files:"
echo "$UNTRACKED_FILES"
print_warning "These files will be preserved during update."
fi
print_success "No conflicting local changes found"
}
# Get latest release tag from GitHub API
get_latest_release_tag() {
# Send status messages to stderr to avoid mixing with return value
print_status "Fetching latest release information..." >&2
# Get the repository info from git remote
REMOTE_URL=$(git remote get-url origin 2>/dev/null || echo "")
if [[ -z "$REMOTE_URL" ]]; then
print_error "Could not determine git remote URL" >&2
return 1
fi
# Extract owner/repo from various URL formats
if [[ "$REMOTE_URL" == *"github.com"* ]]; then
if [[ "$REMOTE_URL" == https://github.com/* ]]; then
REPO_PATH="${REMOTE_URL#https://github.com/}"
REPO_PATH="${REPO_PATH%.git}"
elif [[ "$REMOTE_URL" == git@github.com:* ]]; then
REPO_PATH="${REMOTE_URL#git@github.com:}"
REPO_PATH="${REPO_PATH%.git}"
else
print_error "Unsupported GitHub URL format: $REMOTE_URL" >&2
return 1
fi
# Query GitHub API for latest release
API_URL="https://api.github.com/repos/${REPO_PATH}/releases/latest"
if command -v curl &> /dev/null; then
RELEASE_DATA=$(curl -s "$API_URL" 2>/dev/null)
elif command -v wget &> /dev/null; then
RELEASE_DATA=$(wget -qO- "$API_URL" 2>/dev/null)
else
print_error "Neither curl nor wget found. Cannot fetch release information." >&2
return 1
fi
# Extract tag name (simple JSON parsing)
if [[ -n "$RELEASE_DATA" ]] && echo "$RELEASE_DATA" | grep -q '"tag_name"'; then
LATEST_TAG=$(echo "$RELEASE_DATA" | grep '"tag_name"' | sed 's/.*"tag_name": *"\([^"]*\)".*/\1/')
if [[ -n "$LATEST_TAG" ]]; then
echo "$LATEST_TAG"
return 0
fi
fi
fi
print_warning "Could not fetch latest release information. Falling back to master branch." >&2
echo "master"
return 0
}
# Update from git repository
update_from_git() {
print_status "Updating from git repository..."
# Fetch latest changes and tags
print_status "Fetching latest changes and tags..."
git fetch origin --tags
# Get current branch/tag
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
print_status "Current branch: $CURRENT_BRANCH"
# Get the latest release tag
LATEST_TAG=$(get_latest_release_tag)
if [[ "$LATEST_TAG" == "master" ]]; then
# Fall back to master branch behavior
if [[ "$CURRENT_BRANCH" != "master" ]]; then
print_status "Switching to master branch..."
git checkout master
fi
print_status "Pulling latest changes from master..."
if git pull origin master; then
print_success "Successfully updated to latest version (master branch)"
else
print_error "Failed to pull latest changes"
print_error "Please resolve any merge conflicts and try again"
exit 1
fi
else
# Update to specific release tag
print_status "Latest release: $LATEST_TAG"
# Check if we're already on the latest tag
CURRENT_TAG=$(git describe --tags --exact-match 2>/dev/null || echo "")
if [[ "$CURRENT_TAG" == "$LATEST_TAG" ]]; then
print_success "Already on latest release: $LATEST_TAG"
else
print_status "Updating to release: $LATEST_TAG"
if git checkout "$LATEST_TAG"; then
print_success "Successfully updated to release: $LATEST_TAG"
else
print_error "Failed to checkout release tag: $LATEST_TAG"
print_error "Falling back to master branch..."
git checkout master
git pull origin master
fi
fi
fi
# Show what version we're on
print_status "Current version information:"
get_version_info | while read -r line; do
echo " $line"
done
}
# Get version information
get_version_info() {
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Try to get version from pyproject.toml
if [[ -f "$SCRIPT_DIR/pyproject.toml" ]]; then
VERSION=$(grep '^version = ' "$SCRIPT_DIR/pyproject.toml" | sed 's/version = "\(.*\)"/\1/')
fi
# Try to get git commit info
if [[ -d "$SCRIPT_DIR/.git" ]]; then
GIT_COMMIT=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "unknown")
GIT_DATE=$(git log -1 --format=%cd --date=short 2>/dev/null || echo "unknown")
# Try to get the latest tag/release
GIT_TAG=$(git describe --tags --exact-match 2>/dev/null || git describe --tags --abbrev=0 2>/dev/null || echo "")
# Check if current commit is tagged
if [[ -n "$GIT_TAG" ]]; then
EXACT_TAG=$(git describe --tags --exact-match 2>/dev/null || echo "")
if [[ -n "$EXACT_TAG" ]]; then
TAG_INFO="Release: ${GIT_TAG}"
else
TAG_INFO="Latest Release: ${GIT_TAG}"
fi
fi
fi
# Build version string
if [[ -n "$VERSION" ]]; then
echo "Package: v${VERSION}"
fi
if [[ -n "$TAG_INFO" ]]; then
echo "$TAG_INFO"
fi
if [[ -n "$GIT_COMMIT" && "$GIT_COMMIT" != "unknown" ]]; then
echo "Git: ${GIT_BRANCH}@${GIT_COMMIT} (${GIT_DATE})"
fi
# If no version info found
if [[ -z "$VERSION" && -z "$TAG_INFO" && ("$GIT_COMMIT" == "unknown" || -z "$GIT_COMMIT") ]]; then
echo "Version information unavailable"
fi
}
# Detect operating system
detect_os() {
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
OS="linux"
elif [[ "$OSTYPE" == "darwin"* ]]; then
OS="macos"
elif [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]]; then
OS="windows"
else
OS="unknown"
fi
print_status "Detected OS: $OS"
}
# Check if Python is available
check_python() {
print_status "Checking Python installation..."
if command -v python3 &> /dev/null; then
PYTHON_CMD="python3"
elif command -v python &> /dev/null; then
PYTHON_CMD="python"
else
print_error "Python is not installed or not in PATH"
print_error "Please install Python 3.10+ before running this script"
exit 1
fi
# Check Python version
PYTHON_VERSION=$($PYTHON_CMD --version 2>&1 | awk '{print $2}')
print_success "Found Python $PYTHON_VERSION at $(which $PYTHON_CMD)"
# Verify minimum version (3.10+)
PYTHON_MAJOR=$($PYTHON_CMD -c "import sys; print(sys.version_info.major)")
PYTHON_MINOR=$($PYTHON_CMD -c "import sys; print(sys.version_info.minor)")
if [[ $PYTHON_MAJOR -lt 3 ]] || [[ $PYTHON_MAJOR -eq 3 && $PYTHON_MINOR -lt 10 ]]; then
print_error "Python 3.10 or higher is required. Found Python $PYTHON_VERSION"
exit 1
fi
}
# Check if pip is available
check_pip() {
print_status "Checking pip installation..."
if command -v pip3 &> /dev/null; then
PIP_CMD="pip3"
elif command -v pip &> /dev/null; then
PIP_CMD="pip"
else
print_error "pip is not installed or not in PATH"
print_error "Please install pip before running this script"
exit 1
fi
print_success "Found pip at $(which $PIP_CMD)"
}
# Check if uv is available, install if not
check_uv() {
print_status "Checking uv installation..."
if command -v uv &> /dev/null; then
UV_VERSION=$(uv --version)
print_success "Found uv: $UV_VERSION"
else
print_status "uv not found. Installing uv..."
if [[ "$OS" == "windows" ]]; then
# Windows installation using PowerShell
if command -v powershell &> /dev/null; then
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
# Add to PATH for current session
export PATH="$HOME/.local/bin:$PATH"
else
print_error "PowerShell not found. Cannot install uv automatically on Windows."
print_error "Please install uv manually: https://docs.astral.sh/uv/getting-started/installation/"
exit 1
fi
else
# Linux and macOS installation
if command -v curl &> /dev/null; then
curl -LsSf https://astral.sh/uv/install.sh | sh
# Source the shell profile to get uv in PATH
export PATH="$HOME/.local/bin:$PATH"
elif command -v wget &> /dev/null; then
wget -qO- https://astral.sh/uv/install.sh | sh
export PATH="$HOME/.local/bin:$PATH"
else
print_error "Neither curl nor wget found. Cannot install uv automatically."
print_error "Please install uv manually: https://docs.astral.sh/uv/getting-started/installation/"
exit 1
fi
fi
# Verify installation
if command -v uv &> /dev/null; then
UV_VERSION=$(uv --version)
print_success "uv installed successfully: $UV_VERSION"
else
print_error "Failed to install uv. Please install manually."
print_error "Installation guide: https://docs.astral.sh/uv/getting-started/installation/"
exit 1
fi
fi
}
# Initialize git submodules
init_submodules() {
print_status "Checking git submodules..."
if [[ ! -d ".git" ]]; then
print_warning "Not a git repository. Skipping submodule initialization."
return
fi
# Check if there are any submodules defined
if [[ -f ".gitmodules" ]]; then
print_status "Initializing and updating git submodules..."
git submodule update --init --recursive
print_success "Git submodules updated"
else
print_status "No submodules found in repository"
fi
}
# Create virtual environment using uv
create_venv() {
print_status "Creating virtual environment with uv..."
# Always create venv in the project root directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
VENV_PATH="$SCRIPT_DIR/venv"
if [[ -d "$VENV_PATH" ]]; then
print_warning "Virtual environment already exists. Removing old one..."
rm -rf "$VENV_PATH"
fi
# Use uv to create virtual environment
uv venv "$VENV_PATH"
print_success "Virtual environment created with uv: $VENV_PATH"
}
# Activate virtual environment
activate_venv() {
print_status "Activating virtual environment..."
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [[ "$OS" == "windows" ]]; then
source "$SCRIPT_DIR/venv/Scripts/activate"
else
source "$SCRIPT_DIR/venv/bin/activate"
fi
print_success "Virtual environment activated"
print_status "Python path: $(which python)"
print_status "Pip path: $(which pip)"
}
# Install uv if not already available in venv
ensure_uv_in_venv() {
print_status "Ensuring uv is available in virtual environment..."
# uv should already be available from the system installation
# but we can upgrade it if needed
if ! uv --version &> /dev/null; then
print_error "uv not available in PATH"
exit 1
fi
print_success "uv is ready"
}
# Install package in development mode
install_package() {
print_status "Installing RTGS Lab Tools in development mode with uv..."
# Install in editable mode with all dependencies using uv
# Use quotes for zsh compatibility on macOS
uv pip install -e ".[all]"
print_success "Package installed successfully with uv"
}
# Run setup credentials command
run_setup_credentials() {
print_status "Running setup credentials script..."
if command -v python &> /dev/null && python -c "import rtgs_lab_tools" 2>/dev/null; then
python -m rtgs_lab_tools.cli sensing-data extract --setup-credentials || true
print_success "Setup credentials command executed"
else
print_warning "Could not run setup credentials command. Package may not be properly installed."
fi
}
# Google Earth Engine Authentication
# auth_gee() {
# if command -v python &> /dev/null && python -c "import rtgs_lab_tools" 2>/dev/null; then
# python -c "import ee; ee.Authenticate()"
# print_success "GEE Authentication is completed"
# else
# print_warning "Could not run setup credentials command. Package may not be properly installed."
# fi
# }
# Configure Claude Desktop MCP servers
configure_claude_desktop() {
print_status "Configuring Claude Desktop MCP servers..."
# Get absolute path to repository
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Determine Claude Desktop config path based on OS
case "$OS" in
"macos")
CLAUDE_CONFIG_DIR="$HOME/Library/Application Support/Claude"
CLAUDE_CONFIG_FILE="$CLAUDE_CONFIG_DIR/claude_desktop_config.json"
PYTHON_PATH="$SCRIPT_DIR/venv/bin/python"
PARTICLE_PATH="$SCRIPT_DIR/src/rtgs_lab_tools/mcp_server/particle-mcp-server/"
;;
"windows")
CLAUDE_CONFIG_DIR="$USERPROFILE/AppData/Roaming/Claude"
CLAUDE_CONFIG_FILE="$CLAUDE_CONFIG_DIR/claude_desktop_config.json"
# Convert Unix-style paths to Windows-style paths (e.g., /c/path -> C:/path)
PYTHON_PATH="$(echo "$SCRIPT_DIR/venv/Scripts/python.exe" | sed 's|^/\([a-z]\)/|\U\1:/|')"
PARTICLE_PATH="$(echo "$SCRIPT_DIR/src/rtgs_lab_tools/mcp_server/particle-mcp-server/" | sed 's|^/\([a-z]\)/|\U\1:/|')"
;;
"linux")
CLAUDE_CONFIG_DIR="$HOME/.config/Claude"
CLAUDE_CONFIG_FILE="$CLAUDE_CONFIG_DIR/claude_desktop_config.json"
PYTHON_PATH="$SCRIPT_DIR/venv/bin/python"
PARTICLE_PATH="$SCRIPT_DIR/src/rtgs_lab_tools/mcp_server/particle-mcp-server/"
;;
*)
print_warning "Unknown OS. Skipping Claude Desktop MCP configuration."
return
;;
esac
# Check if Claude Desktop is installed by looking for the config directory
if [[ ! -d "$CLAUDE_CONFIG_DIR" ]]; then
print_warning "Claude Desktop not found (directory doesn't exist: $CLAUDE_CONFIG_DIR)"
print_warning "Skipping Claude Desktop MCP configuration. Install Claude Desktop first if you want MCP integration."
return
fi
# Create or update claude_desktop_config.json
if [[ -f "$CLAUDE_CONFIG_FILE" ]]; then
print_status "Backing up existing Claude Desktop config..."
cp "$CLAUDE_CONFIG_FILE" "${CLAUDE_CONFIG_FILE}.backup.$(date +%Y%m%d_%H%M%S)"
fi
# Generate the configuration
print_status "Writing Claude Desktop MCP configuration..."
# Use forward slashes for all platforms (JSON accepts forward slashes on Windows)
cat > "$CLAUDE_CONFIG_FILE" << EOF
{
"mcpServers": {
"particle": {
"command": "uv",
"args": [
"--directory",
"$PARTICLE_PATH",
"run",
"particle.py"
]
},
"rtgs_lab_tools": {
"command": "uv",
"args": [
"--directory",
"$SCRIPT_DIR",
"run",
"-m",
"rtgs_lab_tools.mcp_server.rtgs_lab_tools_mcp_server"
]
}
}
}
EOF
if [[ $? -eq 0 ]]; then
print_success "Claude Desktop MCP configuration created: $CLAUDE_CONFIG_FILE"
print_status "Restart Claude Desktop to load the new MCP servers"
else
print_error "Failed to create Claude Desktop MCP configuration"
fi
}
# Check if required directories exist
check_directories() {
print_status "Checking project structure..."
REQUIRED_DIRS=("src" "tests")
REQUIRED_FILES=("pyproject.toml" "README.md")
for dir in "${REQUIRED_DIRS[@]}"; do
if [[ ! -d "$dir" ]]; then
print_error "Required directory not found: $dir"
print_error "Please run this script from the project root directory"
exit 1
fi
done
for file in "${REQUIRED_FILES[@]}"; do
if [[ ! -f "$file" ]]; then
print_error "Required file not found: $file"
print_error "Please run this script from the project root directory"
exit 1
fi
done
print_success "Project structure verified"
}
# Update process for existing installations
update_installation() {
print_update_header
# Change to script directory to ensure we're in the project root
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
detect_os
check_directories
check_git_status
update_from_git
init_submodules
check_python
activate_venv
ensure_uv_in_venv
install_package
configure_claude_desktop
show_update_complete
}
# Display update completion message
show_update_complete() {
echo -e "\n${GREEN}================================${NC}"
echo -e "${GREEN} Update Complete!${NC}"
echo -e "${GREEN}================================${NC}\n"
echo -e "${BLUE}Your RTGS Lab Tools installation has been updated to the latest version.${NC}"
echo -e "${BLUE}All dependencies have been reinstalled and MCP servers reconfigured.${NC}\n"
# Show version information
echo -e "${BLUE}Updated Version:${NC}"
get_version_info | while read -r line; do
echo -e " ${BLUE}${line}${NC}"
done
echo ""
echo -e "${YELLOW}Next Steps:${NC}"
echo -e "1. ${BLUE}Restart Claude Desktop if you're using MCP integration${NC}"
echo -e "2. ${BLUE}Test the updated installation:${NC}"
echo -e " ${BLUE}rtgs --help${NC}\n"
}
# Display next steps
show_next_steps() {
echo -e "\n${GREEN}================================${NC}"
echo -e "${GREEN} Installation Complete!${NC}"
echo -e "${GREEN}================================${NC}\n"
# Show version information
echo -e "${BLUE}Installed Version:${NC}"
get_version_info | while read -r line; do
echo -e " ${BLUE}${line}${NC}"
done
echo ""
echo -e "${YELLOW}Next Steps:${NC}"
echo -e "1. ${BLUE}Activate the virtual environment:${NC}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [[ "$OS" == "windows" ]]; then
echo -e " ${BLUE}source $SCRIPT_DIR/venv/Scripts/activate${NC}"
else
echo -e " ${BLUE}source $SCRIPT_DIR/venv/bin/activate${NC}"
fi
echo -e "\n2. ${BLUE}Configure your credentials:${NC}"
echo -e " Edit the .env file with your actual database and API credentials:"
echo -e " ${BLUE}nano .env${NC} (or use your preferred editor)"
echo -e "\n3. ${BLUE}Environment variables to configure in .env:${NC}"
echo -e " ${YELLOW}GEMS Database (required for sensor data):${NC}"
echo -e " • DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASSWORD"
echo -e " ${YELLOW}Logging Database (optional for audit features):${NC}"
echo -e " • LOGGING_DB_HOST, LOGGING_DB_PORT, LOGGING_DB_NAME"
echo -e " • LOGGING_DB_USER, LOGGING_DB_PASSWORD"
echo -e " • LOGGING_INSTANCE_CONNECTION_NAME (GCP Cloud SQL)"
echo -e " • POSTGRES_LOGGING_STATUS (True/False)"
echo -e " ${YELLOW}Google Earth Engine (optional for satellite data):${NC}"
echo -e " • GEE_PROJECT (Google Cloud project name)"
echo -e " • BUCKET_NAME (Google Cloud Storage bucket)"
echo -e " ${YELLOW}PlanetLabs (optional for high-res satellite imagery):${NC}"
echo -e " • PL_API_KEY (PlanetLabs API key)"
echo -e " ${YELLOW}Device Management (optional for IoT devices):${NC}"
echo -e " • PARTICLE_ACCESS_TOKEN"
echo -e "\n4. ${BLUE}Test the installation:${NC}"
echo -e " ${BLUE}rtgs --help${NC}"
echo -e "\n5. ${BLUE}List available projects:${NC}"
echo -e " ${BLUE}rtgs sensing-data list-projects${NC}"
echo -e "\n${BLUE}Documentation:${NC}"
echo -e " • Check the README.md for detailed usage instructions"
echo -e " • See tests/ directory for usage examples"
}
# Main installation process
main() {
# Check if this is an existing installation
if check_existing_installation; then
update_installation
else
print_header
# Change to script directory to ensure we're in the project root
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
detect_os
check_directories
init_submodules
check_python
check_pip
check_uv
create_venv
activate_venv
ensure_uv_in_venv
install_package
run_setup_credentials
#auth_gee
configure_claude_desktop
show_next_steps
fi
}
# Handle script interruption
trap 'print_error "Installation interrupted. You may need to clean up manually."; exit 1' INT TERM
# Run main function
main "$@"