File tree Expand file tree Collapse file tree 1 file changed +97
-0
lines changed
Expand file tree Collapse file tree 1 file changed +97
-0
lines changed Original file line number Diff line number Diff line change 1+ # Quick start
2+
3+ ## Prerequisites
4+
5+ ``` bash
6+ # Create SSH key
7+ aws ec2 create-key-pair --key-name postgres-ai-key \
8+ --query ' KeyMaterial' --output text > ~ /.ssh/postgres-ai-key.pem
9+ chmod 400 ~ /.ssh/postgres-ai-key.pem
10+
11+ # Configure AWS credentials
12+ aws configure
13+ ```
14+
15+ ## Deploy
16+
17+ ``` bash
18+ cd terraform/aws
19+
20+ # Configure
21+ cp terraform.tfvars.example terraform.tfvars
22+ vim terraform.tfvars # Set ssh_key_name and grafana_password
23+
24+ # Validate
25+ ./validate.sh
26+
27+ # Deploy
28+ terraform init
29+ terraform plan
30+ terraform apply
31+
32+ # Get access info
33+ terraform output grafana_url
34+ terraform output ssh_command
35+ ```
36+
37+ ## Access
38+
39+ ``` bash
40+ # Grafana dashboard
41+ open $( terraform output -raw grafana_url)
42+ # Login: monitor / <your grafana_password>
43+
44+ # SSH
45+ ssh -i ~ /.ssh/postgres-ai-key.pem ubuntu@$( terraform output -raw public_ip)
46+ ```
47+
48+ ## Add monitoring instances
49+
50+ Edit ` terraform.tfvars ` :
51+
52+ ``` hcl
53+ monitoring_instances = [
54+ {
55+ name = "prod-db"
56+ conn_str = "postgresql://monitor:pass@db.example.com:5432/postgres"
57+ environment = "production"
58+ cluster = "main"
59+ node_name = "primary"
60+ }
61+ ]
62+ ```
63+
64+ Apply changes:
65+ ``` bash
66+ terraform apply
67+ ```
68+
69+ ## Operations
70+
71+ ``` bash
72+ # View logs
73+ ssh ubuntu@IP " sudo cat /var/log/user-data.log"
74+
75+ # Restart services
76+ ssh ubuntu@IP " sudo systemctl restart postgres-ai"
77+
78+ # Create backup
79+ aws ec2 create-snapshot --volume-id $( terraform output -raw data_volume_id)
80+
81+ # Destroy
82+ terraform destroy
83+ ```
84+
85+ ## Troubleshooting
86+
87+ ``` bash
88+ # Check installation log
89+ ssh ubuntu@IP " sudo cat /var/log/user-data.log"
90+
91+ # Check service status
92+ ssh ubuntu@IP " sudo systemctl status postgres-ai"
93+
94+ # Check containers
95+ ssh ubuntu@IP " sudo docker ps"
96+ ```
97+
You can’t perform that action at this time.
0 commit comments