Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove provisioning for portal.bigcz.org #3618

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 8 additions & 63 deletions deployment/cfn/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ class Application(StackNode):
'AppServerAutoScalingScheduleEndCapacity': ['global:AppServerAutoScalingScheduleEndCapacity'], # NOQA
'AppServerAutoScalingScheduleEndRecurrence': ['global:AppServerAutoScalingScheduleEndRecurrence'], # NOQA
'SSLCertificateARN': ['global:SSLCertificateARN'],
'BackwardCompatSSLCertificateARN':
['global:BackwardCompatSSLCertificateARN'],
'PublicSubnets': ['global:PublicSubnets', 'VPC:PublicSubnets'],
'PrivateSubnets': ['global:PrivateSubnets', 'VPC:PrivateSubnets'],
'PublicHostedZoneName': ['global:PublicHostedZoneName'],
Expand Down Expand Up @@ -190,12 +188,6 @@ def set_up_stack(self):
Description='ARN for a SSL certificate stored in IAM'
), 'SSLCertificateARN')

self.backward_compat_ssl_certificate_arn = self.add_parameter(
Parameter(
'BackwardCompatSSLCertificateARN', Type='String',
Description='ARN for a SSL certificate stored in IAM'
), 'BackwardCompatSSLCertificateARN')

self.public_subnets = self.add_parameter(Parameter(
'PublicSubnets', Type='CommaDelimitedList',
Description='A list of public subnets'
Expand Down Expand Up @@ -283,26 +275,16 @@ def set_up_stack(self):

app_server_lb_security_group, \
app_server_security_group = self.create_security_groups()
app_server_lb, \
backward_compat_app_server_lb = self.create_load_balancers(
app_server_lb_security_group)
app_server_lb = self.create_load_balancer(app_server_lb_security_group)

self.create_auto_scaling_resources(app_server_security_group,
app_server_lb,
backward_compat_app_server_lb)
app_server_lb)

self.add_output(Output('AppServerLoadBalancerEndpoint',
Value=GetAtt(app_server_lb, 'DNSName')))
self.add_output(Output('AppServerLoadBalancerHostedZoneNameID',
Value=GetAtt(app_server_lb,
'CanonicalHostedZoneNameID')))
self.add_output(Output('BackwardCompatAppServerLoadBalancerEndpoint',
Value=GetAtt(backward_compat_app_server_lb,
'DNSName')))
self.add_output(
Output('BackwardCompatAppServerLoadBalancerHostedZoneNameID',
Value=GetAtt(backward_compat_app_server_lb,
'CanonicalHostedZoneNameID')))

def get_recent_app_server_ami(self):
try:
Expand Down Expand Up @@ -375,12 +357,10 @@ def create_security_groups(self):

return app_server_lb_security_group, app_server_security_group

def create_load_balancers(self, app_server_lb_security_group):
def create_load_balancer(self, app_server_lb_security_group):
app_server_lb_name = 'elbAppServer'
backward_compat_app_server_lb_name = 'elbBackwardCompatAppServer'

return [
self.add_resource(elb.LoadBalancer(
return self.add_resource(elb.LoadBalancer(
app_server_lb_name,
ConnectionDrainingPolicy=elb.ConnectionDrainingPolicy(
Enabled=True,
Expand Down Expand Up @@ -410,43 +390,10 @@ def create_load_balancers(self, app_server_lb_security_group):
),
Subnets=Ref(self.public_subnets),
Tags=self.get_tags(Name=app_server_lb_name)
)),
self.add_resource(elb.LoadBalancer(
backward_compat_app_server_lb_name,
ConnectionDrainingPolicy=elb.ConnectionDrainingPolicy(
Enabled=True,
Timeout=300,
),
CrossZone=True,
SecurityGroups=[Ref(app_server_lb_security_group)],
Listeners=[
elb.Listener(
LoadBalancerPort='80',
InstancePort='80',
Protocol='HTTP',
),
elb.Listener(
LoadBalancerPort='443',
InstancePort='80',
Protocol='HTTPS',
SSLCertificateId=Ref(
self.backward_compat_ssl_certificate_arn)
)
],
HealthCheck=elb.HealthCheck(
Target='HTTP:80/health-check/',
HealthyThreshold='3',
UnhealthyThreshold='2',
Interval='30',
Timeout='5',
),
Subnets=Ref(self.public_subnets),
Tags=self.get_tags(Name=backward_compat_app_server_lb_name)
))]
))

def create_auto_scaling_resources(self, app_server_security_group,
app_server_lb,
backward_compat_app_server_lb):
app_server_lb):
self.add_condition('BlueCondition', Equals('Blue', Ref(self.color)))
self.add_condition('GreenCondition', Equals('Green', Ref(self.color)))

