Skip to content
This repository was archived by the owner on Dec 12, 2025. It is now read-only.

Commit

Permalink
Basic support on Ubunto 20.04 LTS
Browse files Browse the repository at this point in the history
  • Loading branch information
tmiddelkoop committed Dec 1, 2021
1 parent 5a94755 commit 9bb689c
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 4 deletions.
4 changes: 4 additions & 0 deletions Build.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@ gcloud config set project $GOOGLE_CLOUD_PROJECT
## AWS

Expect that `aws` is installed locally. A ssh-key named 'learner' is required to access the account.

## Azure

Expect that `az` is installed and configured locally. It will utilize your ~/.ssh/id_rsa.pub key.
4 changes: 3 additions & 1 deletion scripts/aws-create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
# Options
BRANCH="${1:-aws-dev}" # checkout branch $1

# Static Config - update aws-*.sh files
# Provider Config - update aws-*.sh files.

# Static Config - update *.sh files
NAME=learner
VM=essentials
PROJECT=CLASS-Essentials
Expand Down
65 changes: 65 additions & 0 deletions scripts/azure-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/bash

# Options
BRANCH="${1:-azure-dev}" # checkout branch $1

# Provider Config - update *-azure.sh files.
LOCATION=centralus

# Static Config - update *.sh files
NAME=learner
VM=essentials
PROJECT=CLASS-Essentials
GITHUB=github.internet2.edu
REPO="git@${GITHUB}:CLASS/${PROJECT}.git"

echo "=== azure-create.sh $PROJECT $BRANCH"
RESOURCE_GROUP=$VM

echo "+++ creating resource group $RESOURCE_GROUP"
az group create --resource-group $RESOURCE_GROUP --location $LOCATION

echo "+++ creating VM $VM"
# Ubuntu is "Canonical:0001-com-ubuntu-server-focal:20_04-lts:latest"
az vm create --resource-group $RESOURCE_GROUP --name $VM \
--image Canonical:0001-com-ubuntu-server-focal:20_04-lts:latest \
--size Standard_D4_v4 \
--storage-sku Standard_LRS \
--public-ip-sku Standard \
--admin-username $NAME

IP=$(az vm show --name essentials --resource-group essentials -d --query publicIps -otsv)

echo "+++ wait for boot and cloud-init ${VM} ${IP}"
ssh-keygen -R $IP
while ! ssh $NAME@$IP sudo cloud-init status --wait ; do
sleep 1
done

echo "+++ configuring VM"
ssh -A $NAME@$VM <<EOF
sudo apt-get update
sudo apt-get install --yes git python3-pip python3-venv bash-completion
ssh-keyscan ${GITHUB} > .ssh/known_hosts
git config --global color.ui auto
git config --global push.default simple
git config --global pull.ff only
git config --global user.name "$(git config user.name)"
git config --global user.email "$(git config user.name)"
git clone --branch $BRANCH $REPO
EOF

echo "+++ configure ~/.ssh/$VM.config"
cat > ~/.ssh/$VM.config <<EOF
Host essentials
HostName $IP
CheckHostIP=no
ForwardAgent=yes
User=$NAME
EOF

echo "+++ starting Jypter"
ssh $NAME@$IP -t -L 8080:localhost:8080 -L 8081:localhost:8081 "cd $PROJECT ; ./scripts/jupyter-lab.sh"

echo "+++ ssh command"
echo "ssh $NAME@$IP"
10 changes: 10 additions & 0 deletions scripts/azure-delete.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# Provider Config - update *-azure.sh files.

# Static Config - update *.sh files
VM=essentials

RESOURCE_GROUP=$VM
az vm delete --resource-group $RESOURCE_GROUP --name $VM --yes
#az group delete --resource-group $RESOURCE_GROUP --yes
9 changes: 6 additions & 3 deletions scripts/gcp-create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
# Options
BRANCH="${1:-gcp-dev}" # checkout branch $1

# Static Config - update gcp-*.sh files
# Provider Config - update gcp-*.sh files.
ZONE=us-west2-c

# Static Config - update *.sh files
NAME=learner
VM=essentials
ZONE=us-west2-c
PROJECT=CLASS-Essentials
GITHUB=github.internet2.edu
REPO="git@${GITHUB}:CLASS/${PROJECT}.git"
Expand All @@ -25,7 +27,8 @@ done
echo "+++ configuring VM"

gcloud compute ssh --zone=$ZONE $NAME@$VM --ssh-flag='-A' <<EOF
sudo apt install --yes git python3-pip python3-venv bash-completion
sudo apt-get update
sudo apt-get install --yes git python3-pip python3-venv bash-completion
ssh-keyscan ${GITHUB} > .ssh/known_hosts
git config --global color.ui auto
git config --global push.default simple
Expand Down

0 comments on commit 9bb689c

Please sign in to comment.