Skip to content
Snippets Groups Projects
Commit dcc0d4f3 authored by baldwinlouie's avatar baldwinlouie Committed by Yas Naoi
Browse files

Issue #3518837 by yas, baldwinlouie: Update the AMI list forUbuntu 24.04LTS in amis.yaml

parent 6178935c
No related branches found
No related tags found
1 merge request!2336- Updating AMIs to Ubuntu 24.04LTS.
Pipeline #480696 passed
...@@ -25,6 +25,7 @@ Metadata: ...@@ -25,6 +25,7 @@ Metadata:
- DrupalPassword - DrupalPassword
- DrupalEmail - DrupalEmail
- CloudOrchestratorVersion - CloudOrchestratorVersion
- GitHubToken
ParameterLabels: ParameterLabels:
StackPrefix: StackPrefix:
default: Stack Prefix default: Stack Prefix
...@@ -44,6 +45,8 @@ Metadata: ...@@ -44,6 +45,8 @@ Metadata:
default: EC2 instance type default: EC2 instance type
KeyName: KeyName:
default: EC2 key name default: EC2 key name
GitHubToken:
default: GitHub authentication token
Parameters: Parameters:
StackPrefix: StackPrefix:
Type: String Type: String
...@@ -149,6 +152,10 @@ Parameters: ...@@ -149,6 +152,10 @@ Parameters:
- 6.4.0 - 6.4.0
- 7.0.0 - 7.0.0
- 8.x-dev - 8.x-dev
GitHubToken:
Description: GitHub authentication token
Type: String
NoEcho: true
Resources: Resources:
IamRole: IamRole:
Type: AWS::CloudFormation::Stack Type: AWS::CloudFormation::Stack
...@@ -216,6 +223,8 @@ Resources: ...@@ -216,6 +223,8 @@ Resources:
Ref: DatabaseName Ref: DatabaseName
CloudOrchestratorVersion: CloudOrchestratorVersion:
Ref: CloudOrchestratorVersion Ref: CloudOrchestratorVersion
GitHubToken:
Ref: GitHubToken
Outputs: Outputs:
SSHAccess: SSHAccess:
Value: Value:
......
...@@ -52,6 +52,10 @@ Parameters: ...@@ -52,6 +52,10 @@ Parameters:
CloudOrchestratorVersion: CloudOrchestratorVersion:
Description: Version of the Cloud Orchestrator to install. Description: Version of the Cloud Orchestrator to install.
Type: String Type: String
GitHubToken:
Description: GitHub authentication token
Type: String
NoEcho: 'true'
Resources: Resources:
EC2: EC2:
Type: 'AWS::EC2::Instance' Type: 'AWS::EC2::Instance'
...@@ -85,7 +89,7 @@ Resources: ...@@ -85,7 +89,7 @@ Resources:
Fn::Base64: Fn::Base64:
Fn::Sub: Fn::Sub:
- | - |
#!/bin/bash -xe #!/bin/bash -e
HOME='/home/ubuntu' HOME='/home/ubuntu'
CO_DIR="$HOME/cloud_orchestrator" CO_DIR="$HOME/cloud_orchestrator"
...@@ -94,16 +98,16 @@ Resources: ...@@ -94,16 +98,16 @@ Resources:
# Basic package installation. # Basic package installation.
export DEBIAN_FRONTEND='noninteractive' export DEBIAN_FRONTEND='noninteractive'
# Add PHP 8 repository # Add PHP 8 repository
apt install software-properties-common #apt install software-properties-common
add-apt-repository ppa:ondrej/php #add-apt-repository ppa:ondrej/php
apt-get update -yq apt-get update -yq
apt-get upgrade -yq --with-new-pkgs apt-get upgrade -yq --with-new-pkgs
PHP_VERSION='8.1' PHP_VERSION=''
apt-get -yq install \ apt-get -yq install \
python3-pip python3-setuptools \ python3-pip python3-setuptools python3-venv \
php$PHP_VERSION-cli php$PHP_VERSION-mbstring php$PHP_VERSION-xml php$PHP_VERSION-gd \ php$PHP_VERSION-cli php$PHP_VERSION-mbstring php$PHP_VERSION-xml php$PHP_VERSION-gd \
php$PHP_VERSION-curl apt-transport-https ca-certificates \ php$PHP_VERSION-curl apt-transport-https ca-certificates \
curl software-properties-common \ curl software-properties-common \
...@@ -114,9 +118,13 @@ Resources: ...@@ -114,9 +118,13 @@ Resources:
sudo php -r "copy('https://getcomposer.org/installer', '/tmp/composer-setup.php');" sudo php -r "copy('https://getcomposer.org/installer', '/tmp/composer-setup.php');"
sudo php /tmp/composer-setup.php --install-dir /usr/local/bin --filename composer sudo php /tmp/composer-setup.php --install-dir /usr/local/bin --filename composer
# Add GitHub token to install Cloud Orchestrator.
sudo -u ubuntu composer config --global github-oauth.github.com "${GitHubToken}"
sudo -u ubuntu composer create-project "docomoinnovations/cloud_orchestrator:${CloudOrchestratorVersion}" "$CO_DIR" sudo -u ubuntu composer create-project "docomoinnovations/cloud_orchestrator:${CloudOrchestratorVersion}" "$CO_DIR"
sudo -u ubuntu composer -d "$CO_DIR" update sudo -u ubuntu composer -d "$CO_DIR" update
sudo chown -R ubuntu:ubuntu "$CO_DIR" sudo chown -R ubuntu:ubuntu "$CO_DIR"
# Quickly unset the token after the project is downloaded.
sudo -u ubuntu composer config --global --auth --unset github-oauth.github.com
# Setup private directories. # Setup private directories.
PRIVATE_FILE_DIR="$CO_DIR/files/private" PRIVATE_FILE_DIR="$CO_DIR/files/private"
...@@ -258,20 +266,23 @@ Resources: ...@@ -258,20 +266,23 @@ Resources:
cd /tmp cd /tmp
curl -O https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-latest.tar.gz curl -O https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-latest.tar.gz
cd /opt cd /opt
python3 -m venv /opt/aws-cfn-bootstrap
source /opt/aws-cfn-bootstrap/bin/activate
tar zxvf /tmp/aws-cfn-bootstrap-py3-latest.tar.gz tar zxvf /tmp/aws-cfn-bootstrap-py3-latest.tar.gz
cd aws-cfn-bootstrap-* cd aws-cfn-bootstrap-*
pip install -e . pip install -e .
ln -s $(pwd)/init/ubuntu/cfn-hup /etc/init.d/cfn-hup ln -s $(pwd)/init/ubuntu/cfn-hup /etc/init.d/cfn-hup
# sending success signal to CFn # sending success signal to CFn
/usr/local/bin/cfn-signal --exit-code=0 \ /opt/aws-cfn-bootstrap/bin/cfn-signal --exit-code=0 \
--resource=EC2 --stack=${CFnStackName} --region=${CFnStackRegion} --resource=EC2 --stack=${CFnStackName} --region=${CFnStackRegion}
- { - {
DatabaseName: !Ref DatabaseName, DatabaseName: !Ref DatabaseName,
CloudOrchestratorVersion: !Ref CloudOrchestratorVersion, CloudOrchestratorVersion: !Ref CloudOrchestratorVersion,
CFnStackName: !Ref AWS::StackName, CFnStackName: !Ref AWS::StackName,
CFnStackRegion: !Ref AWS::Region CFnStackRegion: !Ref AWS::Region,
GitHubToken: !Ref GitHubToken
} }
Tags: Tags:
- Key: Application - Key: Application
......
# Image IDs are retrieved from https://cloud-images.ubuntu.com/locator/ec2/ # Image IDs are retrieved from https://cloud-images.ubuntu.com/locator/ec2/
# The AMIs are base Ubuntu 20.04 LTS # The AMIs are base Ubuntu 24.04 LTS
Mappings: Mappings:
CloudOrchestrator: CloudOrchestrator:
af-south-1: af-south-1:
AMI: ami-030b8d2037063bab3 AMI: ami-08084b4d26338f0d5
ap-east-1: ap-east-1:
AMI: ami-0b981d9ee99b28eba AMI: ami-08b6ca95d71fa4766
ap-northeast-1: ap-northeast-1:
AMI: ami-088da9557aae42f39 AMI: ami-084eac2acfa10d153
ap-northeast-2: ap-northeast-2:
AMI: ami-0454bb2fefc7de534 AMI: ami-061b8c3dd6a50d8e3
ap-northeast-3: ap-northeast-3:
AMI: ami-096c4b6e0792d8c16 AMI: ami-0e504fe0e07281668
ap-south-1: ap-south-1:
AMI: ami-0851b76e8b1bce90b AMI: ami-0a12fecf99cd5840a
ap-southeast-1: ap-southeast-1:
AMI: ami-055d15d9cfddf7bd3 AMI: ami-0f0037ce710dc6f0f
ap-southeast-2: ap-southeast-2:
AMI: ami-0b7dcd6e6fd797935 AMI: ami-00f2e22f00f28578e
ap-southeast-3: ap-southeast-3:
AMI: ami-0a9c8e0ccf1d85f67 AMI: ami-0c47af55a6576c8b9
ca-central-1: ca-central-1:
AMI: ami-0aee2d0182c9054ac AMI: ami-0650b19fe0158ebdf
eu-central-1: eu-central-1:
AMI: ami-0d527b8c289b4af7f AMI: ami-0c4059cd09929aebe
eu-north-1: eu-north-1:
AMI: ami-092cce4a19b438926 AMI: ami-0f662eb5b549ec058
eu-south-1: eu-south-1:
AMI: ami-0d49110b200671cd8 AMI: ami-07699847e07b48200
eu-west-1: eu-west-1:
AMI: ami-08ca3fed11864d6bb AMI: ami-05718e63cb39fcdb1
eu-west-2: eu-west-2:
AMI: ami-0015a39e4b7c0966f AMI: ami-0e44ed0c2fff540d6
eu-west-3: eu-west-3:
AMI: ami-0c6ebbd55ab05f070 AMI: ami-0240d5c89b4dfba00
me-south-1: me-south-1:
AMI: ami-0f7b49dc4bc2b14cf AMI: ami-09aaed2f6eef1a088
sa-east-1: sa-east-1:
AMI: ami-090006f29ecb2d79a AMI: ami-0acd5a996a8c66e2c
us-east-1: us-east-1:
AMI: ami-04505e74c0741db8d AMI: ami-09eb231ad55c3963d
us-east-2: us-east-2:
AMI: ami-0fb653ca2d3203ac1 AMI: ami-0c262369dcdfc38a8
us-west-1: us-west-1:
AMI: ami-01f87c43e618bf8f0 AMI: ami-02f2920ba1d21ece8
us-west-2: us-west-2:
AMI: ami-0892d3c7ee96c0bf7 AMI: ami-0e847e970c9565775
Fn::Base64: Fn::Base64:
Fn::Sub: Fn::Sub:
- | - |
#!/bin/bash -xe #!/bin/bash -e
# Builds a Docker based Cloud Orchestrator distribution # Builds a Docker based Cloud Orchestrator distribution
...@@ -12,14 +12,14 @@ Fn::Base64: ...@@ -12,14 +12,14 @@ Fn::Base64:
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
# Add PHP 8 repository # Add PHP 8 repository
apt install software-properties-common #apt install software-properties-common
add-apt-repository ppa:ondrej/php #add-apt-repository ppa:ondrej/php
PHP_VERSION='8.1' PHP_VERSION=''
apt-get update -yq apt-get update -yq
apt-get upgrade -yq --with-new-pkgs apt-get upgrade -yq --with-new-pkgs
apt-get -yq install \ apt-get -yq install \
python3-pip python3-setuptools \ python3-pip python3-setuptools python3-venv \
php$PHP_VERSION-cli php$PHP_VERSION-mbstring php$PHP_VERSION-xml php$PHP_VERSION-gd php$PHP_VERSION-curl \ php$PHP_VERSION-cli php$PHP_VERSION-mbstring php$PHP_VERSION-xml php$PHP_VERSION-gd php$PHP_VERSION-curl \
apt-transport-https ca-certificates \ apt-transport-https ca-certificates \
curl software-properties-common \ curl software-properties-common \
...@@ -114,7 +114,12 @@ Fn::Base64: ...@@ -114,7 +114,12 @@ Fn::Base64:
sudo docker exec -w $DOCKER_DIR $CONTAINER_NAME sh -c "ln -s '$DOCKER_DIR/vendor/bin/drush' /usr/local/bin/" sudo docker exec -w $DOCKER_DIR $CONTAINER_NAME sh -c "ln -s '$DOCKER_DIR/vendor/bin/drush' /usr/local/bin/"
# Setup drush.yml and add EC2_IP as --uri # Setup drush.yml and add EC2_IP as --uri
EC2_IP=`curl http://169.254.169.254/latest/meta-data/public-ipv4` # Metadata only supports IMDSv2 now. A Token is needed.
TOKEN=$(curl -sX PUT "http://169.254.169.254/latest/api/token" \
-H "X-aws-ec2-metadata-token-ttl-seconds: 60")
EC2_IP=`curl -sH "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/public-ipv4`
mkdir $CO_DIR/drush mkdir $CO_DIR/drush
sudo tee -a $CO_DIR/drush/drush.yml >/dev/null << EOF sudo tee -a $CO_DIR/drush/drush.yml >/dev/null << EOF
options: options:
...@@ -133,7 +138,7 @@ Fn::Base64: ...@@ -133,7 +138,7 @@ Fn::Base64:
if [[ "${CloudOrchestratorVersion}" =~ $VERSION_REGEX ]]; then if [[ "${CloudOrchestratorVersion}" =~ $VERSION_REGEX ]]; then
# Install Cloud Orchestrator using Drush # Install Cloud Orchestrator using Drush
sudo docker exec -w $DOCKER_DIR $CONTAINER_NAME sh -c "drush si -y \ sudo docker exec -w $DOCKER_DIR $CONTAINER_NAME sh -c "drush si -y \
--db-url=\'mysql://${MySQLUserName}:${MySQLPassword}@${DatabaseEndpointAddress}:${DatabasePort}/${DatabaseName}\' \ --db-url='mysql://${MySQLUserName}:${MySQLPassword}@${DatabaseEndpointAddress}:${DatabasePort}/${DatabaseName}' \
--account-name='${DrupalUserName}' \ --account-name='${DrupalUserName}' \
--account-pass='${DrupalPassword}' \ --account-pass='${DrupalPassword}' \
--site-name='Cloud Orchestrator' \ --site-name='Cloud Orchestrator' \
...@@ -144,7 +149,7 @@ Fn::Base64: ...@@ -144,7 +149,7 @@ Fn::Base64:
cloud_orchestrator_module_configure_form.cloud_service_providers.vmware=vmware" cloud_orchestrator_module_configure_form.cloud_service_providers.vmware=vmware"
else else
sudo docker exec -w $DOCKER_DIR $CONTAINER_NAME sh -c "drush si -y \ sudo docker exec -w $DOCKER_DIR $CONTAINER_NAME sh -c "drush si -y \
--db-url=\'mysql://${MySQLUserName}:${MySQLPassword}@${DatabaseEndpointAddress}:${DatabasePort}/${DatabaseName}\' \ --db-url='mysql://${MySQLUserName}:${MySQLPassword}@${DatabaseEndpointAddress}:${DatabasePort}/${DatabaseName}' \
--account-name='${DrupalUserName}' \ --account-name='${DrupalUserName}' \
--account-pass='${DrupalPassword}' \ --account-pass='${DrupalPassword}' \
--site-name='Cloud Orchestrator' \ --site-name='Cloud Orchestrator' \
...@@ -196,13 +201,15 @@ Fn::Base64: ...@@ -196,13 +201,15 @@ Fn::Base64:
cd /tmp cd /tmp
curl -O https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-latest.tar.gz curl -O https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-latest.tar.gz
cd /opt cd /opt
python3 -m venv /opt/aws-cfn-bootstrap
source /opt/aws-cfn-bootstrap/bin/activate
tar zxvf /tmp/aws-cfn-bootstrap-py3-latest.tar.gz tar zxvf /tmp/aws-cfn-bootstrap-py3-latest.tar.gz
cd aws-cfn-bootstrap-* cd aws-cfn-bootstrap-*
pip install -e . pip install -e .
ln -s $(pwd)/init/ubuntu/cfn-hup /etc/init.d/cfn-hup ln -s $(pwd)/init/ubuntu/cfn-hup /etc/init.d/cfn-hup
# sending success signal to CFn # sending success signal to CFn
/usr/local/bin/cfn-signal --exit-code=0 \ /opt/aws-cfn-bootstrap/bin/cfn-signal --exit-code=0 \
--resource=EC2 --stack=${CFnStackName} --region=${CFnStackRegion} --resource=EC2 --stack=${CFnStackName} --region=${CFnStackRegion}
- MySQLUserName: - MySQLUserName:
......
...@@ -70,6 +70,7 @@ RUN { \ ...@@ -70,6 +70,7 @@ RUN { \
echo 'max_input_time = 600'; \ echo 'max_input_time = 600'; \
echo 'max_input_vars = 100000'; \ echo 'max_input_vars = 100000'; \
echo 'output_buffering = 4096'; \ echo 'output_buffering = 4096'; \
echo 'assert.active = Off'; \
} > /usr/local/etc/php/conf.d/extras.ini } > /usr/local/etc/php/conf.d/extras.ini
RUN { \ RUN { \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment