Skip to content

Commit 9bd418d

Browse files
committed
run_prod
1 parent 8a3286c commit 9bd418d

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed

run_prod.sh

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
#!/bin/bash
2+
set -e
3+
4+
if [ -z "$AWS_ACCOUNT_ID" ]; then
5+
echo "ERROR: AWS_ACCOUNT_ID environment variable is not set"
6+
echo "Please run: export AWS_ACCOUNT_ID=your_aws_account_id"
7+
exit 1
8+
fi
9+
10+
if [ -z "$AWS_ACCESS_KEY_ID" ] || [ -z "$AWS_SECRET_ACCESS_KEY" ]; then
11+
echo "WARNING: AWS_ACCESS_KEY_ID or AWS_SECRET_ACCESS_KEY not set"
12+
echo "Make sure you have configured AWS credentials with 'aws configure' or by setting environment variables"
13+
echo "If you've already configured AWS CLI, this warning can be ignored"
14+
fi
15+
16+
ECR_URL="${AWS_ACCOUNT_ID}.dkr.ecr.us-east-1.amazonaws.com"
17+
BRAINROT_IMAGE="$ECR_URL/brainrot:latest"
18+
RVC_IMAGE="$ECR_URL/rvc:latest"
19+
20+
echo "ECR URL: $ECR_URL"
21+
echo "Brainrot Image: $BRAINROT_IMAGE"
22+
echo "RVC Image: $RVC_IMAGE"
23+
24+
echo "Logging into ECR..."
25+
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin "$ECR_URL"
26+
27+
echo "Stopping any existing containers..."
28+
docker-compose down || true
29+
30+
echo "Creating shared directories..."
31+
mkdir -p shared_data
32+
33+
echo "Setting permissions on shared_data directory..."
34+
chmod -R 777 shared_data
35+
36+
echo "Creating docker-compose.yml file..."
37+
cat > docker-compose.yml << EOL
38+
version: '3.8'
39+
40+
services:
41+
brainrot:
42+
image: ${BRAINROT_IMAGE}
43+
container_name: brainrot-container
44+
ports:
45+
- "3000:3000"
46+
volumes:
47+
- ./shared_data:/app/brainrot/shared_data
48+
environment:
49+
- MODE=production
50+
- RVC_SERVICE_URL=http://rvc:5555
51+
depends_on:
52+
- rvc
53+
54+
rvc:
55+
image: ${RVC_IMAGE}
56+
container_name: rvc-container
57+
ports:
58+
- "5555:5555"
59+
volumes:
60+
- ./shared_data:/app/shared_data
61+
environment:
62+
- MODE=production
63+
- SHARED_DIR=/app/shared_data
64+
EOL
65+
66+
if command -v nvidia-smi &> /dev/null; then
67+
echo "NVIDIA GPU detected, adding GPU configuration to docker-compose.yml"
68+
cat >> docker-compose.yml << EOL
69+
deploy:
70+
resources:
71+
reservations:
72+
devices:
73+
- driver: nvidia
74+
count: all
75+
capabilities: [gpu]
76+
EOL
77+
else
78+
echo "WARNING: NVIDIA GPU not detected. RVC service may not work properly without GPU acceleration."
79+
fi
80+
81+
echo "Pulling latest images from ECR..."
82+
docker pull "$BRAINROT_IMAGE"
83+
docker pull "$RVC_IMAGE"
84+
85+
echo "Starting containers with docker-compose..."
86+
docker-compose up -d
87+
88+
echo "Deployment complete!"
89+
echo "Brainrot service should be available at: http://localhost:3000"
90+
echo "RVC service should be available at: http://localhost:5555"
91+
echo ""
92+
echo "To view logs:"
93+
echo " docker-compose logs -f"
94+
echo ""
95+
echo "To stop the services:"
96+
echo " docker-compose down"

0 commit comments

Comments
 (0)