Skip to content

Commit 2d18a56

Browse files
Merge pull request #3169 from quadratichq/qa
QA July 2nd
2 parents b1fd0f3 + f950faa commit 2d18a56

File tree

26 files changed

+811
-170
lines changed

26 files changed

+811
-170
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"Cockroachdb",
2929
"codegen",
3030
"codingame",
31+
"Coip",
3132
"containerd",
3233
"COUNTA",
3334
"COUNTBLANK",
@@ -39,6 +40,7 @@
3940
"dataframe",
4041
"dataframes",
4142
"dbgjs",
43+
"dbname",
4244
"dcell",
4345
"ddimaria",
4446
"dearmor",
@@ -116,6 +118,7 @@
116118
"oryd",
117119
"parq",
118120
"peekable",
121+
"pgdg",
119122
"PGUSER",
120123
"pigz",
121124
"pixi",

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ edition = "2024"
1414
description = "Infinite data grid with Python, JavaScript, and SQL built-in"
1515
repository = "https://github.com/quadratichq/quadratic"
1616
license-file = "LICENSE"
17-
version = "0.13.0"
17+
version = "0.13.1"
1818

1919
[profile.release]
2020
# Tell `rustc` to optimize for small code size.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.13.0
1+
0.13.1

infra/api/api.ts

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
import * as aws from "@pulumi/aws";
22
import * as pulumi from "@pulumi/pulumi";
33

4+
import { databaseUrl } from "../db/db";
45
import { latestAmazonLinuxAmi } from "../helpers/latestAmazonAmi";
56
import { runDockerImageBashScript } from "../helpers/runDockerImageBashScript";
67
import { instanceProfileIAMContainerRegistry } from "../shared/instanceProfileIAMContainerRegistry";
78
import {
89
apiAlbSecurityGroup,
910
apiEc2SecurityGroup,
10-
apiEip1,
11-
apiEip2,
1211
apiPrivateSubnet1,
1312
apiPrivateSubnet2,
13+
apiPrivateSubnet3,
1414
apiPublicSubnet1,
1515
apiPublicSubnet2,
16+
apiPublicSubnet3,
1617
apiVPC,
1718
} from "./api_network";
1819

@@ -40,25 +41,25 @@ const requestCountTarget =
4041

