-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
125 additions
and
6 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
## Install basic tools | ||
echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selections | ||
sudo apt-get update | ||
sudo apt-get install -y cmake git build-essential wget ca-certificates curl unzip | ||
|
||
## Install Python3 | ||
sudo apt-get update | ||
sudo apt-get install -y python3 python3-pip python3-venv | ||
sudo pip3 install --break-system-packages 'pip>=23' 'wheel>=0.42' pydistcheck | ||
|
||
## Install Docker | ||
# Add Docker's official GPG key: | ||
sudo install -m 0755 -d /etc/apt/keyrings | ||
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc | ||
sudo chmod a+r /etc/apt/keyrings/docker.asc | ||
# Add the repository to Apt sources: | ||
echo \ | ||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ | ||
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ | ||
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | ||
sudo apt-get update | ||
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin | ||
# Allow users to use Docker without sudo | ||
sudo usermod -aG docker ubuntu | ||
|
||
# Start Docker daemon | ||
sudo systemctl is-active --quiet docker.service || sudo systemctl start docker.service | ||
sudo systemctl is-enabled --quiet docker.service || sudo systemctl enable docker.service | ||
sleep 10 # Docker daemon takes time to come up after installing | ||
sudo docker info | ||
sudo systemctl stop docker | ||
|
||
## Install AWS CLI v2 | ||
wget -nv https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip -O awscliv2.zip | ||
unzip -q awscliv2.zip | ||
sudo ./aws/install | ||
rm -rf ./aws/ ./awscliv2.zip | ||
|
||
## Install jq and yq | ||
sudo apt update && sudo apt install jq | ||
mkdir yq/ | ||
pushd yq/ | ||
wget -nv https://github.com/mikefarah/yq/releases/download/v4.44.3/yq_linux_arm64.tar.gz -O - | \ | ||
tar xz && sudo mv ./yq_linux_arm64 /usr/bin/yq | ||
popd | ||
rm -rf yq/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
packer { | ||
required_plugins { | ||
amazon = { | ||
source = "github.com/hashicorp/amazon" | ||
version = "~> 1" | ||
} | ||
} | ||
} | ||
|
||
locals { | ||
ami_name_prefix = "xgboost-ci" | ||
image_name = "RunsOn worker with Ubuntu 24.04 ARM64" | ||
region = "us-west-2" | ||
timestamp = regex_replace(timestamp(), "[- TZ:]", "") | ||
volume_size = 40 | ||
} | ||
|
||
data "amazon-ami" "aws-ubuntu-arm64" { | ||
filters = { | ||
name = "ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-arm64-server-*" | ||
root-device-type = "ebs" | ||
virtualization-type = "hvm" | ||
} | ||
most_recent = true | ||
owners = ["amazon"] | ||
} | ||
|
||
source "amazon-ebs" "runs-on-linux-arm64" { | ||
source_ami = "${data.amazon-ami.aws-ubuntu-arm64.id}" | ||
ami_name = "${local.ami_name_prefix}-runs-on-linux-arm64-${local.timestamp}" | ||
ami_description = "${local.image_name}" | ||
ami_regions = ["${local.region}"] | ||
ami_virtualization_type = "hvm" | ||
associate_public_ip_address = true | ||
communicator = "ssh" | ||
instance_type = "c6g.4xlarge" | ||
region = "${local.region}" | ||
ssh_timeout = "10m" | ||
ssh_username = "ubuntu" | ||
ssh_file_transfer_method = "sftp" | ||
user_data_file = "setup_ssh.sh" | ||
launch_block_device_mappings { | ||
device_name = "/dev/sda1" | ||
volume_size = "${local.volume_size}" | ||
volume_type = "gp3" | ||
delete_on_termination = true | ||
} | ||
aws_polling { # Wait up to 1 hour until the AMI is ready | ||
delay_seconds = 15 | ||
max_attempts = 240 | ||
} | ||
snapshot_tags = { | ||
Name = "${local.image_name}" | ||
BuildTime = "${local.timestamp}" | ||
} | ||
tags = { | ||
Name = "${local.image_name}" | ||
BuildTime = "${local.timestamp}" | ||
} | ||
} | ||
|
||
build { | ||
sources = ["source.amazon-ebs.runs-on-linux-arm64"] | ||
|
||
provisioner "shell" { | ||
script = "bootstrap.sh" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
systemctl start ssh |