agent-nuvira 1.88.1 → 1.88.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/backup-strategy/SKILL.md +129 -8
- package/.agents/skills/cdn-setup/SKILL.md +174 -8
- package/.agents/skills/cloud-deploy/SKILL.md +165 -8
- package/.agents/skills/cron-job/SKILL.md +144 -9
- package/.agents/skills/data-processing/SKILL.md +203 -9
- package/.agents/skills/dns-setup/SKILL.md +150 -8
- package/.agents/skills/github-actions/SKILL.md +186 -8
- package/.agents/skills/kafka-queue/SKILL.md +185 -7
- package/.agents/skills/kubernetes/SKILL.md +222 -7
- package/.agents/skills/load-balancer/SKILL.md +156 -9
- package/.agents/skills/log-rotation/SKILL.md +157 -9
- package/.agents/skills/ml-model/SKILL.md +206 -8
- package/.agents/skills/nginx-config/SKILL.md +204 -7
- package/.agents/skills/prometheus/SKILL.md +207 -7
- package/.agents/skills/redis-cache/SKILL.md +143 -7
- package/.agents/skills/secrets-manager/SKILL.md +157 -9
- package/.agents/skills/ssl-cert/SKILL.md +109 -9
- package/.agents/skills/structured-logging/SKILL.md +152 -7
- package/.agents/skills/terraform/SKILL.md +164 -7
- package/.agents/skills/web-scraping/SKILL.md +195 -9
- package/package.json +1 -1
|
@@ -1,27 +1,148 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: backup-strategy
|
|
3
3
|
description: Design and implement backup strategies. Use when the goal asks to set up backups, disaster recovery, or data protection.
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
|
+
whenToUse: Backup automation, disaster recovery, data retention, compliance, cross-region replication
|
|
6
|
+
whenNotToUse: Real-time replication (use database replication), caching (use redis-cache), log aggregation
|
|
5
7
|
---
|
|
6
8
|
|
|
7
|
-
#
|
|
9
|
+
# Backup Strategy
|
|
8
10
|
|
|
9
|
-
Design and implement backup strategies
|
|
11
|
+
Design and implement backup strategies with enterprise patterns.
|
|
10
12
|
|
|
11
13
|
## Goal pattern
|
|
12
14
|
|
|
13
|
-
backup disaster recovery retention snapshot restore data protection
|
|
15
|
+
backup disaster recovery retention snapshot restore data protection RPO RTO
|
|
14
16
|
|
|
15
17
|
## Parameters
|
|
16
18
|
|
|
17
19
|
- strategy (choice [default: incremental]): Backup strategy
|
|
20
|
+
- storage (choice [default: s3]): Backup storage location
|
|
21
|
+
- encryption (boolean [default: true]): Encrypt backups
|
|
18
22
|
|
|
19
23
|
## Steps
|
|
20
24
|
|
|
21
|
-
1
|
|
25
|
+
### Step 1: [context-gatherer] — Analyze backup requirements
|
|
22
26
|
|
|
23
|
-
|
|
27
|
+
```bash
|
|
28
|
+
# Check data to backup
|
|
29
|
+
du -sh /var/lib/postgresql/ 2>/dev/null
|
|
30
|
+
du -sh /var/lib/mysql/ 2>/dev/null
|
|
31
|
+
du -sh /app/data/ 2>/dev/null
|
|
24
32
|
|
|
25
|
-
|
|
33
|
+
# Check existing backups
|
|
34
|
+
ls -la /var/backups/ 2>/dev/null
|
|
35
|
+
aws s3 ls s3://my-backups/ 2>/dev/null
|
|
26
36
|
|
|
27
|
-
|
|
37
|
+
# Check disk space
|
|
38
|
+
df -h /var/backups
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
- What data? (database, files, configurations)
|
|
42
|
+
- What RPO? (Recovery Point Objective - max data loss)
|
|
43
|
+
- What RTO? (Recovery Time Objective - max downtime)
|
|
44
|
+
- What retention? (7 days, 30 days, 1 year)
|
|
45
|
+
- What compliance? (GDPR, HIPAA, SOC2)
|
|
46
|
+
|
|
47
|
+
### Step 2: [writer] — Implement backup solution
|
|
48
|
+
|
|
49
|
+
**Database backup script:**
|
|
50
|
+
```bash
|
|
51
|
+
#!/bin/bash
|
|
52
|
+
# /usr/local/bin/backup-db.sh
|
|
53
|
+
set -euo pipefail
|
|
54
|
+
|
|
55
|
+
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
|
|
56
|
+
BACKUP_DIR="/var/backups/db"
|
|
57
|
+
S3_BUCKET="s3://my-backups/database"
|
|
58
|
+
RETENTION_DAYS=30
|
|
59
|
+
|
|
60
|
+
# Create backup
|
|
61
|
+
pg_dump mydb | gzip > "$BACKUP_DIR/mydb_$TIMESTAMP.sql.gz"
|
|
62
|
+
|
|
63
|
+
# Encrypt backup
|
|
64
|
+
gpg --encrypt --recipient admin@example.com "$BACKUP_DIR/mydb_$TIMESTAMP.sql.gz"
|
|
65
|
+
rm "$BACKUP_DIR/mydb_$TIMESTAMP.sql.gz"
|
|
66
|
+
|
|
67
|
+
# Upload to S3
|
|
68
|
+
aws s3 cp "$BACKUP_DIR/mydb_$TIMESTAMP.sql.gz.gpg" "$S3_BUCKET/"
|
|
69
|
+
|
|
70
|
+
# Cleanup old backups
|
|
71
|
+
find "$BACKUP_DIR" -name "*.gz.gpg" -mtime +$RETENTION_DAYS -delete
|
|
72
|
+
|
|
73
|
+
# Log
|
|
74
|
+
echo "Backup completed: mydb_$TIMESTAMP.sql.gz.gpg" >> /var/log/backup.log
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**File backup with restic:**
|
|
78
|
+
```bash
|
|
79
|
+
# Initialize restic repository
|
|
80
|
+
restic -r s3:s3.amazonaws.com/my-backups init
|
|
81
|
+
|
|
82
|
+
# Backup files
|
|
83
|
+
restic -r s3:s3.amazonaws.com/my-backups backup /app/data \
|
|
84
|
+
--verbose \
|
|
85
|
+
--exclude="*.tmp" \
|
|
86
|
+
--exclude="node_modules"
|
|
87
|
+
|
|
88
|
+
# List snapshots
|
|
89
|
+
restic -r s3:s3.amazonaws.com/my-backups snapshots
|
|
90
|
+
|
|
91
|
+
# Restore from backup
|
|
92
|
+
restic -r s3:s3.amazonaws.com/my-backups restore latest --target /restore
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Automated backup cron:**
|
|
96
|
+
```bash
|
|
97
|
+
# /etc/cron.d/backup
|
|
98
|
+
0 2 * * * root /usr/local/bin/backup-db.sh >> /var/log/backup.log 2>&1
|
|
99
|
+
0 3 * * * root /usr/local/bin/backup-files.sh >> /var/log/backup.log 2>&1
|
|
100
|
+
0 4 * * 0 root /usr/local/bin/backup-verify.sh >> /var/log/backup.log 2>&1
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Step 3: [runner] — Deploy and test
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# Run backup manually
|
|
107
|
+
/usr/local/bin/backup-db.sh
|
|
108
|
+
|
|
109
|
+
# Verify backup exists
|
|
110
|
+
ls -la /var/backups/db/
|
|
111
|
+
|
|
112
|
+
# Test restore
|
|
113
|
+
gunzip -k /var/backups/db/mydb_20240101_020000.sql.gz
|
|
114
|
+
psql mydb < /var/backups/db/mydb_20240101_020000.sql
|
|
115
|
+
|
|
116
|
+
# Verify S3 upload
|
|
117
|
+
aws s3 ls s3://my-backups/database/ | tail -5
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Step 4: [reviewer] — Verify backup strategy
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Check backup logs
|
|
124
|
+
tail -100 /var/log/backup.log
|
|
125
|
+
|
|
126
|
+
# Verify backup integrity
|
|
127
|
+
gpg --verify /var/backups/db/mydb_*.gpg
|
|
128
|
+
|
|
129
|
+
# Test restore to different location
|
|
130
|
+
createdb mydb_restore
|
|
131
|
+
psql mydb_restore < /var/backups/db/mydb_*.sql
|
|
132
|
+
|
|
133
|
+
# Check retention
|
|
134
|
+
find /var/backups -name "*.gz.gpg" -mtime +30 | wc -l
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**Verification checklist:**
|
|
138
|
+
- [ ] Backups complete successfully
|
|
139
|
+
- [ ] Backups encrypted
|
|
140
|
+
- [ ] Backups uploaded to offsite storage
|
|
141
|
+
- [ ] Restore tested successfully
|
|
142
|
+
- [ ] Retention policy enforced
|
|
143
|
+
- [ ] Backup logs monitored
|
|
144
|
+
- [ ] RPO/RTO targets met
|
|
145
|
+
|
|
146
|
+
## Reference Documents
|
|
147
|
+
|
|
148
|
+
Load deep-dive content with `skill_view('backup-strategy', 'references/guide.md')`.
|
|
@@ -1,27 +1,193 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cdn-setup
|
|
3
3
|
description: Configure CDN for static assets. Use when the goal asks to set up CDN, optimize asset delivery, or reduce latency.
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
|
+
whenToUse: Static asset delivery, global content distribution, cache optimization, DDoS protection, edge computing
|
|
6
|
+
whenNotToUse: Dynamic API responses (use application caching), database queries, real-time WebSocket
|
|
5
7
|
---
|
|
6
8
|
|
|
7
|
-
#
|
|
9
|
+
# CDN Setup
|
|
8
10
|
|
|
9
|
-
Configure CDN for
|
|
11
|
+
Configure CDN for optimal content delivery.
|
|
10
12
|
|
|
11
13
|
## Goal pattern
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
CDN content delivery network static assets cache edge cloudflare cloudfront
|
|
14
16
|
|
|
15
17
|
## Parameters
|
|
16
18
|
|
|
17
19
|
- provider (choice [default: cloudflare]): CDN provider
|
|
20
|
+
- caching (choice [default: aggressive]): Caching strategy
|
|
21
|
+
- ssl (boolean [default: true]): SSL termination at edge
|
|
18
22
|
|
|
19
23
|
## Steps
|
|
20
24
|
|
|
21
|
-
1
|
|
25
|
+
### Step 1: [context-gatherer] — Analyze content and traffic patterns
|
|
22
26
|
|
|
23
|
-
|
|
27
|
+
```bash
|
|
28
|
+
# Check current asset sizes
|
|
29
|
+
find public/ -type f -exec ls -lh {} \; | sort -k5 -h | tail -20
|
|
24
30
|
|
|
25
|
-
|
|
31
|
+
# Check existing CDN setup
|
|
32
|
+
curl -I https://example.com/static/bundle.js 2>/dev/null | grep -i "cf-ray\|x-amz-cf\|x-fastly"
|
|
26
33
|
|
|
27
|
-
|
|
34
|
+
# Check DNS
|
|
35
|
+
dig example.com +short
|
|
36
|
+
dig CNAME example.com +short
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
- What content to serve? (images, JS, CSS, videos)
|
|
40
|
+
- What origin server? (S3, EC2, GCS, custom)
|
|
41
|
+
- What cache behavior? (long TTL for static, short for HTML)
|
|
42
|
+
- What security needs? (DDoS protection, WAF, rate limiting)
|
|
43
|
+
|
|
44
|
+
### Step 2: [writer] — Configure CDN
|
|
45
|
+
|
|
46
|
+
**Cloudflare configuration:**
|
|
47
|
+
```javascript
|
|
48
|
+
// wrangler.toml (Cloudflare Workers for edge logic)
|
|
49
|
+
name = "myapp-cdn"
|
|
50
|
+
main = "src/worker.ts"
|
|
51
|
+
compatibility_date = "2024-01-01"
|
|
52
|
+
|
|
53
|
+
[site]
|
|
54
|
+
bucket = "./public"
|
|
55
|
+
|
|
56
|
+
# Cache rules
|
|
57
|
+
[[rules]]
|
|
58
|
+
pattern = "*.js"
|
|
59
|
+
cache = true
|
|
60
|
+
ttl = 31536000 # 1 year
|
|
61
|
+
|
|
62
|
+
[[rules]]
|
|
63
|
+
pattern = "*.css"
|
|
64
|
+
cache = true
|
|
65
|
+
ttl = 31536000
|
|
66
|
+
|
|
67
|
+
[[rules]]
|
|
68
|
+
pattern = "*.html"
|
|
69
|
+
cache = true
|
|
70
|
+
ttl = 3600 # 1 hour
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**AWS CloudFront distribution:**
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"CallerReference": "myapp-2024",
|
|
77
|
+
"Origins": {
|
|
78
|
+
"Quantity": 2,
|
|
79
|
+
"Items": [
|
|
80
|
+
{
|
|
81
|
+
"Id": "s3-static",
|
|
82
|
+
"DomainName": "myapp-static.s3.amazonaws.com",
|
|
83
|
+
"S3OriginConfig": {
|
|
84
|
+
"OriginAccessIdentity": ""
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"Id": "api-origin",
|
|
89
|
+
"DomainName": "api.example.com",
|
|
90
|
+
"CustomOriginConfig": {
|
|
91
|
+
"HTTPPort": 80,
|
|
92
|
+
"HTTPSPort": 443,
|
|
93
|
+
"OriginProtocolPolicy": "https-only"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
"DefaultCacheBehavior": {
|
|
99
|
+
"TargetOriginId": "s3-static",
|
|
100
|
+
"ViewerProtocolPolicy": "redirect-to-https",
|
|
101
|
+
"CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e58f6", # CachingOptimized
|
|
102
|
+
"Compress": true
|
|
103
|
+
},
|
|
104
|
+
"CacheBehaviors": {
|
|
105
|
+
"Quantity": 2,
|
|
106
|
+
"Items": [
|
|
107
|
+
{
|
|
108
|
+
"PathPattern": "/api/*",
|
|
109
|
+
"TargetOriginId": "api-origin",
|
|
110
|
+
"ViewerProtocolPolicy": "https-only",
|
|
111
|
+
"CachePolicyId": "4135ea2d-6df8-44a3-9df3-4b5a84be39ad", # CachingDisabled
|
|
112
|
+
"OriginRequestPolicyId": "216adef6-5c7f-47e4-b989-5492eafa07d3"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"PathPattern": "/static/*",
|
|
116
|
+
"TargetOriginId": "s3-static",
|
|
117
|
+
"ViewerProtocolPolicy": "redirect-to-https",
|
|
118
|
+
"CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e58f6",
|
|
119
|
+
"Compress": true
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
"CustomErrorResponses": {
|
|
124
|
+
"Quantity": 1,
|
|
125
|
+
"Items": [
|
|
126
|
+
{
|
|
127
|
+
"ErrorCode": 404,
|
|
128
|
+
"ResponsePagePath": "/404.html",
|
|
129
|
+
"ResponseCode": "404",
|
|
130
|
+
"ErrorCachingMinTTL": 300
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
},
|
|
134
|
+
"ViewerCertificate": {
|
|
135
|
+
"ACMCertificateArn": "arn:aws:acm:us-east-1:123456789:certificate/abc123",
|
|
136
|
+
"SSLSupportMethod": "sni-only",
|
|
137
|
+
"MinimumProtocolVersion": "TLSv1.2_2021"
|
|
138
|
+
},
|
|
139
|
+
"WebACLId": "arn:aws:wafv2:us-east-1:123456789:global/webacl/myapp/abc123"
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Step 3: [runner] — Deploy CDN configuration
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# Cloudflare: deploy worker
|
|
147
|
+
npm run wrangler deploy
|
|
148
|
+
|
|
149
|
+
# CloudFront: create distribution
|
|
150
|
+
aws cloudfront create-distribution --distribution-config file://cloudfront.json
|
|
151
|
+
|
|
152
|
+
# Verify CDN is working
|
|
153
|
+
curl -I https://example.com/static/bundle.js | grep -i "cf-ray\|x-cache\|age"
|
|
154
|
+
|
|
155
|
+
# Purge cache
|
|
156
|
+
curl -X POST "https://api.cloudflare.com/client/v4/zones/ZONE_ID/purge_cache" \
|
|
157
|
+
-H "Authorization: Bearer API_TOKEN" \
|
|
158
|
+
-H "Content-Type: application/json" \
|
|
159
|
+
--data '{"purge_everything":true}'
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Step 4: [reviewer] — Verify CDN performance
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
# Check cache hit ratio
|
|
166
|
+
curl -s "https://api.cloudflare.com/client/v4/zones/ZONE_ID/analytics/dashboard" \
|
|
167
|
+
-H "Authorization: Bearer API_TOKEN" | jq '.result.totals.requests'
|
|
168
|
+
|
|
169
|
+
# Test global latency
|
|
170
|
+
for region in us-west us-east eu-west ap-south; do
|
|
171
|
+
echo -n "$region: "
|
|
172
|
+
curl -o /dev/null -s -w "%{time_total}s\n" https://example.com/
|
|
173
|
+
done
|
|
174
|
+
|
|
175
|
+
# Verify SSL
|
|
176
|
+
openssl s_client -connect example.com:443 -servername example.com
|
|
177
|
+
|
|
178
|
+
# Check headers
|
|
179
|
+
curl -I https://example.com/static/bundle.js | grep -E "Cache-Control|ETag|Vary"
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
**Verification checklist:**
|
|
183
|
+
- [ ] Cache hit ratio > 80%
|
|
184
|
+
- [ ] SSL grade A+
|
|
185
|
+
- [ ] Static assets served from edge
|
|
186
|
+
- [ ] API requests pass through to origin
|
|
187
|
+
- [ ] Cache headers correct (Cache-Control, ETag)
|
|
188
|
+
- [ ] DDoS protection enabled
|
|
189
|
+
- [ ] Global latency < 100ms
|
|
190
|
+
|
|
191
|
+
## Reference Documents
|
|
192
|
+
|
|
193
|
+
Load deep-dive content with `skill_view('cdn-setup', 'references/guide.md')`.
|
|
@@ -1,27 +1,184 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cloud-deploy
|
|
3
3
|
description: Deploy applications to AWS, GCP, or Azure. Use when the goal asks to deploy, host, or infrastructure-as-code for cloud platforms.
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
|
+
whenToUse: Cloud deployment, serverless functions, container orchestration, static site hosting, API deployment
|
|
6
|
+
whenNotToUse: Local development (use Docker Compose), Kubernetes-only (use kubernetes skill), on-premise
|
|
5
7
|
---
|
|
6
8
|
|
|
7
|
-
#
|
|
9
|
+
# Cloud Deploy
|
|
8
10
|
|
|
9
|
-
Deploy applications to
|
|
11
|
+
Deploy applications to cloud platforms with production patterns.
|
|
10
12
|
|
|
11
13
|
## Goal pattern
|
|
12
14
|
|
|
13
|
-
deploy
|
|
15
|
+
cloud deploy AWS GCP Azure serverless lambda function app engine kubernetes
|
|
14
16
|
|
|
15
17
|
## Parameters
|
|
16
18
|
|
|
17
19
|
- provider (choice [default: aws]): Cloud provider
|
|
20
|
+
- strategy (choice [default: containers]): Deployment strategy
|
|
21
|
+
- monitoring (boolean [default: true]): Set up monitoring
|
|
18
22
|
|
|
19
23
|
## Steps
|
|
20
24
|
|
|
21
|
-
1
|
|
25
|
+
### Step 1: [context-gatherer] — Analyze deployment requirements
|
|
22
26
|
|
|
23
|
-
|
|
27
|
+
```bash
|
|
28
|
+
# Check cloud CLI
|
|
29
|
+
aws --version 2>/dev/null
|
|
30
|
+
gcloud --version 2>/dev/null
|
|
31
|
+
az --version 2>/dev/null
|
|
24
32
|
|
|
25
|
-
|
|
33
|
+
# Check Docker
|
|
34
|
+
docker --version
|
|
35
|
+
docker ps
|
|
26
36
|
|
|
27
|
-
|
|
37
|
+
# Check existing deployments
|
|
38
|
+
aws ecs list-clusters 2>/dev/null | head -5
|
|
39
|
+
gcloud run services list 2>/dev/null | head -5
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
- What application? (web app, API, worker, static site)
|
|
43
|
+
- What cloud provider? (AWS, GCP, Azure)
|
|
44
|
+
- What deployment target? (ECS, Cloud Run, App Service, Lambda)
|
|
45
|
+
- What environment variables? (secrets, config)
|
|
46
|
+
- What domain/SSL? (custom domain, certificates)
|
|
47
|
+
|
|
48
|
+
### Step 2: [writer] — Create deployment configuration
|
|
49
|
+
|
|
50
|
+
**AWS ECS deployment:**
|
|
51
|
+
```yaml
|
|
52
|
+
# Dockerfile
|
|
53
|
+
FROM node:20-alpine AS builder
|
|
54
|
+
WORKDIR /app
|
|
55
|
+
COPY package*.json ./
|
|
56
|
+
RUN npm ci --only=production
|
|
57
|
+
COPY dist/ ./dist/
|
|
58
|
+
|
|
59
|
+
FROM node:20-alpine
|
|
60
|
+
WORKDIR /app
|
|
61
|
+
COPY --from=builder /app/node_modules ./node_modules
|
|
62
|
+
COPY --from=builder /app/dist ./dist
|
|
63
|
+
EXPOSE 3000
|
|
64
|
+
CMD ["node", "dist/index.js"]
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
# ECS Task Definition
|
|
68
|
+
{
|
|
69
|
+
"family": "myapp",
|
|
70
|
+
"networkMode": "awsvpc",
|
|
71
|
+
"requiresCompatibilities": ["FARGATE"],
|
|
72
|
+
"cpu": "512",
|
|
73
|
+
"memory": "1024",
|
|
74
|
+
"containerDefinitions": [
|
|
75
|
+
{
|
|
76
|
+
"name": "myapp",
|
|
77
|
+
"image": "123456789.dkr.ecr.us-east-1.amazonaws.com/myapp:latest",
|
|
78
|
+
"portMappings": [
|
|
79
|
+
{ "containerPort": 3000, "protocol": "tcp" }
|
|
80
|
+
],
|
|
81
|
+
"environment": [
|
|
82
|
+
{ "name": "NODE_ENV", "value": "production" }
|
|
83
|
+
],
|
|
84
|
+
"secrets": [
|
|
85
|
+
{ "name": "DATABASE_URL", "valueFrom": "arn:aws:ssm:us-east-1:123456789:parameter/myapp/db-url" }
|
|
86
|
+
],
|
|
87
|
+
"logConfiguration": {
|
|
88
|
+
"logDriver": "awslogs",
|
|
89
|
+
"options": {
|
|
90
|
+
"awslogs-group": "/ecs/myapp",
|
|
91
|
+
"awslogs-region": "us-east-1",
|
|
92
|
+
"awslogs-stream-prefix": "ecs"
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"healthCheck": {
|
|
96
|
+
"command": ["CMD-SHELL", "curl -f http://localhost:3000/health || exit 1"],
|
|
97
|
+
"interval": 30,
|
|
98
|
+
"timeout": 5,
|
|
99
|
+
"retries": 3
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**GCP Cloud Run:**
|
|
107
|
+
```yaml
|
|
108
|
+
# cloudbuild.yaml
|
|
109
|
+
steps:
|
|
110
|
+
- name: 'gcr.io/cloud-builders/docker'
|
|
111
|
+
args: ['build', '-t', 'gcr.io/$PROJECT_ID/myapp:$COMMIT_SHA', '.']
|
|
112
|
+
|
|
113
|
+
- name: 'gcr.io/cloud-builders/docker'
|
|
114
|
+
args: ['push', 'gcr.io/$PROJECT_ID/myapp:$COMMIT_SHA']
|
|
115
|
+
|
|
116
|
+
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
|
|
117
|
+
args:
|
|
118
|
+
- gcloud
|
|
119
|
+
- run
|
|
120
|
+
- deploy
|
|
121
|
+
- myapp
|
|
122
|
+
- --image=gcr.io/$PROJECT_ID/myapp:$COMMIT_SHA
|
|
123
|
+
- --region=us-central1
|
|
124
|
+
- --platform=managed
|
|
125
|
+
- --allow-unauthenticated
|
|
126
|
+
|
|
127
|
+
images:
|
|
128
|
+
- 'gcr.io/$PROJECT_ID/myapp:$COMMIT_SHA'
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Step 3: [runner] — Deploy application
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# Build and push Docker image
|
|
135
|
+
docker build -t myapp:latest .
|
|
136
|
+
docker tag myapp:latest 123456789.dkr.ecr.us-east-1.amazonaws.com/myapp:latest
|
|
137
|
+
docker push 123456789.dkr.ecr.us-east-1.amazonaws.com/myapp:latest
|
|
138
|
+
|
|
139
|
+
# Deploy to ECS
|
|
140
|
+
aws ecs update-service \
|
|
141
|
+
--cluster myapp-cluster \
|
|
142
|
+
--service myapp-service \
|
|
143
|
+
--force-new-deployment
|
|
144
|
+
|
|
145
|
+
# Wait for deployment
|
|
146
|
+
aws ecs wait services-stable \
|
|
147
|
+
--cluster myapp-cluster \
|
|
148
|
+
--services myapp-service
|
|
149
|
+
|
|
150
|
+
# Verify deployment
|
|
151
|
+
aws ecs describe-services \
|
|
152
|
+
--cluster myapp-cluster \
|
|
153
|
+
--services myapp-service \
|
|
154
|
+
--query 'services[0].{status:status,desired:desiredCount,running:runningCount}'
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Step 4: [reviewer] — Verify deployment
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
# Health check
|
|
161
|
+
curl -f https://myapp.example.com/health
|
|
162
|
+
|
|
163
|
+
# Check logs
|
|
164
|
+
aws logs tail /ecs/myapp --follow
|
|
165
|
+
|
|
166
|
+
# Verify SSL
|
|
167
|
+
openssl s_client -connect myapp.example.com:443 -servername myapp.example.com
|
|
168
|
+
|
|
169
|
+
# Load test
|
|
170
|
+
ab -n 100 -c 10 https://myapp.example.com/
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**Verification checklist:**
|
|
174
|
+
- [ ] Application responds to health checks
|
|
175
|
+
- [ ] SSL certificate valid
|
|
176
|
+
- [ ] Environment variables set correctly
|
|
177
|
+
- [ ] Logs flowing to CloudWatch/Cloud Logging
|
|
178
|
+
- [ ] Auto-scaling configured
|
|
179
|
+
- [ ] Database connections working
|
|
180
|
+
- [ ] No errors in deployment logs
|
|
181
|
+
|
|
182
|
+
## Reference Documents
|
|
183
|
+
|
|
184
|
+
Load deep-dive content with `skill_view('cloud-deploy', 'references/aws-services.md')`.
|