Skip to content

Commit

Permalink
Bump 1.0.4: webserver_v2 worker_v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Kotowick committed Apr 12, 2017
1 parent d792539 commit d704a96
Show file tree
Hide file tree
Showing 10 changed files with 829 additions and 17 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ ENV PATH="$PATH:/usr/local/bin/go-deploy"

RUN chmod +x /usr/local/bin/go-deploy/go-deploy

VOLUME /usr/local/bin/go-deploy
CMD ["/bin/sh", "/run.sh"]
Binary file modified bin/go-deploy
Binary file not shown.
Binary file modified bin/go-deploy-1.0.3
Binary file not shown.
Binary file added bin/go-deploy-1.0.4
Binary file not shown.
50 changes: 48 additions & 2 deletions bindata.go

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions lib/aws/cloudformation/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,15 @@ func (c *CloudFormation) UpdateStack(paramaters map[string]string, template []by
fmt.Printf("%s", cfParameters)

params := &cloudformation.UpdateStackInput{
StackName: aws.String(fmt.Sprintf("%s-%s-%s", paramaters["AppName"], paramaters["EnvName"], paramaters["Tier"])), // Required
StackName: aws.String(fmt.Sprintf("%s-%s", paramaters["AppName"], paramaters["EnvName"])), // Required
Parameters: cfParameters,
}

if usePreviousTemplate {
fmt.Println("Using previous template")
params.UsePreviousTemplate = aws.Bool(usePreviousTemplate)
} else {
fmt.Println("Using template file")
params.TemplateBody = aws.String(fmt.Sprintf("%s", template))
}

Expand Down Expand Up @@ -158,7 +160,7 @@ func (c *CloudFormation) CreateStack(paramaters map[string]string, template []by
fmt.Printf("%s", cfParameters)

params := &cloudformation.CreateStackInput{
StackName: aws.String(fmt.Sprintf("%s-%s-%s", paramaters["AppName"], paramaters["EnvName"], paramaters["Tier"])), // Required
StackName: aws.String(fmt.Sprintf("%s-%s", paramaters["AppName"], paramaters["EnvName"])), // Required
DisableRollback: aws.Bool(false),
//OnFailure: aws.String("OnFailure"),
Parameters: cfParameters,
Expand Down
26 changes: 15 additions & 11 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ var (
// Global Vars
//--
//
cliVersion = "1.0.3"
cliVersion = "1.0.4"

// --
// Top Level Commands
Expand Down Expand Up @@ -140,7 +140,7 @@ func createFunction(createMethod string, awsConfig config.Config, ebService elas
}

environment := utils.GetDefault(*environmentNameArg, *environmentApplicationNameArg)
asset, err := Asset(fmt.Sprintf("resources/cloudformation/templates/%s_v1.json", *environmentTierArg))
asset, err := Asset(fmt.Sprintf("resources/cloudformation/templates/%s_v2.json", *environmentTierArg))

if err != nil {
log.Fatalf("Asset not found: %s", err)
Expand Down Expand Up @@ -212,7 +212,7 @@ func updateFunction(updateMethod string, awsConfig config.Config, ebService elas
}

environment := utils.GetDefault(*environmentNameArg, *environmentApplicationNameArg)
asset, err := Asset(fmt.Sprintf("resources/cloudformation/templates/%s_v1.json", *environmentTierArg))
asset, err := Asset(fmt.Sprintf("resources/cloudformation/templates/%s_v2.json", *environmentTierArg))

if err != nil {
log.Fatalf("Asset not found: %s", err)
Expand All @@ -223,20 +223,23 @@ func updateFunction(updateMethod string, awsConfig config.Config, ebService elas
s3Service.UploadSingleFile(*environmentS3Arg, *environmentLocalFilePathArg+"/"+*environmentVersionArg+".zip", *environmentVersionArg)
}

configOptions := make(map[string]string)
configOptions["EnvName"] = environment
configOptions["AppName"] = *environmentApplicationNameArg
additionalConfigOptions := make(map[string]string)
additionalConfigOptions["EnvName"] = environment
additionalConfigOptions["AppName"] = *environmentApplicationNameArg
if len(bucketInfo) > 0 {
configOptions["AppBucket"] = bucketInfo[0]
configOptions["AppKey"] = bucketInfo[1] + "/" + *environmentVersionArg + ".zip"
additionalConfigOptions["AppBucket"] = bucketInfo[0]
additionalConfigOptions["AppKey"] = bucketInfo[1] + "/" + *environmentVersionArg + ".zip"
}
configOptions["VersionLabel"] = *environmentVersionArg
configOptions["Tier"] = *environmentTierArg
additionalConfigOptions["VersionLabel"] = *environmentVersionArg
additionalConfigOptions["Tier"] = *environmentTierArg

usePreviousTemplate := true

configOptions := utils.GetConfig(*environmentConfigArg)
configOptions = utils.CombineConfigOptions(configOptions, additionalConfigOptions)

if *environmentConfigArg != "" {
configOptions = utils.CombineConfigOptions(utils.GetConfig(*environmentConfigArg), configOptions)
fmt.Printf("Config file is present: %s", *environmentConfigArg)
usePreviousTemplate = false
}

Expand All @@ -253,6 +256,7 @@ func upsertFunction(updateMethod string, awsConfig config.Config, ebService elas
}

if ebService.EnvironmentExists() {
fmt.Println("Updating existing environment...")
updateFunction("update environment", awsConfig, ebService, s3Service)
} else {
fmt.Println("Env DOES NOT exist..creating")
Expand Down
24 changes: 22 additions & 2 deletions resources/cloudformation/templates/webserver_v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,23 @@
"Type" : "String",
"Default" : ""
},
"loadbalancerManagedSecurityGroup" : {
"loadbalancerDefaultListenerEnabled" : {
"Description" : "Will ELB cross availability zones. True/False Boolean.",
"Type" : "String",
"Default" : "true",
"AllowedValues" : [ "true", "false" ]
},
"loadbalancerSecureListenerCertificateId" : {
"Description" : "Will ELB cross availability zones. True/False Boolean.",
"Type" : "String",
"Default" : ""
},
"loadbalancerSecureListenerEnabled" : {
"Description" : "Will ELB cross availability zones. True/False Boolean.",
"Type" : "String",
"Default" : "false",
"AllowedValues" : [ "true", "false" ]
},
"environmentServiceRole" : {
"Description" : "IAM role used by Elastic Beanstalk to manage services.",
"Type" : "String",
Expand Down Expand Up @@ -346,7 +358,15 @@
{"Namespace" : "aws:elasticbeanstalk:environment", "OptionName" : "EnvironmentType", "Value" : { "Ref" : "environmentType" }},
{"Namespace" : "aws:elb:loadbalancer", "OptionName" : "CrossZone", "Value" : { "Ref" : "loadbalancerCrossZone" }},
{"Namespace" : "aws:elb:loadbalancer", "OptionName" : "SecurityGroups", "Value" : { "Ref" : "loadbalancerSecurityGroups" }},
{"Namespace" : "aws:elb:loadbalancer", "OptionName" : "ManagedSecurityGroup", "Value" : { "Ref" : "loadbalancerManagedSecurityGroup" }}
{"Namespace" : "aws:elb:listener:80", "OptionName" : "ListenerProtocol", "Value" : "HTTP" },
{"Namespace" : "aws:elb:listener:80", "OptionName" : "InstancePort", "Value" : "80" },
{"Namespace" : "aws:elb:listener:80", "OptionName" : "InstanceProtocol", "Value" : "HTTP" },
{"Namespace" : "aws:elb:listener:80", "OptionName" : "ListenerEnabled", "Value" : { "Ref" : "loadbalancerDefaultListenerEnabled" }},
{"Namespace" : "aws:elb:listener:443", "OptionName" : "ListenerProtocol", "Value" : "HTTPS" },
{"Namespace" : "aws:elb:listener:443", "OptionName" : "InstancePort", "Value" : "80" },
{"Namespace" : "aws:elb:listener:443", "OptionName" : "InstanceProtocol", "Value" : "HTTP" },
{"Namespace" : "aws:elb:listener:443", "OptionName" : "SSLCertificateId", "Value" : { "Ref" : "loadbalancerSecureListenerCertificateId" }},
{"Namespace" : "aws:elb:listener:443", "OptionName" : "ListenerEnabled", "Value" : { "Ref" : "loadbalancerSecureListenerEnabled" }}
]
}
}
Expand Down
Loading

0 comments on commit d704a96

Please sign in to comment.