From b3c8a0fda6d8d7fbc8234955dcae6cc318a7173e Mon Sep 17 00:00:00 2001 From: Itai Steinherz Date: Tue, 12 Feb 2019 11:13:54 +0200 Subject: [PATCH] Set Fargate desired task count to 2 --- docs/swagger.yml | 8 ++-- readme.md | 2 +- server/cloud/bin/aws.js | 9 ---- server/cloud/lib/aws-stack.js | 81 ----------------------------------- server/cloud/lib/stack.js | 30 ------------- server/cloud/lib/stack.ts | 3 +- 6 files changed, 7 insertions(+), 126 deletions(-) delete mode 100644 server/cloud/bin/aws.js delete mode 100644 server/cloud/lib/aws-stack.js delete mode 100644 server/cloud/lib/stack.js diff --git a/docs/swagger.yml b/docs/swagger.yml index c2711fa..25d845b 100644 --- a/docs/swagger.yml +++ b/docs/swagger.yml @@ -2,7 +2,7 @@ swagger: "2.0" info: description: Swagger documentation for [Knowledge](https://github.com/chingu-voyage7/Bears-Team-22). - version: 1.0.0 + version: 0.1.0 title: Knowledge API license: name: MIT @@ -269,7 +269,7 @@ paths: message: "Network error" # Thread routes - /thread/:questionId: + /thread/{questionId}: get: tags: - "content" @@ -330,7 +330,7 @@ paths: path: question # Tag routes - /tag/browse/:tagname: + /tag/browse/{tagname}: get: tags: - "tag" @@ -391,7 +391,7 @@ paths: application/json: error: "Internal server error: couldn't fulfill the request at the current time." - /tag/tags/:query: + /tag/tags/{query}: get: tags: - "tag" diff --git a/readme.md b/readme.md index cbbc28c..fb7bb5d 100644 --- a/readme.md +++ b/readme.md @@ -41,7 +41,7 @@ Both our frontend and backend are written in Node.js. The tech stack consists of - [Express.js](https://expressjs.com) - for the main API which servers the frontend app. - [MongoDB](https://www.mongodb.com) - for data storage. -- [Firebase Auth](https://firebase.google.com/docs/auth) - for password-based user authentication +- [Firebase Auth](https://firebase.google.com/docs/auth) - for password-based user authentication. #### DevOps and deployment diff --git a/server/cloud/bin/aws.js b/server/cloud/bin/aws.js deleted file mode 100644 index fd107d5..0000000 --- a/server/cloud/bin/aws.js +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env node -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const cdk = require("@aws-cdk/cdk"); -const stack_1 = require("../lib/stack"); -const app = new cdk.App(); -new stack_1.KnowledgeStack(app, "Knowledge"); -app.run(); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXdzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiYXdzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUNBLG9DQUFxQztBQUNyQyx3Q0FBNEM7QUFFNUMsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsSUFBSSxzQkFBYyxDQUFDLEdBQUcsRUFBRSxXQUFXLENBQUMsQ0FBQztBQUNyQyxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIjIS91c3IvYmluL2VudiBub2RlXG5pbXBvcnQgY2RrID0gcmVxdWlyZShcIkBhd3MtY2RrL2Nka1wiKTtcbmltcG9ydCB7S25vd2xlZGdlU3RhY2t9IGZyb20gXCIuLi9saWIvc3RhY2tcIjtcblxuY29uc3QgYXBwID0gbmV3IGNkay5BcHAoKTtcbm5ldyBLbm93bGVkZ2VTdGFjayhhcHAsIFwiS25vd2xlZGdlXCIpO1xuYXBwLnJ1bigpO1xuIl19 \ No newline at end of file diff --git a/server/cloud/lib/aws-stack.js b/server/cloud/lib/aws-stack.js deleted file mode 100644 index f7c6b23..0000000 --- a/server/cloud/lib/aws-stack.js +++ /dev/null @@ -1,81 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const cdk = require("@aws-cdk/cdk"); -const ec2 = require("@aws-cdk/aws-ec2"); -const ecs = require("@aws-cdk/aws-ecs"); -const elbv2 = require("@aws-cdk/aws-elasticloadbalancingv2"); -const { ApplicationProtocol } = elbv2; -// import path = require("path"); -class KnowledgeStack extends cdk.Stack { - constructor(scope, id, props) { - super(scope, id, props); - // Create VPC and Fargate Cluster - const vpc = new ec2.VpcNetwork(this, "FargateVPC", { - maxAZs: 1 - }); - const cluster = new ecs.Cluster(this, "KnowledgeCluster", { vpc }); - // Configure cluster auto-scaling - // cluster.addDefaultAutoScalingGroupCapacity({ - // instanceType: new ec2.InstanceType("t2.nano"), - // instanceCount: 4, - // }); - // Create task definition - const fargateTaskDefinition = new ecs.FargateTaskDefinition(this, "FargateTaskDef", { - memoryMiB: "512", - cpu: "256" - }); - // Create container from local `Dockerfile` - const knowledgeContainer = fargateTaskDefinition.addContainer("KnowledgeContainer", { - image: ecs.ContainerImage.fromAsset(this, "KnowledgeImage", { - directory: ".." - }) - }); - // Set port mapping - knowledgeContainer.addPortMappings({ - containerPort: 5000 - }); - // Create container from DockerHub image - const mongoContainer = fargateTaskDefinition.addContainer("MongoContainer", { - image: ecs.ContainerImage.fromDockerHub("mongo") - }); - // Set port mapping - mongoContainer.addPortMappings({ - containerPort: 27017, - hostPort: 27017 - }); - // Create service - const service = new ecs.FargateService(this, "KnowledgeService", { - cluster, - taskDefinition: fargateTaskDefinition, - desiredCount: 2 - }); - // Configure task auto-scaling - const scaling = service.autoScaleTaskCount({ - maxCapacity: 5 - }); - scaling.scaleOnCpuUtilization("CpuScaling", { - targetUtilizationPercent: 70 - }); - // Create service with built-in load balancer - const loadBalancer = new elbv2.ApplicationLoadBalancer(this, "KnowledgeLB", { - vpc, - internetFacing: true - }); - // Create a listener and listen to incoming requests - const listener = loadBalancer.addListener("Listener", { - port: 5000, - protocol: ApplicationProtocol.Http - }); - listener.addTargets("KnowledgeServiceTarget", { - port: 5000, - protocol: ApplicationProtocol.Http, - targets: [service] - }); - // Output the DNS where you can access your service - new cdk.Output(this, "LoadBalancerDNS", { - value: loadBalancer.dnsName - }); - } -} -exports.KnowledgeStack = KnowledgeStack; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXdz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nZpY2VdXG5cdFx0fSk7XG5cblx0XHQvLyBPdXRwdXQgdGhlIEROUyB3aGVyZSB5b3UgY2FuIGFjY2VzcyB5b3VyIHNlcnZpY2Vcblx0XHRuZXcgY2RrLk91dHB1dCh0aGlzLCBcIkxvYWRCYWxhbmNlckROU1wiLCB7XG5cdFx0XHR2YWx1ZTogbG9hZEJhbGFuY2VyLmRuc05hbWVcblx0XHR9KTtcblx0fVxufSJdfQ== \ No newline at end of file diff --git a/server/cloud/lib/stack.js b/server/cloud/lib/stack.js deleted file mode 100644 index 2add61e..0000000 --- a/server/cloud/lib/stack.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const cdk = require("@aws-cdk/cdk"); -const ec2 = require("@aws-cdk/aws-ec2"); -const ecs = require("@aws-cdk/aws-ecs"); -class KnowledgeStack extends cdk.Stack { - constructor(scope, id, props) { - super(scope, id, props); - // Create VPC and Fargate Cluster - // NOTE: Limit AZs to avoid reaching resource quotas - const vpc = new ec2.VpcNetwork(this, "KnowledgeVpc", { - maxAZs: 2 - }); - const cluster = new ecs.Cluster(this, "KnowledgeCluster", { vpc }); - // Instantiate Fargate Service with just cluster and image - const fargateService = new ecs.LoadBalancedFargateService(this, "KnowledgeService", { - cluster, - image: ecs.ContainerImage.fromAsset(this, "KnowledgeImage", { - directory: ".." - }), - containerPort: 5000 - }); - // Output the DNS where you can access your service - new cdk.Output(this, "LoadBalancerDNS", { - value: fargateService.loadBalancer.dnsName - }); - } -} -exports.KnowledgeStack = KnowledgeStack; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhY2suanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJzdGFjay50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG9DQUFxQztBQUNyQyx3Q0FBeUM7QUFDekMsd0NBQXlDO0FBRXpDLE1BQWEsY0FBZSxTQUFRLEdBQU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dFx0Ly8gT3V0cHV0IHRoZSBETlMgd2hlcmUgeW91IGNhbiBhY2Nlc3MgeW91ciBzZXJ2aWNlXG5cdFx0bmV3IGNkay5PdXRwdXQodGhpcywgXCJMb2FkQmFsYW5jZXJETlNcIiwge1xuXHRcdFx0dmFsdWU6IGZhcmdhdGVTZXJ2aWNlLmxvYWRCYWxhbmNlci5kbnNOYW1lXG5cdFx0fSk7XG5cdH1cbn0iXX0= \ No newline at end of file diff --git a/server/cloud/lib/stack.ts b/server/cloud/lib/stack.ts index 5569718..4afca73 100644 --- a/server/cloud/lib/stack.ts +++ b/server/cloud/lib/stack.ts @@ -19,7 +19,8 @@ export class KnowledgeStack extends cdk.Stack { image: ecs.ContainerImage.fromAsset(this, "KnowledgeImage", { directory: ".." }), - containerPort: 5000 + containerPort: 5000, + desiredCount: 2 // Meant to make sure at least 1 task is always running. }); // Output the DNS where you can access your service