Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
azure: add build instructions
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
  • Loading branch information
vsoch committed Dec 27, 2024
commit 06c4d5bbe2fc9bb3882c28c70802e701e5ceedff
38 changes: 38 additions & 0 deletions tutorial/azure/build/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Build Packer Images

Note that I needed to do this build from a cloud shell, so clone and then:

```bash
git clone https://github.com/converged-computing/flux-tutorials
flux-tutorials/tutorial/azure/build
```

And install packer

```bash
wget https://releases.hashicorp.com/packer/1.11.2/packer_1.11.2_linux_amd64.zip
unzip packer_1.11.2_linux_amd64.zip
mkdir -p ./bin
mv ./packer ./bin/
export PATH=$(pwd)/bin:$PATH
```

Get your account information for azure as follows:

```bash
az account show
```

And export variables in the following format. Note that the resource group needs to actually exist - I created mine in the console UI.

```bash
export AZURE_SUBSCRIPTION_ID=xxxxxxxxx
export AZURE_TENANT_ID=xxxxxxxxxxx
export AZURE_RESOURCE_GROUP_NAME=packer-testing
```

Then build!

```bash
make
```
8 changes: 5 additions & 3 deletions tutorial/azure/build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ sudo mkdir -p /var/run/munge && \
sudo chmod 600 /etc/munge/munge.key

# Make the flux run directory
mkdir -p /home/azureuser/run/flux
ls /home
whoami
sudo mkdir -p /home/azureuser/run/flux
sudo chown azureuser /home/azureuser

# Flux core
wget https://github.com/flux-framework/flux-core/releases/download/v0.68.0/flux-core-0.68.0.tar.gz && \
Expand Down Expand Up @@ -203,8 +206,6 @@ flux keygen /tmp/curve.cert && \
sudo rm -rf /opt/flux

# Install Singularity
cd /opt

# flux start mpirun -n 6 singularity exec singularity-mpi_mpich.sif /opt/mpitest
sudo apt-get update && sudo apt-get install -y libseccomp-dev libglib2.0-dev cryptsetup \
libfuse-dev \
Expand Down Expand Up @@ -232,6 +233,7 @@ sudo apt-get install -y \
zlib1g-dev

# install go
cd /tmp
wget https://go.dev/dl/go1.21.0.linux-${ORAS_ARCH}.tar.gz
tar -xvf go1.21.0.linux-${ORAS_ARCH}.tar.gz
sudo mv go /usr/local && rm go1.21.0.linux-${ORAS_ARCH}.tar.gz
Expand Down
19 changes: 13 additions & 6 deletions tutorial/azure/build/flux-build.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,28 @@ variable client_secret {

variable subscription_id {
type = string
default = null
default = env("AZURE_SUBSCRIPTION_ID")
}

variable tenant_id {
type = string
default = null
default = env("AZURE_TENANT_ID")
}

variable "image_resource_group_name" {
description = "Name of the resource group in which the Packer image will be created"
default = "myPackerImages"
default = env("AZURE_RESOURCE_GROUP_NAME")
}

# az vm image list --publisher microsoft-dsvm --offer ubuntu-hpc --output table --all
# x64 ubuntu-hpc microsoft-dsvm 2204-preview-ndv5 microsoft-dsvm:ubuntu-hpc:2204-preview-ndv5:22.04.2023080201 22.04.2023080201
source "azure-arm" "builder" {
client_id = var.client_id
client_secret = var.client_secret

# Uncomment if you aren't using managed identity (in cloud shell)
# client_id = var.client_id
# client_secret = var.client_secret
# And comment this line (or set to false)
use_azure_cli_auth = true
image_offer = "ubuntu-hpc"
image_publisher = "microsoft-dsvm"
image_sku = "2204-preview-ndv5"
Expand All @@ -45,7 +49,10 @@ source "azure-arm" "builder" {
os_type = "Linux"
subscription_id = var.subscription_id
tenant_id = var.tenant_id
vm_size = "Standard_DS2_v2"
# If you aren't sure about size, put something wrong :)
# You will need to have quota for this family, and the location
vm_size = "Standard_HB120-96rs_v3"
ssh_username = "azureuser"
azure_tags = {
"flux" : "0.68.0",
}
Expand Down