Skip to content

Commit

Permalink
Merge pull request #1572 from quadratichq/fix-connections-deploy
Browse files Browse the repository at this point in the history
fix connections deploy on code change
  • Loading branch information
davidkircos authored Jul 24, 2024
2 parents 14a7f3c + 4e842ab commit a30234a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
23 changes: 16 additions & 7 deletions infra/connection/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
connectionPublicSubnet2,
connectionVPC,
} from "./connection_network";

const config = new pulumi.Config();

// Configuration from command line
Expand Down Expand Up @@ -69,6 +70,13 @@ let desiredCapacity = 2;
if (isPreviewEnvironment) minSize = maxSize = desiredCapacity = 1;

const autoScalingGroup = new aws.autoscaling.Group("connection-asg", {
tags: [
{
key: "Name",
value: `connection-instance-${connectionSubdomain}`,
propagateAtLaunch: true,
},
],
vpcZoneIdentifiers: [
connectionPrivateSubnet1.id,
connectionPrivateSubnet2.id,
Expand All @@ -77,18 +85,19 @@ const autoScalingGroup = new aws.autoscaling.Group("connection-asg", {
minSize,
maxSize,
desiredCapacity,
tags: [
{
key: "Name",
value: `connection-instance-${connectionSubdomain}`,
propagateAtLaunch: true,
},
],
targetGroupArns: [targetGroup.arn],
instanceRefresh: {
strategy: "Rolling",
preferences: {
minHealthyPercentage: 50,
instanceWarmup: "60",
},
},
});

// Create a new Network Load Balancer
const nlb = new aws.lb.LoadBalancer("connection-nlb", {
name: `nlb-${connectionSubdomain}`,
internal: false,
loadBalancerType: "network",
subnets: [connectionPublicSubnet1.id, connectionPublicSubnet2.id],
Expand Down
12 changes: 10 additions & 2 deletions quadratic-connection/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,16 @@ pub(crate) async fn serve() -> Result<()> {
Ok(())
}

pub(crate) async fn healthcheck() -> impl IntoResponse {
StatusCode::OK
#[derive(Debug, Deserialize, Serialize, PartialEq)]
pub struct HealthResponse {
pub version: String,
}

pub(crate) async fn healthcheck() -> Json<HealthResponse> {
HealthResponse {
version: env!("CARGO_PKG_VERSION").into(),
}
.into()
}

pub(crate) async fn static_ips() -> Result<Json<StaticIpsResponse>> {
Expand Down

0 comments on commit a30234a

Please sign in to comment.