Expand Down Expand Up @@ -474,8 +421,7 @@ def create_auto_scaling_resources(self, app_server_security_group,
HealthCheckGracePeriod=600,
HealthCheckType='ELB',
LaunchConfigurationName=Ref(blue_app_server_launch_config),
LoadBalancerNames=[Ref(app_server_lb),
Ref(backward_compat_app_server_lb)],
LoadBalancerNames=[Ref(app_server_lb)],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we updated create_load_balancers to be singular on Line 360, let's be consistent. LoadBalancerNames should be made singular here as well, unless we foresee expanding this out to include more loadbalancers in the future - in which case, we should revert Line 360.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually LoadBalancerNames is a troposphere parameter, not in our control.

I do not foresee more load balancers being made for this, so will keep create_load_balancer as is.

MaxSize=Ref(self.app_server_auto_scaling_max),
MinSize=Ref(self.app_server_auto_scaling_min),
NotificationConfigurations=[
Expand Down Expand Up @@ -541,8 +487,7 @@ def create_auto_scaling_resources(self, app_server_security_group,
HealthCheckGracePeriod=600,
HealthCheckType='ELB',
LaunchConfigurationName=Ref(green_app_server_launch_config),
LoadBalancerNames=[Ref(app_server_lb),
Ref(backward_compat_app_server_lb)],
LoadBalancerNames=[Ref(app_server_lb)],
MaxSize=Ref(self.app_server_auto_scaling_max),
MinSize=Ref(self.app_server_auto_scaling_min),
NotificationConfigurations=[
Expand Down
27 changes: 0 additions & 27 deletions deployment/cfn/public_hosted_zone.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,12 @@ class PublicHostedZone(CustomActionNode):
INPUTS = {
'Region': ['global:Region'],
'PublicHostedZoneName': ['global:PublicHostedZoneName'],
'BackwardCompatPublicHostedZoneName':
['global:BackwardCompatPublicHostedZoneName'],
'AppServerLoadBalancerEndpoint':
['global:AppServerLoadBalancerEndpoint',
'Application:AppServerLoadBalancerEndpoint'],
'AppServerLoadBalancerHostedZoneNameID':
['global:AppServerLoadBalancerHostedZoneNameID',
'Application:AppServerLoadBalancerHostedZoneNameID'],
'BackwardCompatAppServerLoadBalancerEndpoint':
['global:BackwardCompatAppServerLoadBalancerEndpoint',
'Application:BackwardCompatAppServerLoadBalancerEndpoint'],
'BackwardCompatAppServerLoadBalancerHostedZoneNameID':
['global:BackwardCompatAppServerLoadBalancerHostedZoneNameID',
'Application:BackwardCompatAppServerLoadBalancerHostedZoneNameID'],
'StackType': ['global:StackType'],
'StackColor': ['global:StackColor'],
}
Expand All @@ -44,13 +36,6 @@ def action(self):
app_lb_hosted_zone_id = self.get_input(
'AppServerLoadBalancerHostedZoneNameID')

backward_compat_hosted_zone_name = self.get_input(
'BackwardCompatPublicHostedZoneName')
backward_compat_app_lb_endpoint = self.get_input(
'BackwardCompatAppServerLoadBalancerEndpoint')
backward_compat_app_lb_hosted_zone_id = self.get_input(
'BackwardCompatAppServerLoadBalancerHostedZoneNameID')

route53_conn = r53.connect_to_region(region,
profile_name=self.aws_profile)

Expand All @@ -65,18 +50,6 @@ def action(self):
failover='PRIMARY')
record_sets.commit()

backward_compat_hosted_zone = route53_conn.get_zone(
backward_compat_hosted_zone_name)
backward_compat_record_sets = r53.record.ResourceRecordSets(
route53_conn, backward_compat_hosted_zone.id)
backward_compat_record_sets.add_change(
'UPSERT', backward_compat_hosted_zone_name, 'A',
alias_hosted_zone_id=backward_compat_app_lb_hosted_zone_id,
alias_dns_name=backward_compat_app_lb_endpoint,
alias_evaluate_target_health=True, identifier='Primary',
failover='PRIMARY')
backward_compat_record_sets.commit()

s3_conn = s3.connect_to_region(region,
profile_name=self.aws_profile,
calling_format=OrdinaryCallingFormat())
Expand Down