Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@rliberoff/create bash intall script #40

Merged
merged 6 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -416,4 +416,7 @@ src/AIHub/appsettings.Development.json
*.tfstate
*.tfstate.*

local.settings.json
local.settings.json

# Ignore hidden folder for AI Hub Installation
**/.aihub
18 changes: 17 additions & 1 deletion infra/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -18,6 +18,22 @@ az account set -s <target subscription_id or subscription_name>
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.
- `unzip`, version `6.x` or higher.

To deploy the infrastructure, execute the following command:

```bash
az login
az account set -s <target subscription_id or subscription_name>
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.
76 changes: 76 additions & 0 deletions install/install_linux.sh
Original file line number Diff line number Diff line change
@@ -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 ."
Loading