Changes: - CLAUDE.md: Update OOM fix validation status - Add comprehensive documentation (30+ markdown reports) - LSTM encoder varmap bug fix (tft/lstm_encoder.rs:290) - Quantized LSTM layer matching fix (tft/quantized_lstm.rs) - Hyperopt paths module (ml/src/hyperopt/paths.rs) - Training path tests for all adapters (DQN, MAMBA-2, PPO, TFT) - Checkpoint integrity tests - Script cleanup: Remove 29 obsolete deployment scripts - Archive old scripts to scripts/archive/ - New deployment utilities: check_gpu_availability.py, monitor_hyperopt.sh Validation: - OOM fixes validated: 5/5 trials successful (pod b6kc3mc5lbjiro) - Batch-size-max 256 tested successfully - All hyperopt adapters working correctly 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
174 lines
5.4 KiB
Bash
Executable File
174 lines
5.4 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
# =============================================================================
|
|
# RUNPOD .ENV UPLOAD SCRIPT
|
|
# =============================================================================
|
|
# Uploads .env file to Runpod Network Volume via S3 API
|
|
#
|
|
# USAGE:
|
|
# ./scripts/upload_env_to_runpod.sh
|
|
#
|
|
# PREREQUISITES:
|
|
# - AWS CLI installed (for S3 API access)
|
|
# - ~/.aws/credentials configured with [runpod] profile
|
|
# - RUNPOD_S3_ENDPOINT environment variable set
|
|
# - .env file exists in current directory
|
|
#
|
|
# SECURITY:
|
|
# - .env file MUST be gitignored (verify with: git status)
|
|
# - File permissions set to 600 (owner read/write only) in pod
|
|
# - Never commit .env to git repository
|
|
# =============================================================================
|
|
|
|
echo "=========================================="
|
|
echo "Runpod .env Upload Script"
|
|
echo "=========================================="
|
|
|
|
# Check prerequisites
|
|
echo ""
|
|
echo "Checking prerequisites..."
|
|
|
|
# Check AWS CLI installed
|
|
if ! command -v aws &> /dev/null; then
|
|
echo "ERROR: AWS CLI not found"
|
|
echo "Install: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html"
|
|
exit 1
|
|
fi
|
|
echo "✓ AWS CLI installed"
|
|
|
|
# Check .env file exists
|
|
if [ ! -f .env ]; then
|
|
echo "ERROR: .env file not found in current directory"
|
|
echo "Create .env file with required credentials (see RUNPOD_VOLUME_DEPLOYMENT_GUIDE.md)"
|
|
exit 1
|
|
fi
|
|
echo "✓ .env file exists"
|
|
|
|
# Check .env is gitignored
|
|
if git check-ignore .env &> /dev/null; then
|
|
echo "✓ .env file is gitignored"
|
|
else
|
|
echo "WARNING: .env file is NOT gitignored"
|
|
echo "Add .env to .gitignore to prevent accidental commits"
|
|
read -p "Continue anyway? (y/N) " -n 1 -r
|
|
echo
|
|
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
# Check RUNPOD_S3_ENDPOINT is set
|
|
if [ -z "$RUNPOD_S3_ENDPOINT" ]; then
|
|
echo "ERROR: RUNPOD_S3_ENDPOINT environment variable not set"
|
|
echo ""
|
|
echo "Get your S3 endpoint from Runpod console:"
|
|
echo " 1. Go to https://www.runpod.io/console/pods"
|
|
echo " 2. Click 'Storage' → Select your volume"
|
|
echo " 3. Click 'Access Credentials'"
|
|
echo " 4. Copy 'S3 Endpoint URL'"
|
|
echo ""
|
|
read -p "Enter RUNPOD_S3_ENDPOINT: " RUNPOD_S3_ENDPOINT
|
|
if [ -z "$RUNPOD_S3_ENDPOINT" ]; then
|
|
echo "ERROR: No endpoint provided"
|
|
exit 1
|
|
fi
|
|
fi
|
|
echo "✓ RUNPOD_S3_ENDPOINT set: $RUNPOD_S3_ENDPOINT"
|
|
|
|
# Check AWS profile configured
|
|
if ! aws configure list --profile runpod &> /dev/null; then
|
|
echo "ERROR: AWS profile 'runpod' not configured"
|
|
echo ""
|
|
echo "Configure AWS CLI profile:"
|
|
echo " aws configure --profile runpod"
|
|
echo ""
|
|
echo "Enter Runpod S3 credentials:"
|
|
echo " - AWS Access Key ID: (from Runpod console)"
|
|
echo " - AWS Secret Access Key: (from Runpod console)"
|
|
echo " - Default region: us-east-1"
|
|
echo " - Default output format: json"
|
|
exit 1
|
|
fi
|
|
echo "✓ AWS profile 'runpod' configured"
|
|
|
|
# Display .env file info (without printing contents)
|
|
echo ""
|
|
echo "=========================================="
|
|
echo ".env File Information"
|
|
echo "=========================================="
|
|
ENV_SIZE=$(stat -c%s .env 2>/dev/null || stat -f%z .env)
|
|
ENV_LINES=$(wc -l < .env)
|
|
echo "Size: $(numfmt --to=iec-i --suffix=B ${ENV_SIZE} 2>/dev/null || echo ${ENV_SIZE} bytes)"
|
|
echo "Lines: ${ENV_LINES}"
|
|
echo ""
|
|
echo "Sample variables (values hidden):"
|
|
grep -E "^[A-Z_]+" .env | sed 's/=.*/=***REDACTED***/' | head -5
|
|
|
|
# Confirm upload
|
|
echo ""
|
|
read -p "Upload .env to Runpod Network Volume? (y/N) " -n 1 -r
|
|
echo
|
|
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
|
echo "Upload cancelled"
|
|
exit 0
|
|
fi
|
|
|
|
# Upload .env file to Runpod Network Volume
|
|
echo ""
|
|
echo "=========================================="
|
|
echo "Uploading .env to Runpod Network Volume"
|
|
echo "=========================================="
|
|
|
|
VOLUME_NAME="foxhunt-ml-volume"
|
|
|
|
echo "Uploading to s3://${VOLUME_NAME}/.env ..."
|
|
aws s3 cp .env "s3://${VOLUME_NAME}/.env" \
|
|
--endpoint-url "$RUNPOD_S3_ENDPOINT" \
|
|
--profile runpod
|
|
|
|
if [ $? -ne 0 ]; then
|
|
echo ""
|
|
echo "ERROR: Upload failed"
|
|
echo ""
|
|
echo "Troubleshooting:"
|
|
echo " 1. Verify RUNPOD_S3_ENDPOINT is correct"
|
|
echo " 2. Verify AWS credentials in ~/.aws/credentials [runpod] profile"
|
|
echo " 3. Verify volume exists in Runpod console"
|
|
echo " 4. Check network connectivity"
|
|
exit 1
|
|
fi
|
|
|
|
echo "✓ Upload successful"
|
|
|
|
# Verify upload
|
|
echo ""
|
|
echo "Verifying upload..."
|
|
aws s3 ls "s3://${VOLUME_NAME}/" --endpoint-url "$RUNPOD_S3_ENDPOINT" --profile runpod | grep .env
|
|
|
|
if [ $? -ne 0 ]; then
|
|
echo ""
|
|
echo "WARNING: Could not verify .env file in volume"
|
|
echo "File may have uploaded but verification failed"
|
|
else
|
|
echo "✓ .env file verified in volume"
|
|
fi
|
|
|
|
echo ""
|
|
echo "=========================================="
|
|
echo "Upload Complete"
|
|
echo "=========================================="
|
|
echo ""
|
|
echo "Next steps:"
|
|
echo " 1. Deploy pod with volume mount (see RUNPOD_VOLUME_DEPLOYMENT_GUIDE.md)"
|
|
echo " 2. SSH into pod and verify .env loaded:"
|
|
echo " ls -lh /runpod-volume/.env"
|
|
echo " env | grep -E 'DATABASE_URL|REDIS_URL|VAULT_ADDR' | sed 's/=.*/=***REDACTED***/'"
|
|
echo " 3. Check pod logs for '✓ Loaded credentials from /runpod-volume/.env'"
|
|
echo ""
|
|
echo "Security reminder:"
|
|
echo " - Never commit .env to git repository"
|
|
echo " - Rotate credentials monthly"
|
|
echo " - Use separate .env files per environment (dev/staging/prod)"
|
|
echo ""
|