-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·57 lines (47 loc) · 1.46 KB
/
deploy.sh
File metadata and controls
executable file
·57 lines (47 loc) · 1.46 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
#!/bin/bash
set -e
echo "🚀 Deploying Content Machine Bot..."
# Check prerequisites
if ! command -v terraform &> /dev/null; then
echo "❌ Terraform not found. Please install Terraform first."
exit 1
fi
if ! command -v aws &> /dev/null; then
echo "❌ AWS CLI not found. Please install AWS CLI first."
exit 1
fi
if [ ! -f "terraform.tfvars" ]; then
echo "❌ terraform.tfvars not found. Please create it from terraform.tfvars.example"
exit 1
fi
# Install Node.js dependencies
echo "📦 Installing Node.js dependencies..."
npm install
# Copy package.json to src and install dependencies there for zipping
echo "📦 Preparing Lambda dependencies in src/..."
cp package.json src/
cd src
npm install --production
cd ..
# Initialize Terraform
echo "🔧 Initializing Terraform..."
terraform init
# Plan
echo "📋 Planning infrastructure changes..."
terraform plan -out=tfplan
# Apply
echo "🏗️ Deploying infrastructure..."
terraform apply -auto-approve tfplan
# Get outputs
echo ""
echo "✅ Deployment complete!"
echo ""
WEBHOOK_URL=$(terraform output -raw webhook_url)
echo "📡 Webhook URL: ${WEBHOOK_URL}"
echo ""
echo "📊 Monitoring:"
echo " - Step Functions: https://console.aws.amazon.com/states/home"
echo " - Lambda Logs: https://console.aws.amazon.com/cloudwatch/home#logsV2:log-groups"
echo " - DynamoDB: https://console.aws.amazon.com/dynamodbv2/home#tables"
echo ""
echo "🤖 Your bot is ready! Send it a message on Telegram to test."