-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloud.config.ts
More file actions
225 lines (209 loc) · 4.87 KB
/
Copy pathcloud.config.ts
File metadata and controls
225 lines (209 loc) · 4.87 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
import type { CloudConfig } from '@stacksjs/ts-cloud'
/**
* ts-cloud Configuration
*
* This file defines your cloud infrastructure configuration.
* Supports both server mode (Forge-style) and serverless mode (Vapor-style).
*
* Environment variables:
* - CLOUD_ENV: Set the active environment (production, staging, development)
* - NODE_ENV: Fallback for CLOUD_ENV
*
* @see https://github.com/stacksjs/ts-cloud
*/
const config: CloudConfig = {
/**
* Project configuration
*/
project: {
name: 'ts-cloud',
slug: 'ts-cloud',
region: 'us-east-1', // Default AWS region
},
/**
* Deployment mode (auto-detected from your config; set it to pin the choice).
* Server and serverless are mutually exclusive - a project is one or the other.
* - 'server': EC2/Fargate box deployment (Forge-style, `infrastructure.compute`)
* - 'serverless': Lambda functions (Vapor-style, `environments.<env>.app`)
*/
mode: 'serverless',
/**
* Environment configurations
* Each environment can have its own settings
*/
environments: {
production: {
type: 'production',
region: 'us-east-1',
variables: {
NODE_ENV: 'production',
LOG_LEVEL: 'info',
},
},
staging: {
type: 'staging',
region: 'us-east-1',
variables: {
NODE_ENV: 'staging',
LOG_LEVEL: 'debug',
},
},
development: {
type: 'development',
region: 'us-east-1',
variables: {
NODE_ENV: 'development',
LOG_LEVEL: 'debug',
},
},
},
/**
* Infrastructure configuration
* Define your cloud resources here
*/
infrastructure: {
/**
* VPC Configuration (optional)
* Creates a Virtual Private Cloud for your resources
*/
vpc: {
cidr: '10.0.0.0/16',
zones: 2, // Number of availability zones
natGateway: true, // Enable NAT gateway for private subnets
},
/**
* Storage Configuration
* S3 buckets for files, backups, etc.
*/
storage: {
'frontend': {
public: true,
website: true,
encryption: true,
versioning: false,
},
'assets': {
public: true,
website: false,
encryption: true,
versioning: false,
},
'uploads': {
public: false,
website: false,
encryption: true,
versioning: true,
},
},
/**
* Compute Configuration
* Server or serverless compute resources
*/
compute: {
mode: 'serverless',
// Server mode (EC2) configuration
server: {
instanceType: 't3.small',
ami: 'ami-0f3caa1cf4417e51b', // Amazon Linux 2023 (us-east-1)
autoScaling: {
min: 1,
max: 5,
desired: 2,
},
},
// Serverless mode (ECS/Lambda) configuration
serverless: {
cpu: 512, // CPU units
memory: 1024, // Memory in MB
desiredCount: 2, // Number of tasks
},
},
/**
* Database Configuration (optional for frontend-only deployments)
*/
databases: {
// Uncomment to add a database
// 'main': {
// engine: 'postgres',
// instanceClass: 'db.t3.micro',
// storage: 20,
// username: 'admin',
// password: 'changeme123',
// },
},
/**
* Cache Configuration
*/
cache: {
type: 'redis',
nodeType: 'cache.t3.micro',
},
/**
* CDN Configuration
* CloudFront distribution for global content delivery
*/
cdn: {
'frontend': {
origin: 'ts-cloud-production-frontend.s3.us-east-1.amazonaws.com',
customDomain: 'ts-cloud.example.com',
},
},
/**
* DNS Configuration
* Route53 hosted zone and records
*/
dns: {
domain: 'example.com',
// hostedZoneId: 'Z1234567890ABC', // Optional: use existing hosted zone
},
/**
* Security Configuration
*/
security: {
// Web Application Firewall
waf: {
enabled: true,
blockCountries: ['CN', 'RU', 'KP'], // Geo-blocking
blockIps: ['192.0.2.0/24'], // IP blocking
rateLimit: 2000, // Requests per 5 minutes
},
// KMS encryption
kms: true,
},
/**
* Monitoring Configuration
*/
monitoring: {
dashboards: true,
alarms: [
{
name: 'HighCPU',
metric: 'CPUUtilization',
threshold: 80,
},
{
name: 'HighMemory',
metric: 'MemoryUtilization',
threshold: 80,
},
],
},
},
/**
* Sites Configuration (optional)
* For multi-site deployments
*/
sites: {
main: {
root: '/var/www/main',
path: '/',
domain: 'example.com',
},
api: {
root: '/var/www/api',
path: '/api',
domain: 'api.example.com',
},
},
}
export default config