From 8d1b78365783eea08063aa11efcec9080ad7c00c Mon Sep 17 00:00:00 2001 From: Murat Ugur Eminoglu Date: Fri, 26 Apr 2024 11:16:20 +0300 Subject: [PATCH 1/5] Refactor CF template for Ubuntu 22.04 --- cloudformation/antmedia-aws-autoscale-template.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudformation/antmedia-aws-autoscale-template.yaml b/cloudformation/antmedia-aws-autoscale-template.yaml index 6c46c9a1..c0aec616 100644 --- a/cloudformation/antmedia-aws-autoscale-template.yaml +++ b/cloudformation/antmedia-aws-autoscale-template.yaml @@ -4,7 +4,7 @@ Description: >- If you have any questions, please just drop a line to contact (at) antmedia.io Parameters: VpcCidrBlock: - Description: 'CIDR value for Wavelength Network' + Description: 'CIDR value for Network' Type: String MinLength: '9' MaxLength: '18' From 5e8fd88698cdc0a6bfa653029f5af0277be94015 Mon Sep 17 00:00:00 2001 From: Murat Ugur Eminoglu Date: Fri, 26 Apr 2024 11:17:51 +0300 Subject: [PATCH 2/5] Update Lambda runtime --- cloudformation/antmedia-aws-autoscale-template.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cloudformation/antmedia-aws-autoscale-template.yaml b/cloudformation/antmedia-aws-autoscale-template.yaml index c0aec616..8fe45d7f 100644 --- a/cloudformation/antmedia-aws-autoscale-template.yaml +++ b/cloudformation/antmedia-aws-autoscale-template.yaml @@ -292,7 +292,7 @@ Resources: AMSGetLatestAMI: Type: AWS::Lambda::Function Properties: - Runtime: python3.11 + Runtime: python3.12 Handler: index.handler Role: !Sub ${DescribeImagesRole.Arn} Timeout: 60 @@ -326,7 +326,7 @@ Resources: UbuntuGetLatestAMI: Type: AWS::Lambda::Function Properties: - Runtime: python3.11 + Runtime: python3.12 Handler: index.handler Role: !Sub ${DescribeImagesRole.Arn} Timeout: 60 From ef890deb641cc541819d6a76720002fb10e5fe47 Mon Sep 17 00:00:00 2001 From: Murat Ugur Eminoglu Date: Fri, 26 Apr 2024 11:23:05 +0300 Subject: [PATCH 3/5] Update helper script (cfn) --- .../antmedia-aws-autoscale-template.yaml | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/cloudformation/antmedia-aws-autoscale-template.yaml b/cloudformation/antmedia-aws-autoscale-template.yaml index 8fe45d7f..8e84c894 100644 --- a/cloudformation/antmedia-aws-autoscale-template.yaml +++ b/cloudformation/antmedia-aws-autoscale-template.yaml @@ -569,15 +569,14 @@ Resources: UserData: Fn::Base64: !Sub | #!/bin/bash - touch /usr/local/antmedia/conf/initialized bash /usr/local/antmedia/change_server_mode.sh cluster ${DBInstance.PrivateIp} apt-get update - apt-get install -y python3-pip - apt-get install -y python3-setuptools + sudo apt-get -y install python3-pip mkdir -p /opt/aws/bin - wget https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-latest.tar.gz - python3 -m easy_install --script-dir /opt/aws/bin aws-cfn-bootstrap-py3-latest.tar.gz - /opt/aws/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource OriginGroup --region ${AWS::Region} + sudo pip3 install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-latest.tar.gz + sudo ln -s /usr/local/init/ubuntu/cfn-hup /etc/init.d/cfn-hup + /usr/local/bin/cfn-init -v --stack ${AWS::StackName} --resource LaunchConfigOrigin --configsets setup --region ${AWS::Region} + /usr/local/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource OriginGroup --region ${AWS::Region} TagSpecifications: - ResourceType: instance Tags: @@ -648,12 +647,12 @@ Resources: touch /usr/local/antmedia/conf/initialized bash /usr/local/antmedia/change_server_mode.sh cluster ${DBInstance.PrivateIp} apt-get update - apt-get install -y python3-pip - apt-get install -y python3-setuptools + sudo apt-get -y install python3-pip mkdir -p /opt/aws/bin - wget https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-latest.tar.gz - python3 -m easy_install --script-dir /opt/aws/bin aws-cfn-bootstrap-py3-latest.tar.gz - /opt/aws/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource EdgeGroup --region ${AWS::Region} + sudo pip3 install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-latest.tar.gz + sudo ln -s /usr/local/init/ubuntu/cfn-hup /etc/init.d/cfn-hup + /usr/local/bin/cfn-init -v --stack ${AWS::StackName} --resource LaunchConfigEdge --configsets setup --region ${AWS::Region} + /usr/local/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource EdgeGroup --region ${AWS::Region} TagSpecifications: - ResourceType: instance Tags: From 1401f26ccbbdfd462bf7024cde0c9a7f76881f4e Mon Sep 17 00:00:00 2001 From: Murat Ugur Eminoglu Date: Fri, 26 Apr 2024 11:46:18 +0300 Subject: [PATCH 4/5] Update MongoDB OS --- cloudformation/antmedia-aws-autoscale-template.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudformation/antmedia-aws-autoscale-template.yaml b/cloudformation/antmedia-aws-autoscale-template.yaml index 8e84c894..a3edd256 100644 --- a/cloudformation/antmedia-aws-autoscale-template.yaml +++ b/cloudformation/antmedia-aws-autoscale-template.yaml @@ -380,7 +380,7 @@ Resources: Properties: ServiceToken: !Sub ${UbuntuGetLatestAMI.Arn} Owner: "099720109477" - Name: "ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*" + Name: "ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*" Architecture: "x86_64" AntMediaVPC: From dd35956482694c9122ca6a1475ae4285605e2efe Mon Sep 17 00:00:00 2001 From: Murat Ugur Eminoglu Date: Fri, 26 Apr 2024 18:59:49 +0300 Subject: [PATCH 5/5] Fix cfn issue --- .../antmedia-aws-autoscale-template.yaml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/cloudformation/antmedia-aws-autoscale-template.yaml b/cloudformation/antmedia-aws-autoscale-template.yaml index a3edd256..66ee6c40 100644 --- a/cloudformation/antmedia-aws-autoscale-template.yaml +++ b/cloudformation/antmedia-aws-autoscale-template.yaml @@ -569,13 +569,13 @@ Resources: UserData: Fn::Base64: !Sub | #!/bin/bash + touch /usr/local/antmedia/conf/initialized bash /usr/local/antmedia/change_server_mode.sh cluster ${DBInstance.PrivateIp} apt-get update sudo apt-get -y install python3-pip mkdir -p /opt/aws/bin sudo pip3 install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-latest.tar.gz sudo ln -s /usr/local/init/ubuntu/cfn-hup /etc/init.d/cfn-hup - /usr/local/bin/cfn-init -v --stack ${AWS::StackName} --resource LaunchConfigOrigin --configsets setup --region ${AWS::Region} /usr/local/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource OriginGroup --region ${AWS::Region} TagSpecifications: - ResourceType: instance @@ -646,12 +646,11 @@ Resources: #!/bin/bash touch /usr/local/antmedia/conf/initialized bash /usr/local/antmedia/change_server_mode.sh cluster ${DBInstance.PrivateIp} - apt-get update + sudo apt-get update sudo apt-get -y install python3-pip mkdir -p /opt/aws/bin sudo pip3 install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-latest.tar.gz sudo ln -s /usr/local/init/ubuntu/cfn-hup /etc/init.d/cfn-hup - /usr/local/bin/cfn-init -v --stack ${AWS::StackName} --resource LaunchConfigEdge --configsets setup --region ${AWS::Region} /usr/local/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource EdgeGroup --region ${AWS::Region} TagSpecifications: - ResourceType: instance @@ -902,13 +901,8 @@ Resources: Fn::Base64: !Sub | #!/bin/bash -xe - wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add - - echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list - sudo apt-get update - sudo apt-get install -y mongodb-org python3-pip python3-setuptools - sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mongod.conf - systemctl enable mongod - systemctl restart mongod + wget -P /tmp/ https://raw.githubusercontent.com/ant-media/Scripts/master/install_mongodb.sh + bash /tmp/install_mongodb.sh Outputs: