fargate-helper
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -118,2 +118,12 @@ #!/usr/bin/env node | ||
const listenerArn = Config.str("listenerArn"); | ||
// Need to go through the listener to figure out the highest priority rule | ||
const listenerResponse = await client.describeRules({ ListenerArn: listenerArn }).promise(); | ||
let highestPriority = 0; | ||
for (const rule of listenerResponse.Rules) { | ||
const priority = parseInt(rule.Priority); | ||
if (priority > highestPriority) { | ||
highestPriority = priority; | ||
} | ||
} | ||
const hostname = Config.str("serviceName") + ".bespoken.io"; | ||
@@ -134,3 +144,3 @@ var params = { | ||
ListenerArn: listenerArn, | ||
Priority: 10 | ||
Priority: highestPriority + 1, | ||
}; | ||
@@ -192,4 +202,4 @@ const rules = await client.createRule(params).promise(); | ||
awsvpcConfiguration: { | ||
securityGroups: [ "sg-daa0b1af" ], | ||
subnets: [ "subnet-02ed562e", "subnet-af5525e7" ] | ||
securityGroups: [Config.str("securityGroup")], | ||
subnets: Config.str("subnets"), | ||
} | ||
@@ -230,3 +240,3 @@ }, | ||
if (Config.has("command")) { | ||
containerDefinition.command[0] = Config.str("command"); | ||
containerDefinition.command = [Config.str("command")]; | ||
} | ||
@@ -303,5 +313,2 @@ containerDefinition.image = Config.str("image"); | ||
containerDefinitions: [{ | ||
command: [ | ||
"COMMAND" | ||
], | ||
entryPoint: [ | ||
@@ -308,0 +315,0 @@ "sh", |
{ | ||
"name": "fargate-helper", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Helper scripts for deploying to Fargate", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,2 +0,15 @@ | ||
# Getting Started | ||
# Setup | ||
Install the package: | ||
`npm install fargate-helper -g` | ||
Set these environment variables - for the AWS SDK that this relies on: | ||
* AWS_ACCESS_KEY_ID | ||
* AWS_SECRET_ACCESS_KEY | ||
* AWS_DEFAULT_REGION - defaults to `us-east-1` if not set | ||
# How It Works | ||
This tool creates or updates a Fargate service, along with the pieces that it needs (ALB, HealthCheck, etc.). | ||
It assumes that an image has been pushed to Docker Hub - it takes the image name and creates a Fargate service around it. | ||
For new services, the script will: | ||
@@ -12,7 +25,2 @@ 1) Register a task definition | ||
To use this, the AWS credentials must be configured. Typically this is done via environment variables: | ||
* AWS_ACCESS_KEY_ID | ||
* AWS_SECRET_ACCESS_KEY | ||
* AWS_DEFAULT_REGION - defaults to `us-east-1` if not set | ||
# Deployment Configuration | ||
@@ -81,2 +89,2 @@ The values for configuring the service will come from three places: | ||
In particular, here is the Circle CI configuration: | ||
https://github.com/bespoken/UtteranceTester/blob/master/.circleci/config.yml#L27 | ||
https://github.com/bespoken/UtteranceTester/blob/master/.circleci/config.yml#L32 |
18
TODO.md
@@ -1,12 +0,14 @@ | ||
- [ ] Load options from JSON files? | ||
**TODO** | ||
- [X] Test with circle | ||
- [X] Command should be optional - should use the dockerfile by default | ||
- [X] Figure out multiline in YAML configuration | ||
- [ ] Parameterize subnet and security groups from TaskDefinition (should go in AWS Secrets) | ||
- [ ] Add robustness | ||
- [ ] if target group exists, delete | ||
- [ ] if rules exists, delete | ||
- [ ] Test with circle | ||
**Maybe** | ||
- [ ] Create custom log groups automatically | ||
- [ ] Load options from JSON files? | ||
- [ ] Do find/replace on task definition instead of setting JSON? (So custom task definition does not get overridden?) | ||
- [ ] Do we need grace period? | ||
- [ ] Create custom log groups | ||
- [ ] Command should be optional - should use the dockerfile by default | ||
- [ ] Do find/replace on task definition instead of setting JSON? (So custom task definition does not get overridden?) | ||
- [ ] Parameterize subnet and security groups (should go in secrets) | ||
- [ ] Figure out multiline in YAML configuraiton | ||
- [ ] Create deploy.sh script |
17897
342
89