From 2c68c153b815a37e18d29bce05e7cfb7220328fd Mon Sep 17 00:00:00 2001 From: Nicolas Kammerdiener Date: Wed, 2 Nov 2022 13:07:35 -0400 Subject: [PATCH] Flower, DNS, and Redirects (#10948) * fixing protocol issue * swapping to HTTP * removing certificate * remove listener temporarily * just remove listener * update back * fixing connection URL * fixing to interpolate * fixing tostring * updates to production --- infra/production/index.ts | 53 +++++++++++++++++++++++---------------- infra/staging/index.ts | 17 ++++--------- 2 files changed, 37 insertions(+), 33 deletions(-) diff --git a/infra/production/index.ts b/infra/production/index.ts index 5ae4890e1cd..2b57ea10c36 100644 --- a/infra/production/index.ts +++ b/infra/production/index.ts @@ -324,6 +324,15 @@ const certificateValidation = new aws.acm.CertificateValidation("certificateVali validationRecordFqdns: [certificateValidationDomain.fqdn], }); +// c.gitcoin.co +const c_gitcoin_co = new aws.acm.Certificate("c-gitcoin-co", { + domainName: "c.gitcoin.co", + tags: { + Environment: "production", + }, + validationMethod: "DNS", + }); + // Create the listener for the application // const listener = new awsx.lb.ApplicationListener("app", { // port: 443, @@ -390,9 +399,9 @@ const staticBucket = new aws.lb.ListenerRule("static", { actions: [{ type: "redirect", redirect: { - host: "go.gitcoin.co", - port: "443", - protocol: "HTTPS", + host: "52.10.118.130", + port: "80", + protocol: "HTTP", statusCode: "HTTP_301", }, }], @@ -806,24 +815,26 @@ const celery = new awsx.ecs.FargateService("celery", { }, }); -// const flower = new awsx.ecs.FargateService("flower", { -// cluster, -// desiredCount: 2, -// taskDefinitionArgs: { -// containers: { -// celery: { -// image: "mher/flower", -// command: ["flower", "--broker=" + redisConnectionUrl, "--port=8888"], -// memory: 4096, -// cpu: 2000, -// portMappings: [], -// environment: environment, -// dependsOn: [], -// links: [] -// }, -// }, -// }, -// }); +const flowerBrokerString = pulumi.interpolate`--broker=${redisConnectionUrl}`.apply.toString(); + +const flower = new awsx.ecs.FargateService("flower", { + cluster, + desiredCount: 1, + taskDefinitionArgs: { + containers: { + celery: { + image: "mher/flower", + command: ["celery", "flower", "-A" , flowerBrokerString , "taskapp", "--port=5555"], + memory: 4096, + cpu: 2000, + portMappings: [], + environment: environment, + dependsOn: [], + links: [] + }, + }, + }, +}); const ecsTarget = new aws.appautoscaling.Target("autoscaling_target", { maxCapacity: 10, diff --git a/infra/staging/index.ts b/infra/staging/index.ts index bf22f42b526..6cf37fc141b 100644 --- a/infra/staging/index.ts +++ b/infra/staging/index.ts @@ -332,21 +332,12 @@ const target = alb.createTargetGroup( "web-target", { vpc, port: 80 } ); -const flowerTarget = alb.createTargetGroup( - "flower-target", { vpc, port: 5555, protocol: "HTTPS" } -); - // Listen to traffic on port 443 & route it through the target group const httpsListener = target.createListener("web-listener", { port: 443, certificateArn: certificateValidation.certificateArn }); -const flowerListener = flowerTarget.createListener("flower-listener", { - port: 5555, - certificateArn: certificateValidation.certificateArn -}); - const staticBucket = new aws.lb.ListenerRule("static", { listenerArn: httpsListener.listener.arn, priority: 100, @@ -781,17 +772,19 @@ const celery = new awsx.ecs.FargateService("celery", { }, }); +const flowerBrokerString = pulumi.interpolate`--broker=${redisConnectionUrl}`.apply.toString(); + const flower = new awsx.ecs.FargateService("flower", { cluster, - desiredCount: 2, + desiredCount: 1, taskDefinitionArgs: { containers: { celery: { image: "mher/flower", - command: ["celery", "flower", "-A" , "taskapp", "--port=5555"], + command: ["celery", "flower", "-A" , flowerBrokerString , "taskapp", "--port=5555"], memory: 4096, cpu: 2000, - portMappings: [flowerListener], + portMappings: [], environment: environment, dependsOn: [], links: []