Skip to content

Commit

Permalink
Merge pull request #1 from timothymeyers/initial-container-builds
Browse files Browse the repository at this point in the history
Initial container builds
  • Loading branch information
timothymeyers authored Jan 25, 2024
2 parents 70c2b69 + 9227f40 commit 57d1633
Show file tree
Hide file tree
Showing 5 changed files with 262 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Use the specified image
FROM mcr.microsoft.com/devcontainers/universal:2

# Install Azure CLI
RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash

# Set the default shell to bash rather than sh
ENV SHELL /bin/bash
6 changes: 6 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"image": "mcr.microsoft.com/devcontainers/universal:2",
"features": {
"ghcr.io/devcontainers/features/azure-cli:1": {}
}
}
50 changes: 50 additions & 0 deletions .github/workflows/build-az-hop-container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# A GitHub Action Workflow to build the Azure HOP container image when there are new pushes to the main branch

name: Build Azure Hop Container
on:
push:
branches:
- main
pull_request:
branches:
- main

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
jobs:
build-and-push-image:
runs-on: ubuntu-latest
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write
#
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
52 changes: 52 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Using the ubuntu 22.04 image, create a dockerfile that checks out az-hop's source code into /az-hop

FROM ubuntu:22.04
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=America/New_York \
DEBIAN_FRONTEND=noninteractive

LABEL author ="Tim Meyers"
LABEL version ="0.1"
LABEL email ="[email protected]"

ENV AZ_HOP_VERSION="v1.0.40" \
AZ_HOP_BRANCH="main" \
AZ_HOP_REPO="https://github.com/Azure/az-hop.git"

# Set the default shell to bash rather than sh
ENV SHELL /bin/bash

