From 622f005425920c20765571cdd485a844679578f2 Mon Sep 17 00:00:00 2001 From: Rodrigo Liberoff Date: Mon, 20 May 2024 11:16:02 +0200 Subject: [PATCH 1/5] Initial development --- install/install.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 install/install.sh diff --git a/install/install.sh b/install/install.sh new file mode 100755 index 0000000..80e064d --- /dev/null +++ b/install/install.sh @@ -0,0 +1,29 @@ +echo "" +set -e + +# GitHub Org and repo hosting AI Hub +GitHubOrg="azure" +GitHubRepo="aihub" + +AIHubRoot="./.aihub" + +# Set Github request authentication for basic authentication. +if [[ -n GITHUB_USER ]]; then + basicAuth=$(echo -n "$GITHUB_USER:$GITHUB_TOKEN" | base64) + githubHeader="Authorization: Basic $basicAuth" +else + githubHeader="" +fi + +echo "Installing AI Hub..." + +# Create Dapr Directory +echo "Creating AIHubRoot directory" +mkdir -p "AIHubRoot" 2>/dev/null +if [[ ! -d "AIHubRoot" ]]; then + echo "Warning: Please visit https://azure.github.io/aihub/docs/ for instructions on how to install without admin rights." + echo "Cannot create AIHubRoot" >&2 + exit 1 +fi + +latest_aihub=$(curl -H githubHeader https://api.github.com/repos/Azure/aihub/releases/latest | jq -r .tag_name) \ No newline at end of file From 287ca184c1763ef84aacf203700d38fcef1e79b2 Mon Sep 17 00:00:00 2001 From: Rodrigo Liberoff Date: Mon, 20 May 2024 14:19:44 +0200 Subject: [PATCH 2/5] Updated `.gitignore` to prevent synchronizing the `.aihub` installation folder. --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 2fc9fe8..482385d 100644 --- a/.gitignore +++ b/.gitignore @@ -416,4 +416,7 @@ src/AIHub/appsettings.Development.json *.tfstate *.tfstate.* -local.settings.json \ No newline at end of file +local.settings.json + +# Ignore hidden folder for AI Hub Installation +**/.aihub From ec50c091785cfe3584cfac7102b0d63268e3e2a0 Mon Sep 17 00:00:00 2001 From: Rodrigo Liberoff Date: Mon, 20 May 2024 14:20:26 +0200 Subject: [PATCH 3/5] Created `install_linux.sh` script to deploy the AI Hub natively from Linux. --- install/install.sh | 29 --------------- install/install_linux.sh | 76 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 29 deletions(-) delete mode 100755 install/install.sh create mode 100755 install/install_linux.sh diff --git a/install/install.sh b/install/install.sh deleted file mode 100755 index 80e064d..0000000 --- a/install/install.sh +++ /dev/null @@ -1,29 +0,0 @@ -echo "" -set -e - -# GitHub Org and repo hosting AI Hub -GitHubOrg="azure" -GitHubRepo="aihub" - -AIHubRoot="./.aihub" - -# Set Github request authentication for basic authentication. -if [[ -n GITHUB_USER ]]; then - basicAuth=$(echo -n "$GITHUB_USER:$GITHUB_TOKEN" | base64) - githubHeader="Authorization: Basic $basicAuth" -else - githubHeader="" -fi - -echo "Installing AI Hub..." - -# Create Dapr Directory -echo "Creating AIHubRoot directory" -mkdir -p "AIHubRoot" 2>/dev/null -if [[ ! -d "AIHubRoot" ]]; then - echo "Warning: Please visit https://azure.github.io/aihub/docs/ for instructions on how to install without admin rights." - echo "Cannot create AIHubRoot" >&2 - exit 1 -fi - -latest_aihub=$(curl -H githubHeader https://api.github.com/repos/Azure/aihub/releases/latest | jq -r .tag_name) \ No newline at end of file diff --git a/install/install_linux.sh b/install/install_linux.sh new file mode 100755 index 0000000..f8c8192 --- /dev/null +++ b/install/install_linux.sh @@ -0,0 +1,76 @@ +echo "" +set -e + +# GitHub Org and repo hosting AI Hub +GitHubOrg="azure" +GitHubRepo="aihub" + +AIHubRoot="./.aihub" + +# Set Github request authentication for basic authentication. +if [[ -n GITHUB_USER ]]; then + basicAuth=$(echo -n "$GITHUB_USER:$GITHUB_TOKEN" | base64) + githubHeader="Authorization: Basic $basicAuth" +else + githubHeader="" +fi + +echo "Installing AI Hub..." + +# Create Dapr Directory +echo "Creating AIHubRoot directory" +mkdir -p "$AIHubRoot" +if [ ! -d "$AIHubRoot" ]; then + echo "Warning: Please visit https://azure.github.io/aihub/docs/ for instructions on how to install without admin rights." + echo "Cannot create $AIHubRoot" >&2 + exit 1 +fi + +latest_aihub=$(curl -H "$githubHeader" https://api.github.com/repos/Azure/aihub/releases/latest | jq -r .tag_name) +zipFileUrl="https://github.com/Azure/aihub/releases/download/$latest_aihub/aihub-tf-module.zip" +echo "Downloading $zipFileUrl ..." +zipFilePath="aihub-tf-module.zip" +curl -H "$githubHeader" -H "Accept: application/octet-stream" -L $zipFileUrl --output $zipFilePath + +if [ ! -f "$zipFilePath" ]; then + echo "Failed to download AI Hub - $zipFilePath" >&2 + exit 1 +fi + +# Extract AI Hub to AIHubRoot +echo "Extracting $zipFilePath..." +unzip -o $zipFilePath -d $AIHubRoot + +# Move files to root +mv "$AIHubRoot/home/runner/work/aihub/aihub/release/aihub-tf-module/"* $AIHubRoot + +# Clean up folder +rm -rf "$AIHubRoot/home" + +# Clean up zipfile +echo "Clean up $zipFilePath..." +rm $zipFilePath + +zipFilePath="terraform_1.7.4_linux_386.zip" +zipFileUrl="https://releases.hashicorp.com/terraform/1.7.4/$zipFilePath" +echo "Downloading $zipFileUrl ..." +curl -L $zipFileUrl --output $zipFilePath + +# Extract terraform to $AIHubRoot +echo "Extracting $zipFilePath..." +unzip -o $zipFilePath -d $AIHubRoot + +# Clean up zipfile +echo "Clean up $zipFilePath..." +rm $zipFilePath + +# Use Terraform to deploy AI Hub +echo "Deploying AI Hub..." +cd $AIHubRoot +./terraform init +./terraform apply -auto-approve +cd - + +# Everything is done +echo -e "\nAI Hub deployed successfully." +echo "To get started with AI Hub, please visit https://azure.github.io/aihub ." From df80ed4f66dbf44ee1944af20b939369f9557565 Mon Sep 17 00:00:00 2001 From: Rodrigo Liberoff Date: Mon, 20 May 2024 14:20:37 +0200 Subject: [PATCH 4/5] Updated deployment `README` file. --- infra/README.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/infra/README.md b/infra/README.md index 31257bc..d88d8bf 100644 --- a/infra/README.md +++ b/infra/README.md @@ -8,7 +8,7 @@ Before deploying and installing the Azure AI Hub, please ensure the following pr - During deployment, the script will create two application registrations on Microsoft Entra ID. Please verify that your user account has the necessary privileges. - The Azure AI Hub uses various cognitive services like Azure Computer Vision, Azure Speech Service or Azure Document Intelligence. To deploy these Cognitive Services, you must manually accept the "Responsible AI" terms. This can currently only be done by deploying any of these services from the Azure Portal. -## Deploying the infrastructure +## Deploying the infrastructure - Windows Run the following command to deploy the infrastructure: @@ -18,6 +18,21 @@ az account set -s powershell -Command "iwr -useb https://raw.githubusercontent.com/azure/aihub/master/install/install.ps1 | iex" ``` +## Deploying the infrastructure - Linux + +For installation on Linux, we recommend using `Ubuntu 22.04` or a newer version. Before executing the installation script, ensure that the following applications are installed and up-to-date: + +- `curl`, version `7.x` or higher +- `jq`, version `1.6` or higher + +To deploy the infrastructure, execute the following command: + +```bash +az login +az account set -s +bash -c "$(curl -fsSL https://raw.githubusercontent.com/azure/aihub/master/install/install_linux.sh)" +``` + ## Manual steps For details on manual deployment, please refer to the [Deployment](https://azure.github.io/aihub/docs/deployment/) section in the Azure AI Hub documentation. From e47c531d2fc2e1cea0095e637ca58f8321cab64d Mon Sep 17 00:00:00 2001 From: Rodrigo Liberoff Date: Mon, 20 May 2024 14:23:11 +0200 Subject: [PATCH 5/5] Minor `README` update. --- infra/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/infra/README.md b/infra/README.md index d88d8bf..bcc5bf5 100644 --- a/infra/README.md +++ b/infra/README.md @@ -22,8 +22,9 @@ powershell -Command "iwr -useb https://raw.githubusercontent.com/azure/aihub/mas For installation on Linux, we recommend using `Ubuntu 22.04` or a newer version. Before executing the installation script, ensure that the following applications are installed and up-to-date: -- `curl`, version `7.x` or higher -- `jq`, version `1.6` or higher +- `curl`, version `7.x` or higher. +- `jq`, version `1.6` or higher. +- `unzip`, version `6.x` or higher. To deploy the infrastructure, execute the following command: