Skip to content

Commit

Permalink
Merge pull request #801 from convox/20160623
Browse files Browse the repository at this point in the history
20160623
  • Loading branch information
MiguelMoll authored Jun 23, 2016
2 parents 9ba52d8 + c0c42d5 commit 98c8fd5
Show file tree
Hide file tree
Showing 25 changed files with 221 additions and 88 deletions.
2 changes: 1 addition & 1 deletion Development.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ The Rack maintainers aim to help land every reasonable pull request, and to prov

## Checklists

Convox relies on checklists to safely and reliabily take code from a Pull Request to a published release. The standard release checklist is [https://github.com/convox/rack/blob/master/.github/PULL_REQUEST_TEMPLATE.md](PULL_REQUEST_TEMPLATE.md)
Convox relies on checklists to safely and reliabily take code from a Pull Request to a published release. The standard release checklist is [PULL_REQUEST_TEMPLATE.md](https://github.com/convox/rack/blob/master/.github/PULL_REQUEST_TEMPLATE.md).

We aim to automate and simplify the checklist over the life of the project to make releasing software easy, fast, and safe.

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.6.1-alpine
FROM golang:1.6.2-alpine

RUN apk update && apk add build-base docker git haproxy openssh openssl python tar

Expand Down
40 changes: 29 additions & 11 deletions api/dist/kernel.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
},
"Mappings": {
"RegionConfig": {
"us-east-1": { "Ami": "ami-67a3a90d" },
"us-west-1": { "Ami": "ami-b7d5a8d7" },
"us-west-2": { "Ami": "ami-c7a451a7" },
"eu-west-1": { "Ami": "ami-9c9819ef" },
"eu-central-1": { "Ami": "ami-9aeb0af5" },
"ap-northeast-1": { "Ami": "ami-7e4a5b10" },
"ap-southeast-1": { "Ami": "ami-be63a9dd" },
"ap-southeast-2": { "Ami": "ami-b8cbe8db" }
"us-east-1": { "Ami": "ami-8f7687e2" },
"us-west-1": { "Ami": "ami-bb473cdb" },
"us-west-2": { "Ami": "ami-84b44de4" },
"eu-west-1": { "Ami": "ami-4e6ffe3d" },
"eu-central-1": { "Ami": "ami-b0cc23df" },
"ap-northeast-1": { "Ami": "ami-095dbf68" },
"ap-southeast-1": { "Ami": "ami-cf03d2ac" },
"ap-southeast-2": { "Ami": "ami-697a540a" }
}
},
"Outputs": {
Expand Down Expand Up @@ -1269,19 +1269,37 @@
},
"SecurityGroupIngress": [
{
"CidrIp": "0.0.0.0/0",
"CidrIp": {
"Fn::If" : [
"PrivateApi",
{ "Ref": "VPCCIDR" },
"0.0.0.0/0"
]
},
"IpProtocol": "tcp",
"FromPort": "80",
"ToPort": "80"
},
{
"CidrIp": "0.0.0.0/0",
"CidrIp": {
"Fn::If" : [
"PrivateApi",
{ "Ref": "VPCCIDR" },
"0.0.0.0/0"
]
},
"IpProtocol": "tcp",
"FromPort": "443",
"ToPort": "443"
},
{
"CidrIp": "0.0.0.0/0",
"CidrIp": {
"Fn::If" : [
"PrivateApi",
{ "Ref": "VPCCIDR" },
"0.0.0.0/0"
]
},
"IpProtocol": "tcp",
"FromPort": "5000",
"ToPort": "5000"
Expand Down
22 changes: 4 additions & 18 deletions api/models/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ func (a *App) Create() error {
"SubnetsPrivate": subnetsPrivate,
"Version": os.Getenv("RELEASE"),
"VPC": os.Getenv("VPC"),
"VPCCIDR": os.Getenv("VPCCIDR"),
}

if os.Getenv("ENCRYPTION_KEY") != "" {
Expand Down Expand Up @@ -471,7 +472,6 @@ func (a *App) ExecAttached(pid, command string, height, width int, rw io.ReadWri

func (a *App) RunAttached(process, command, releaseId string, height, width int, rw io.ReadWriter) error {
resources, err := a.Resources()

if err != nil {
return err
}
Expand All @@ -480,7 +480,6 @@ func (a *App) RunAttached(process, command, releaseId string, height, width int,
TaskDefinition: aws.String(resources[UpperName(process)+"ECSTaskDefinition"].Id),
}
task, err := ECS().DescribeTaskDefinition(input)

if err != nil {
return err
}
Expand All @@ -503,19 +502,16 @@ func (a *App) RunAttached(process, command, releaseId string, height, width int,
}

release, err := GetRelease(a.Name, releaseId)

if err != nil {
return err
}

manifest, err := LoadManifest(release.Manifest, a)

if err != nil {
return err
}

me := manifest.Entry(process)

if me == nil {
return fmt.Errorf("no such process: %s", process)
}
Expand All @@ -524,7 +520,6 @@ func (a *App) RunAttached(process, command, releaseId string, height, width int,
host := ""

pss, err := ListProcesses(a.Name)

if err != nil {
return err
}
Expand Down Expand Up @@ -579,7 +574,6 @@ func (a *App) RunAttached(process, command, releaseId string, height, width int,
}

d, err := Docker(host)

if err != nil {
return err
}
Expand All @@ -592,7 +586,6 @@ func (a *App) RunAttached(process, command, releaseId string, height, width int,
Username: username,
Password: password,
})

if err != nil {
return err
}
Expand All @@ -618,7 +611,6 @@ func (a *App) RunAttached(process, command, releaseId string, height, width int,
Binds: binds,
},
})

if err != nil {
return err
}
Expand All @@ -645,25 +637,23 @@ func (a *App) RunAttached(process, command, releaseId string, height, width int,
time.Sleep(100 * time.Millisecond)

err = d.StartContainer(res.ID, nil)

if err != nil {
return err
}

err = d.ResizeContainerTTY(res.ID, height, width)

if err != nil {
return err
// In some cases, a container might finish and exit by the time ResizeContainerTTY is called.
// Resizing the TTY shouldn't cause the call to error out for cases like that.
fmt.Printf("fn=RunAttached level=warning msg=\"unable to resize container: %s\"", err)
}

code, err := d.WaitContainer(res.ID)

if err != nil {
return err
}

_, err = rw.Write([]byte(fmt.Sprintf("%s%d\n", StatusCodePrefix, code)))

if err != nil {
return err
}
Expand All @@ -673,7 +663,6 @@ func (a *App) RunAttached(process, command, releaseId string, height, width int,

func (a *App) RunDetached(process, command, releaseId string) error {
resources, err := a.Resources()

if err != nil {
return err
}
Expand Down Expand Up @@ -741,7 +730,6 @@ func (a *App) ProcessPorts(ps string) map[string]string {

func (a *App) Resources() (Resources, error) {
resources, err := ListResources(a.Name)

if err != nil {
return nil, err
}
Expand Down Expand Up @@ -772,7 +760,6 @@ func cleanupBucket(bucket string) error {
}

res, err := S3().ListObjectVersions(req)

if err != nil {
return err
}
Expand All @@ -796,7 +783,6 @@ func cleanupBucketObject(bucket, key, version string) {
}

_, err := S3().DeleteObject(req)

if err != nil {
fmt.Printf("error: %s\n", err)
}
Expand Down
5 changes: 5 additions & 0 deletions api/models/fixtures/balancer_labels.json
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@
"Description": "VPC for this app",
"Type": "AWS::EC2::VPC::Id"
},
"VPCCIDR": {
"Default": "",
"Description": "VPC CIDR for this app",
"Type": "String"
},
"Version": {
"Description": "(REQUIRED) Lambda CustomTopic Handler Release Version",
"MinLength": "1",
Expand Down
5 changes: 5 additions & 0 deletions api/models/fixtures/command_exec_form.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@
"Description": "VPC for this app",
"Type": "AWS::EC2::VPC::Id"
},
"VPCCIDR": {
"Default": "",
"Description": "VPC CIDR for this app",
"Type": "String"
},
"Version": {
"Description": "(REQUIRED) Lambda CustomTopic Handler Release Version",
"MinLength": "1",
Expand Down
5 changes: 5 additions & 0 deletions api/models/fixtures/command_string_form.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@
"Description": "VPC for this app",
"Type": "AWS::EC2::VPC::Id"
},
"VPCCIDR": {
"Default": "",
"Description": "VPC CIDR for this app",
"Type": "String"
},
"Version": {
"Description": "(REQUIRED) Lambda CustomTopic Handler Release Version",
"MinLength": "1",
Expand Down
5 changes: 5 additions & 0 deletions api/models/fixtures/complex_environment.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@
"Description": "VPC for this app",
"Type": "AWS::EC2::VPC::Id"
},
"VPCCIDR": {
"Default": "",
"Description": "VPC CIDR for this app",
"Type": "String"
},
"Version": {
"Description": "(REQUIRED) Lambda CustomTopic Handler Release Version",
"MinLength": "1",
Expand Down
5 changes: 5 additions & 0 deletions api/models/fixtures/environment_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@
"Description": "VPC for this app",
"Type": "AWS::EC2::VPC::Id"
},
"VPCCIDR": {
"Default": "",
"Description": "VPC CIDR for this app",
"Type": "String"
},
"Version": {
"Description": "(REQUIRED) Lambda CustomTopic Handler Release Version",
"MinLength": "1",
Expand Down
5 changes: 5 additions & 0 deletions api/models/fixtures/multi_balancer.json
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@
"Description": "VPC for this app",
"Type": "AWS::EC2::VPC::Id"
},
"VPCCIDR": {
"Default": "",
"Description": "VPC CIDR for this app",
"Type": "String"
},
"Version": {
"Description": "(REQUIRED) Lambda CustomTopic Handler Release Version",
"MinLength": "1",
Expand Down
9 changes: 8 additions & 1 deletion api/models/fixtures/web_external_internal.json
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,11 @@
"Description": "VPC for this app",
"Type": "AWS::EC2::VPC::Id"
},
"VPCCIDR": {
"Default": "",
"Description": "VPC CIDR for this app",
"Type": "String"
},
"Version": {
"Description": "(REQUIRED) Lambda CustomTopic Handler Release Version",
"MinLength": "1",
Expand Down Expand Up @@ -630,7 +635,9 @@
}
},
{
"CidrIp": "0.0.0.0/0",
"CidrIp": {
"Ref": "VPCCIDR"
},
"FromPort": {
"Ref": "WebPort3001Balancer"
},
Expand Down
5 changes: 5 additions & 0 deletions api/models/fixtures/web_postgis.json
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@
"Description": "VPC for this app",
"Type": "AWS::EC2::VPC::Id"
},
"VPCCIDR": {
"Default": "",
"Description": "VPC CIDR for this app",
"Type": "String"
},
"Version": {
"Description": "(REQUIRED) Lambda CustomTopic Handler Release Version",
"MinLength": "1",
Expand Down
9 changes: 8 additions & 1 deletion api/models/fixtures/web_postgis_internal.json
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,11 @@
"Description": "VPC for this app",
"Type": "AWS::EC2::VPC::Id"
},
"VPCCIDR": {
"Default": "",
"Description": "VPC CIDR for this app",
"Type": "String"
},
"Version": {
"Description": "(REQUIRED) Lambda CustomTopic Handler Release Version",
"MinLength": "1",
Expand Down Expand Up @@ -498,7 +503,9 @@
},
"SecurityGroupIngress": [
{
"CidrIp": "0.0.0.0/0",
"CidrIp": {
"Ref": "VPCCIDR"
},
"FromPort": {
"Ref": "WebPort3000Balancer"
},
Expand Down
Loading

0 comments on commit 98c8fd5

Please sign in to comment.