Skip to content

Commit

Permalink
Install getting started (#983)
Browse files Browse the repository at this point in the history
  • Loading branch information
achamayou authored Mar 24, 2020
1 parent 55a2044 commit 07f5404
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 16 deletions.
3 changes: 3 additions & 0 deletions cmake/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ install(PROGRAMS ${CCF_DIR}/tests/scurl.sh ${CCF_DIR}/tests/keygenerator.sh
DESTINATION bin
)

# Install getting_started scripts for VM creation and setup
install(DIRECTORY ${CCF_DIR}/getting_started/ DESTINATION getting_started)

if("sgx" IN_LIST TARGET)
# If OE was built with LINK_SGX=1, then we also need to link SGX
if(OE_SGX)
Expand Down
13 changes: 9 additions & 4 deletions getting_started/create_vm/destroy_vm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,21 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the Apache 2.0 License.

set -ex
set -e

read -p "Are you sure? " -n 1 -r
if [ "$#" -ne 1 ]; then
echo "Usage: $0 SUBSCRIPTION_NAME"
exit 1
fi

read -p "Are you sure [y/N]? " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi

# Azure Resource Group
RG=ccf-dev
RG=ccf-dev-rg

az group delete --name "$RG" --subscription "$SUBSCRIPTION" -y
az group delete --name "$RG" --subscription "$1" -y
19 changes: 12 additions & 7 deletions getting_started/create_vm/make_vm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,24 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the Apache 2.0 License.

set -ex
set -e

if [ "$#" -lt 1 ]; then
echo "Usage: $0 SUBSCRIPTION_NAME [path/to/ssh/public/key]"
exit 1
fi

# Azure Resource Group
RG=ccf-dev
# Region, only eastus and westeurope are supported at the moment
REGION=eastus
RG=ccf-dev-rg
# Region, only uksouth is supports DC*_v2 at the moment
REGION=uksouth
CFG=vm.json

# By default, use current ssh public key
DEFAULT_PUBLIC_KEY_PATH=~/.ssh/id_rsa.pub
PUBLIC_KEY_PATH=${1:-${DEFAULT_PUBLIC_KEY_PATH}}
PUBLIC_KEY_PATH=${2:-${DEFAULT_PUBLIC_KEY_PATH}}

az login
az group create --name "$RG" --location "$REGION" --subscription "$SUBSCRIPTION"
az group create --name "$RG" --location "$REGION" --subscription "$1"
oe-engine generate --api-model "$CFG" --ssh-public-key "$PUBLIC_KEY_PATH" --output-directory generated
az group deployment create --name "$RG-$REGION" --resource-group "$RG" --template-file generated/azuredeploy.json --parameters @generated/azuredeploy.parameters.json --subscription "$SUBSCRIPTION"
az deployment group create --name "$RG-$REGION" --resource-group "$RG" --template-file generated/azuredeploy.json --parameters @generated/azuredeploy.parameters.json --subscription "$1"
11 changes: 6 additions & 5 deletions getting_started/create_vm/vm.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@
"properties": {
"vmProfiles": [
{
"name": "ccf-dev",
"name": "ccf-dev-vm",
"osType": "Linux",
"vmSize": "Standard_DC4s",
"ports": [22, 25000],
"vmSize": "Standard_DC8_v2",
"ports": [22],
"hasDNSName": true,
"isVanilla": true
"isVanilla": true,
"osDiskType": "StandardSSD_LRS"
}
],
"linuxProfile": {
"adminUsername": "ccf",
"osImage": {
"publisher": "Canonical",
"offer": "UbuntuServer",
"sku": "18.04-LTS",
"sku": "18_04-lts-gen2",
"version": "latest"
}
}
Expand Down

0 comments on commit 07f5404

Please sign in to comment.