4142
// Create an Launch Template
4243
const launchTemplate = new aws.ec2.LaunchTemplate("api-lt", {
43-
name: `api-lt-${apiSubdomain}-${Math.random().toString(36).substring(2, 8)}`,
44+
name: `api-lt-${apiSubdomain}`,
4445
imageId: latestAmazonLinuxAmi.id,
4546
instanceType: instanceSize,
4647
iamInstanceProfile: {
4748
name: instanceProfileIAMContainerRegistry.name,
4849
},
4950
vpcSecurityGroupIds: [apiEc2SecurityGroup.id],
50-
userData: pulumi
51-
.all([apiEip1.publicIp, apiEip2.publicIp])
52-
.apply(([eip1, eip2]) => {
53-
const script = runDockerImageBashScript(
54-
apiECRName,
55-
dockerImageTag,
56-
apiPulumiEscEnvironmentName,
57-
{},
58-
true,
59-
);
60-
return Buffer.from(script).toString("base64");
61-
}),
51+
userData: pulumi.all([databaseUrl]).apply(([dbUrl]) => {
52+
const script = runDockerImageBashScript(
53+
apiECRName,
54+
dockerImageTag,
55+
apiPulumiEscEnvironmentName,
56+
{
57+
DATABASE_URL: dbUrl,
58+
},
59+
true,
60+
);
61+
return Buffer.from(script).toString("base64");
62+
}),
6263
tagSpecifications: [
6364
{
6465
resourceType: "instance",
@@ -103,7 +104,7 @@ const targetGroup = new aws.lb.TargetGroup("api-alb-tg", {
103104
},
104105
});
105106

106-
// Create Auto Scaling Group with warm pool
107+
// Create Auto Scaling Group
107108
const autoScalingGroup = new aws.autoscaling.Group("api-asg", {
108109
tags: [
109110
{
@@ -113,7 +114,11 @@ const autoScalingGroup = new aws.autoscaling.Group("api-asg", {
113114
},
114115
],
115116

116-
vpcZoneIdentifiers: [apiPrivateSubnet1.id, apiPrivateSubnet2.id],
117+
vpcZoneIdentifiers: [
118+
apiPrivateSubnet1.id,
119+
apiPrivateSubnet2.id,
120+
apiPrivateSubnet3.id,
121+
],
117122
launchTemplate: {
118123
id: launchTemplate.id,
119124
version: launchTemplate.latestVersion.apply((v) => v.toString()),
@@ -156,7 +161,7 @@ const alb = new aws.lb.LoadBalancer("api-alb", {
156161
name: `alb-${apiSubdomain}`,
157162
internal: false,
158163
loadBalancerType: "application",
159-
subnets: [apiPublicSubnet1.id, apiPublicSubnet2.id],
164+
subnets: [apiPublicSubnet1.id, apiPublicSubnet2.id, apiPublicSubnet3.id],
160165
securityGroups: [apiAlbSecurityGroup.id],
161166
enableHttp2: true,
162167
enableCrossZoneLoadBalancing: true,

infra/api/api_network.ts

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import * as aws from "@pulumi/aws";
22

3-
import { isPreviewEnvironment } from "../helpers/isPreviewEnvironment";
4-
53
// Create a new VPC
64
export const apiVPC = new aws.ec2.Vpc("api-vpc", {
75
cidrBlock: "10.0.0.0/16",
@@ -17,11 +15,15 @@ const internetGateway = new aws.ec2.InternetGateway("api-igw", {
1715
});
1816

1917
// Create Elastic IPs
20-
export const apiEip1 = new aws.ec2.Eip("api-nat-eip-1", {
18+
const apiEip1 = new aws.ec2.Eip("api-nat-eip-1", {
19+
domain: "vpc",
20+
});
21+
22+
const apiEip2 = new aws.ec2.Eip("api-nat-eip-2", {
2123
domain: "vpc",
2224
});
2325

24-
export const apiEip2 = new aws.ec2.Eip("api-nat-eip-2", {
26+
const apiEip3 = new aws.ec2.Eip("api-nat-eip-3", {
2527
domain: "vpc",
2628
});
2729

@@ -42,6 +44,14 @@ export const apiPublicSubnet2 = new aws.ec2.Subnet("api-public-subnet-2", {
4244
tags: { Name: "api-public-subnet-2" },
4345
});
4446

47+
export const apiPublicSubnet3 = new aws.ec2.Subnet("api-public-subnet-3", {
48+
vpcId: apiVPC.id,
49+
cidrBlock: "10.0.5.0/24",
50+
availabilityZone: "us-west-2c",
51+
mapPublicIpOnLaunch: true,
52+
tags: { Name: "api-public-subnet-3" },
53+
});
54+
4555
// Create a NAT Gateway in each public subnet
4656
const natGateway1 = new aws.ec2.NatGateway("api-nat-gateway-1", {
4757
allocationId: apiEip1.id,
@@ -55,6 +65,12 @@ const natGateway2 = new aws.ec2.NatGateway("api-nat-gateway-2", {
5565
tags: { Name: "api-nat-gateway-2" },
5666
});
5767

68+
const natGateway3 = new aws.ec2.NatGateway("api-nat-gateway-3", {
69+
allocationId: apiEip3.id,
70+
subnetId: apiPublicSubnet3.id,
71+
tags: { Name: "api-nat-gateway-3" },
72+
});
73+
5874
// Create private subnets
5975
export const apiPrivateSubnet1 = new aws.ec2.Subnet("api-private-subnet-1", {
6076
vpcId: apiVPC.id,
@@ -70,6 +86,13 @@ export const apiPrivateSubnet2 = new aws.ec2.Subnet("api-private-subnet-2", {
7086
tags: { Name: "api-private-subnet-2" },
7187
});
7288

89+
export const apiPrivateSubnet3 = new aws.ec2.Subnet("api-private-subnet-3", {
90+
vpcId: apiVPC.id,
91+
cidrBlock: "10.0.6.0/24",
92+
availabilityZone: "us-west-2c",
93+
tags: { Name: "api-private-subnet-3" },
94+
});
95+
7396
// Create route tables
7497
const publicRouteTable = new aws.ec2.RouteTable("api-public-route-table", {
7598
vpcId: apiVPC.id,
@@ -104,6 +127,17 @@ const privateRouteTable2 = new aws.ec2.RouteTable("api-private-route-table-2", {
104127
tags: { Name: "api-private-route-table-2" },
105128
});
106129

130+
const privateRouteTable3 = new aws.ec2.RouteTable("api-private-route-table-3", {
131+
vpcId: apiVPC.id,
132+
routes: [
133+
{
134+
cidrBlock: "0.0.0.0/0",
135+
natGatewayId: natGateway3.id,
136+
},
137+
],
138+
tags: { Name: "api-private-route-table-3" },
139+
});
140+
107141
// Associate subnets with route tables
108142
new aws.ec2.RouteTableAssociation("api-public-route-table-association-1", {
109143
subnetId: apiPublicSubnet1.id,
@@ -115,6 +149,11 @@ new aws.ec2.RouteTableAssociation("api-public-route-table-association-2", {
115149
routeTableId: publicRouteTable.id,
116150
});
117151

152+
new aws.ec2.RouteTableAssociation("api-public-route-table-association-3", {
153+
subnetId: apiPublicSubnet3.id,
154+
routeTableId: publicRouteTable.id,
155+
});
156+
118157
new aws.ec2.RouteTableAssociation("api-private-route-table-association-1", {
119158
subnetId: apiPrivateSubnet1.id,
120159
routeTableId: privateRouteTable1.id,
@@ -125,6 +164,11 @@ new aws.ec2.RouteTableAssociation("api-private-route-table-association-2", {
125164
routeTableId: privateRouteTable2.id,
126165
});
127166

167+
new aws.ec2.RouteTableAssociation("api-private-route-table-association-3", {
168+
subnetId: apiPrivateSubnet3.id,
169+
routeTableId: privateRouteTable3.id,
170+
});
171+
128172
// Create a Security Group for the Api ALB
129173
export const apiAlbSecurityGroup = new aws.ec2.SecurityGroup(
130174
"api-alb-security-group",
@@ -170,13 +214,3 @@ export const apiEc2SecurityGroup = new aws.ec2.SecurityGroup("api-sg-1", {
170214
],
171215
tags: { Name: "api-ec2-security-group" },
172216
});
173-
174-
if (isPreviewEnvironment)
175-
new aws.ec2.SecurityGroupRule(`api-ssh-ingress-rule`, {
176-
type: "ingress",
177-
fromPort: 22,
178-
toPort: 22,
179-
protocol: "tcp",
180-
cidrBlocks: ["0.0.0.0/0"],
181-
securityGroupId: apiEc2SecurityGroup.id,
182-
});

infra/connection/connection.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const desiredCapacity = config.getNumber("connection-lb-desired-capacity") ?? 2;
3737

3838
// Create an Launch Template
3939
const launchTemplate = new aws.ec2.LaunchTemplate("connection-lt", {
40-
name: `connection-lt-${connectionSubdomain}-${Math.random().toString(36).substring(2, 8)}`,
40+
name: `connection-lt-${connectionSubdomain}`,
4141
imageId: latestAmazonLinuxAmi.id,
4242
instanceType: instanceSize,
4343
iamInstanceProfile: {
@@ -97,6 +97,7 @@ const targetGroup = new aws.lb.TargetGroup("connection-nlb-tg", {
9797
deregistrationDelay: 30,
9898
});
9999

100+
// Create Auto Scaling Group
100101
const autoScalingGroup = new aws.autoscaling.Group("connection-asg", {
101102
tags: [
102103
{
@@ -105,6 +106,7 @@ const autoScalingGroup = new aws.autoscaling.Group("connection-asg", {
105106
propagateAtLaunch: true,
106107
},
107108
],
109+
108110
vpcZoneIdentifiers: [
109111
connectionPrivateSubnet1.id,
110112
connectionPrivateSubnet2.id,
@@ -117,13 +119,16 @@ const autoScalingGroup = new aws.autoscaling.Group("connection-asg", {
117119
maxSize,
118120
desiredCapacity,
119121
targetGroupArns: [targetGroup.arn],
122+
120123
instanceRefresh: {
121124
strategy: "Rolling",
122125
preferences: {
123126
minHealthyPercentage: 50,
124127
instanceWarmup: "60",
125128
},
126129
},
130+
131+
// Add auto-scaling metrics collection
127132
enabledMetrics: [
128133
"GroupMinSize",
129134
"GroupMaxSize",

infra/connection/connection_network.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import * as aws from "@pulumi/aws";
22

3-
import { isPreviewEnvironment } from "../helpers/isPreviewEnvironment";
4-
53
// Create a new VPC
64
export const connectionVPC = new aws.ec2.Vpc("connection-vpc", {
75
cidrBlock: "10.0.0.0/16",
@@ -173,13 +171,3 @@ export const connectionEc2SecurityGroup = new aws.ec2.SecurityGroup(
173171
],
174172
},
175173
);
176-
177-
if (isPreviewEnvironment)
178-
new aws.ec2.SecurityGroupRule(`connection-ssh-ingress-rule`, {
179-
type: "ingress",
180-
fromPort: 22,
181-
toPort: 22,
182-
protocol: "tcp",
183-
cidrBlocks: ["0.0.0.0/0"],
184-
securityGroupId: connectionEc2SecurityGroup.id,
185-
});

0 commit comments

Comments
 (0)