Skip to content

Commit

Permalink
[images] build based on ubuntu24.04
Browse files Browse the repository at this point in the history
As part of our work in scylladb/scylla-enterprise#4111

Updating our Images to the latest LTS Ubuntu

Fixes: #527
  • Loading branch information
yaronkaikov committed Jul 17, 2024
1 parent 4694de5 commit fcfa681
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 27 deletions.
8 changes: 4 additions & 4 deletions packer/build_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ DIR=$(dirname $(readlink -f "$0"))
source "$DIR"/../SCYLLA-VERSION-GEN

CREATION_TIMESTAMP=$(date -u '+%FT%H-%M-%S')
OPERATING_SYSTEM="ubuntu22.04"
OPERATING_SYSTEM="ubuntu24.04"
EXIT_STATUS=0
DRY_RUN=false
DEBUG=false
Expand Down Expand Up @@ -257,13 +257,13 @@ if [ "$TARGET" = "aws" ]; then
arch="$ARCH"
case "$arch" in
"x86_64")
SOURCE_AMI_FILTER="ubuntu-minimal/images/hvm-ssd/ubuntu-jammy-22.04-amd64*"
SOURCE_AMI_FILTER="ubuntu-minimal/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64*"
if [ -z "$INSTANCE_TYPE" ]; then
INSTANCE_TYPE="c4.xlarge"
fi
;;
"aarch64")
SOURCE_AMI_FILTER="ubuntu-minimal/images/hvm-ssd/ubuntu-jammy-22.04-arm64*"
SOURCE_AMI_FILTER="ubuntu-minimal/images/hvm-ssd-gp3/ubuntu-noble-24.04-arm64*"
if [ -z "$INSTANCE_TYPE" ]; then
INSTANCE_TYPE="im4gn.2xlarge"
fi
Expand All @@ -283,7 +283,7 @@ if [ "$TARGET" = "aws" ]; then
PACKER_ARGS+=(-var scylla_ami_description="${SCYLLA_AMI_DESCRIPTION:0:255}")
elif [ "$TARGET" = "gce" ]; then
SSH_USERNAME=ubuntu
SOURCE_IMAGE_FAMILY="ubuntu-minimal-2204-lts"
SOURCE_IMAGE_FAMILY="ubuntu-minimal-2404-lts-amd64"

PACKER_ARGS+=(-var source_image_family="$SOURCE_IMAGE_FAMILY")
elif [ "$TARGET" = "azure" ]; then
Expand Down
18 changes: 2 additions & 16 deletions packer/scylla.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@
"managed_image_name": "{{user `image_name`| clean_resource_name}}",
"os_type": "Linux",
"image_publisher": "Canonical",
"image_offer": "0001-com-ubuntu-minimal-jammy",
"image_sku": "minimal-22_04-lts-gen2",
"image_offer": "ubuntu-24_04-lts-daily",
"image_sku": "minimal",
"azure_tags": {
"scylla_version": "{{user `scylla_full_version`}}",
"scylla_machine_image_version": "{{user `scylla_machine_image_version`}}",
Expand All @@ -171,20 +171,6 @@
}
],
"provisioners": [
{
"type": "shell",
"inline": [
"if [ {{build_name}} = aws -o {{build_name}} = azure ]; then sudo DEBIAN_FRONTEND=noninteractive apt purge -y linux-{{build_name}}* linux-headers-{{build_name}}* linux-image*{{build_name}}* linux-modules*-{{build_name}}* && sudo DEBIAN_FRONTEND=noninteractive sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y linux-{{build_name}}-lts-22.04 && sudo reboot; fi"
],
"expect_disconnect": true
},
{
"type": "shell",
"inline": [
"if [ {{build_name}} = gce ]; then sudo DEBIAN_FRONTEND=noninteractive apt purge -y linux-gcp* linux-headers-gcp* linux-image*gcp* linux-modules*-gcp* && sudo DEBIAN_FRONTEND=noninteractive sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y linux-gcp-lts-22.04 && sudo reboot; fi"
],
"expect_disconnect": true
},
{
"destination": "/home/{{user `ssh_username`}}/",
"source": "files/",
Expand Down
13 changes: 6 additions & 7 deletions packer/scylla_install_image
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ if __name__ == '__main__':
print('Error: need to specify --localdeb or --repo/--repo-for-install')
sys.exit(1)

run('apt-get update --allow-insecure-repositories -y', shell=True, check=True)
run('apt-get install -y gnupg2', shell=True, check=True)
run(f'mkdir -p {apt_keys_dir}; gpg --homedir /tmp --no-default-keyring --keyring {apt_keys_dir}/scylladb.gpg '
f'--keyserver hkp://keyserver.ubuntu.com:80 --recv-keys d0a112e067426ab2 491c93b9de7496a7', shell=True, check=True)

Expand All @@ -77,7 +79,7 @@ if __name__ == '__main__':
run('apt-get update --allow-insecure-repositories -y', shell=True, check=True)
run('apt-get full-upgrade -y', shell=True, check=True)
run('apt-get purge -y apport python3-apport fuse', shell=True, check=True)
run('apt-get install -y systemd-coredump vim.tiny nload nmap ncat tmux jq python3-boto xfsprogs mdadm initramfs-tools', shell=True, check=True)
run('apt-get install -y systemd-coredump vim.tiny nload nmap ncat tmux jq python3-boto xfsprogs mdadm initramfs-tools ethtool', shell=True, check=True)
run(f'apt-get install -y --auto-remove --allow-unauthenticated {args.product}-machine-image {args.product}-server-dbg', shell=True, check=True)

os.remove('/etc/apt/sources.list.d/scylla_install.list')
Expand All @@ -92,16 +94,13 @@ if __name__ == '__main__':
run('apt-get purge -y accountsservice', shell=True, check=True)
run('apt-get purge -y acpid motd-news-config fwupd-signed', shell=True, check=True)
run('apt-get purge -y udisks2', shell=True, check=True)
# cannot remove policykit since add-apt-repository depends on that,
# so just disable the service
run('systemctl disable polkit.service', shell=True, check=True)

# drop packages does not needed anymore
# drop packages does not need anymore
run('apt-get autoremove --purge -y', shell=True, check=True)

if args.target_cloud == 'aws':
run('apt-get install -y pip', shell=True, check=True)
run('pip install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-2.0-18.tar.gz', shell=True, check=True)
run('apt-get install -y pipx', shell=True, check=True)
run('pipx install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-2.0-18.tar.gz', shell=True, check=True)

# install .deb version of ssm-agent since we dropped snapd version
run(f'curl -L -o /tmp/amazon-ssm-agent.deb https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/debian_{deb_arch()}/amazon-ssm-agent.deb', shell=True, check=True)
Expand Down

0 comments on commit fcfa681

Please sign in to comment.