You've already forked golang-saas-starter-kit
mirror of
https://github.com/raseels-repos/golang-saas-starter-kit.git
synced 2025-08-08 22:36:41 +02:00
fix deploy script
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
"awslogs-group": "{AWS_LOGS_GROUP}",
|
"awslogs-group": "{AWS_LOGS_GROUP}",
|
||||||
"awslogs-region": "{AWS_REGION}",
|
"awslogs-region": "{AWS_REGION}",
|
||||||
"awslogs-stream-prefix": "ecs",
|
"awslogs-stream-prefix": "ecs",
|
||||||
"awslogs-datetime-format": "%Y-%m-%d %H:%M:%S.%f"
|
"awslogs-datetime-format": "%Y/%m/%d %H:%M:%S.%L"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"portMappings": [
|
"portMappings": [
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
"awslogs-group": "{AWS_LOGS_GROUP}",
|
"awslogs-group": "{AWS_LOGS_GROUP}",
|
||||||
"awslogs-region": "{AWS_REGION}",
|
"awslogs-region": "{AWS_REGION}",
|
||||||
"awslogs-stream-prefix": "ecs",
|
"awslogs-stream-prefix": "ecs",
|
||||||
"awslogs-datetime-format": "%Y-%m-%d %H:%M:%S.%f"
|
"awslogs-datetime-format": "%Y/%m/%d %H:%M:%S.%L"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"portMappings": [
|
"portMappings": [
|
||||||
|
@@ -96,6 +96,10 @@ func RegisterEcsServiceTasksRoute53(log *log.Logger, awsSession *session.Session
|
|||||||
return errors.Wrapf(err, "failed to list tasks for cluster '%s' service '%s'", ecsClusterName, ecsServiceName)
|
return errors.Wrapf(err, "failed to list tasks for cluster '%s' service '%s'", ecsClusterName, ecsServiceName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(servceTaskRes.TaskArns) == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
taskRes, err := svc.DescribeTasks(&ecs.DescribeTasksInput{
|
taskRes, err := svc.DescribeTasks(&ecs.DescribeTasksInput{
|
||||||
Cluster: aws.String(ecsClusterName),
|
Cluster: aws.String(ecsClusterName),
|
||||||
Tasks: servceTaskRes.TaskArns,
|
Tasks: servceTaskRes.TaskArns,
|
||||||
@@ -148,6 +152,10 @@ func RegisterEcsServiceTasksRoute53(log *log.Logger, awsSession *session.Session
|
|||||||
time.Sleep((time.Duration(a) * time.Second * 10) * time.Duration(a))
|
time.Sleep((time.Duration(a) * time.Second * 10) * time.Duration(a))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(networkInterfaceIds) == 0 {
|
||||||
|
return errors.New("Unable to update public IPs. No network interfaces found.")
|
||||||
|
}
|
||||||
|
|
||||||
log.Println("Get public IPs for network interface IDs.")
|
log.Println("Get public IPs for network interface IDs.")
|
||||||
var publicIps []string
|
var publicIps []string
|
||||||
for a := 0; a <= 3; a++ {
|
for a := 0; a <= 3; a++ {
|
||||||
@@ -202,7 +210,11 @@ func RegisterEcsServiceTasksRoute53(log *log.Logger, awsSession *session.Session
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add all the A record names with the same set of public IPs.
|
// Add all the A record names with the same set of public IPs.
|
||||||
|
addedNames := make(map[string]bool)
|
||||||
for _, aName := range aNames {
|
for _, aName := range aNames {
|
||||||
|
if addedNames[aName] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
log.Printf("\t\tAdd A record for '%s'.\n", aName)
|
log.Printf("\t\tAdd A record for '%s'.\n", aName)
|
||||||
|
|
||||||
input.ChangeBatch.Changes = append(input.ChangeBatch.Changes, &route53.Change{
|
input.ChangeBatch.Changes = append(input.ChangeBatch.Changes, &route53.Change{
|
||||||
@@ -214,6 +226,7 @@ func RegisterEcsServiceTasksRoute53(log *log.Logger, awsSession *session.Session
|
|||||||
Type: aws.String("A"),
|
Type: aws.String("A"),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
addedNames[aName] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := svc.ChangeResourceRecordSets(input)
|
_, err := svc.ChangeResourceRecordSets(input)
|
||||||
|
@@ -234,4 +234,11 @@ instance will be a dedicated host since we need it always up and running, thus i
|
|||||||
Once complete, restart the runner.
|
Once complete, restart the runner.
|
||||||
```bash
|
```bash
|
||||||
sudo gitlab-runner restart
|
sudo gitlab-runner restart
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
```bash
|
||||||
|
go run main.go deploy -service=web-app -env=dev -enable_https=true -primary_host=example.saasstartupkit.com -host_names=example.saasstartupkit.com,dev.example.saasstartupkit.com -private_bucket=saas-starter-kit-private -public_bucket=saas-starter-kit-public -public_bucket_cloudfront=true -static_files_s3=true -static_files_img_resize=1 -recreate_service=0
|
||||||
|
```
|
Reference in New Issue
Block a user