# Install dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
ca-certificates \
apt-transport-https \
lsb-release \
gnupg \
git \
jq \
unzip \
wget \
vim \
zip \
&& rm -rf /var/lib/apt/lists/*

# Install Azure CLI
RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash

RUN git clone --branch ${AZ_HOP_BRANCH} ${AZ_HOP_REPO} /az-hop

# Set the working directory to /az-hop
WORKDIR /az-hop
COPY ./config/ /az-hop

# install az-hop's helper tools
RUN ./toolset/scripts/install.sh

# Add a non-root user azhopinstaller with an explicit UID/GID and add permissions to access the /az-hop folder
RUN groupadd --gid 1000 azhopinstaller \
&& useradd --uid 1000 --gid azhopinstaller --shell /bin/bash --create-home azhopinstaller
RUN chown -R azhopinstaller:azhopinstaller /az-hop

USER azhopinstaller
146 changes: 146 additions & 0 deletions config/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
---
# yaml-language-server: $schema=config.schema.json

# azure location name as returned by the command : az account list-locations -o table
location: eastus
# Name of the resource group to create all resources in
resource_group: azhop-rg

# Define an Azure Netapp Files (ANF) account, single pool and volume
anf:
create: true
# Size of the ANF pool and unique volume (min: 4TB, max: 100TB)
homefs_size_tb: 1
# Service level of the ANF volume, can be: Standard, Premium, Ultra
homefs_service_level: Standard


# These mounts will be listed in the Files menu of the OnDemand portal and automatically mounted on all compute nodes and remote desktop nodes
mounts:
# mount settings for the user home directory
home: # This home name can't be changed
type: anf # anf or azurefiles, default to anf. One of the two should be defined in order to mount the home directory
mountpoint: /anfhome # /sharedhome for example
server: '{{anf_home_ip}}' # Specify an existing NFS server name or IP, when using the ANF built in use '{{anf_home_ip}}'
export: '{{anf_home_path}}' # Specify an existing NFS export directory, when using the ANF built in use '{{anf_home_path}}'
options: '{{anf_home_opts}}' # Specify the mount options. Default to rw,hard,rsize=262144,wsize=262144,vers=3,tcp,_netdev

# name of the admin account
admin_user: hpcadmin
# Network
network:
vnet:
name: hpcvnet
address_space: "10.0.0.0/23"
subnets:
# All values below are the default values
frontend:
address_prefixes: "10.0.0.0/29"
admin:
address_prefixes: "10.0.0.16/28"
netapp:
address_prefixes: "10.0.0.32/28"
ad:
address_prefixes: "10.0.0.8/29"
compute:
address_prefixes: "10.0.1.0/24"

# Base image configuration. Can be either an image reference or an image_id from the image registry or a custom managed image
linux_base_image: "OpenLogic:CentOS:7_9-gen2:latest" # publisher:offer:sku:version or image_id
windows_base_image: "MicrosoftWindowsServer:WindowsServer:2019-Datacenter-smalldisk:latest" # publisher:offer:sku:version or image_id

# Jumpbox VM configuration, only needed when deploying thru a public IP
jumpbox: # rename this to deployer when using bicep if you want to use the deployer VM concept
vm_size: Standard_B2ms
# Active directory VM configuration
ad:
vm_size: Standard_B2ms
# On demand VM configuration
ondemand:
vm_size: Standard_D4s_v5
# Grafana VM configuration
grafana:
vm_size: Standard_B2ms
# Scheduler VM configuration
scheduler:
vm_size: Standard_B2ms
# CycleCloud VM configuration
cyclecloud:
vm_size: Standard_B2ms

# List of users to be created on this environment
users:
# name: username - must be less than 20 characters
# uid: uniqueid
# groups: list of groups the user belongs to
- { name: clusteradmin, uid: 10001, groups: [5001, 5002] }
- { name: hpcuser, uid: 10002 }

usergroups:
# These groups can�~@~Yt be changed
- name: Domain Users # All users will be added to this one by default
gid: 5000
- name: az-hop-admins
gid: 5001
description: "For users with azhop admin privileges"
- name: az-hop-localadmins
gid: 5002
description: "For users with sudo right or local admin right on nodes"

# scheduler to be installed and configured (openpbs, slurm)
queue_manager: slurm

# Specific SLURM configuration
slurm:
# Enable SLURM accounting, this will create a SLURM accounting database in a managed MariaDB server instance
accounting_enabled: false
# SLURM version to install. Currently supported: only 20.11.9 and 22.05.3.
slurm_version: 20.11.9
# Name of the SLURM cluster for accounting (optional, default to 'slurm')
# WARNING: changing this value on a running cluster will cause slurmctld to fail to start. This is a
# safety check to prevent accounting errors. To override, remove /var/spool/slurmd/clustername
cluster_name: slurm_azhop

# List of queues (node arrays in Cycle) to be defined
# don't use queue names longer than 8 characters in order to leave space for node suffix, as hostnames are limited to 15 chars due to domain join and NETBIOS constraints.
queues:
- name: htc
vm_size: Standard_F2s_v2
max_core_count: 8 #128
image: azhpc:azhop-compute:centos-7_9:latest
ColocateNodes: false
- name: hpc
vm_size: Standard_HB120rs_v3
max_core_count: 16 #480
image: azhpc:azhop-compute:centos-7_9:latest
EnableAcceleratedNetworking: true
# Queue dedicated to GPU remote viz nodes. This name is fixed and can't be changed
- name: viz3d
vm_size: Standard_NV12s_v3
max_core_count: 2 #24
image: azhpc:azhop-desktop:centos-7_9:latest
ColocateNodes: false
EnableAcceleratedNetworking: true
# Queue dedicated to share GPU remote viz nodes. This name is fixed and can't be changed
- name: largeviz3d
vm_size: Standard_NV48s_v3
max_core_count: 4 #48
image: azhpc:azhop-desktop:centos-7_9:latest
ColocateNodes: false
EnableAcceleratedNetworking: true
# Queue dedicated to non GPU remote viz nodes. This name is fixed and can't be changed
- name: viz
vm_size: Standard_D8s_v5
max_core_count: 4 #32
image: azhpc:azhop-desktop:centos-7_9:latest
ColocateNodes: false
EnableAcceleratedNetworking: true

# Application settings
applications:
bc_codeserver:
enabled: true
bc_jupyter:
enabled: true
144,1 Bot 45,1 60%

0 comments on commit 57d1633

Please sign in to comment.