forked from unkeyed/unkey
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflightcontrol.js
110 lines (107 loc) · 2.75 KB
/
flightcontrol.js
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
const { writeFileSync } = require("node:fs");
const environments = [
{
region: "us-east-1",
vpc: {
id: "vpc-0bbc62fee8facf484",
cidr: "10.100.0.0/16",
},
},
{
region: "us-east-2",
vpc: { id: "vpc-026a7147c5ce748c4", cidr: "10.101.0.0/16" },
},
{
region: "us-west-1",
vpc: { id: "vpc-0b8a6e3edc7c2a826", cidr: "10.102.0.0/16" },
},
{
region: "af-south-1",
vpc: { id: "vpc-011432472b0add391", cidr: "10.103.0.0/16" },
},
{
region: "ap-southeast-2",
vpc: { id: "vpc-0d36fbf82c26a2f5b", cidr: "10.104.0.0/16" },
},
{
region: "ap-northeast-1",
vpc: { id: "vpc-0cd471a3e758a7ab2", cidr: "10.105.0.0/16" },
},
{
region: "eu-central-1",
vpc: { id: "vpc-0f435873b7f5339de", cidr: "10.106.0.0/16" },
},
{
region: "sa-east-1",
vpc: { id: "vpc-04ccca5fcd7e65f84", cidr: "10.107.0.0/16" },
},
{
region: "ap-southeast-1",
vpc: { id: "vpc-0cd96c0f9f8db4d58", cidr: "10.108.0.0/16" },
},
{
region: "ap-east-1",
vpc: { id: "vpc-0dbe96a55a157c2d5", cidr: "10.109.0.0/16" },
},
];
const config = {
WARNING: "DO NOT EDIT THIS FILE MANUALLY. IT IS GENERATED VIA 'node flightcontrol.js'",
$schema: "https://app.flightcontrol.dev/schema.json",
environments: environments.map((e) => ({
id: e.region,
name: e.region,
region: e.region,
source: {
branch: "main",
pr: false,
trigger: "manual",
},
vpc: e.vpc,
services: [
{
id: "agent",
name: "Agent",
watchPaths: ["flightcontrol.json", "./apps/agent/**"],
target: {
type: "ecs-ec2",
clusterInstanceSize: "t3.small",
clusterMinInstances: 1,
clusterMaxInstances: 16,
},
cpu: 2,
gpu: 0,
memory: 1.75,
// watchPaths: ["./apps/agent/**"],
ci: {
instanceSize: "c7a.4xlarge",
instanceStorage: 250,
},
containerInsights: false,
minInstances: 1,
maxInstances: 4,
versionHistoryCount: 10,
buildType: "docker",
dockerContext: "./apps/agent",
dockerfilePath: "./apps/agent/Dockerfile",
envVariables: {
REGION: `aws::${e.region}`,
AGENT_CONFIG_FILE: "config.production.json",
PORT: "8080",
},
autoscaling: {
cpuThreshold: 70,
memoryThreshold: 70,
cooldownTimerSecs: 60,
requestsPerTarget: 1000,
},
includeEnvVariablesInBuild: true,
healthCheckPath: "/v1/liveness",
port: 8080,
enableCloudfrontSwr: false,
type: "web",
},
],
})),
};
writeFileSync("flightcontrol.json", JSON.stringify(config, null, 2));
process.stdout.write("updated flightcontrol.json\n");