-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlocal-debug-setup.sh
More file actions
executable file
·65 lines (56 loc) · 1.67 KB
/
Copy pathlocal-debug-setup.sh
File metadata and controls
executable file
·65 lines (56 loc) · 1.67 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
#!/bin/bash
# BeanRatio Local Debug Setup Script
set -e
echo "=========================================="
echo "BeanRatio Local Debug Setup"
echo "=========================================="
echo ""
# Check if Docker is installed
if ! command -v docker &> /dev/null; then
echo "❌ Docker is not installed. Please install Docker first."
exit 1
fi
# Check if AWS SAM CLI is installed, if not install it
if ! command -v sam &> /dev/null; then
echo "ℹ AWS SAM CLI not found. Installing..."
if command -v uv &> /dev/null; then
uv pip install aws-sam-cli
else
pip install aws-sam-cli
fi
fi
echo "✓ Docker found"
echo "✓ AWS SAM CLI found"
echo ""
# Start LocalStack
echo "[1/3] Starting LocalStack..."
if docker ps --format '{{.Names}}' | grep -q "localstack"; then
echo " ✓ LocalStack already running"
else
docker run -d \
--name localstack \
-p 4566:4566 \
-e SERVICES=s3 \
-e DEBUG=1 \
-v /tmp/localstack:/tmp/localstack \
localstack/localstack:latest
echo " ✓ LocalStack started"
sleep 5
fi
# Create S3 bucket
echo "[2/3] Creating S3 bucket..."
aws s3 mb s3://beanratio-data \
--endpoint-url http://localhost:4566 \
--region ap-northeast-1 2>/dev/null || echo " ℹ Bucket may already exist"
echo " ✓ S3 bucket ready"
echo ""
echo "[3/3] Setup complete!"
echo ""
echo "=========================================="
echo "Start local API server with:"
echo " cd /home/ec2-user/BeanRatio"
echo " sam local start-api --debug --port 3000"
echo ""
echo "Test with:"
echo " curl 'http://localhost:3000/beans?token=test-token-12345'"
echo "=========================================="