-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
77586e2
commit d85c1dd
Showing
6 changed files
with
112 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Running CCF on a virtual machine | ||
|
||
This folder contains two separate ways of setting up a development environment for CCF itself and apps. | ||
|
||
1. [azure_vm](./azure_vm/README.md) provides an opinionated way of creating a Virtual Machine on Azure and install CCF for you by cloud-init. | ||
2. `setup_vm` assumes that a bare environment is already available (VM or container) and provides Ansible scripts to setup the development environment by either cloning this repository or installing the CCF Debian package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Creating a Virtual Machine in Azure to run CCF | ||
|
||
This guide is here to give you the bare minimum to get started with CCF. It will walk you through the steps to create a virtual machine in Azure and install CCF on it. | ||
|
||
## Prerequisites | ||
|
||
You must run this from a bash terminal that you have already logged in to Azure with. If you have not done this, please follow the instructions [here](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest). | ||
|
||
## Create a Virtual Machine | ||
|
||
Run the following script : | ||
|
||
```bash | ||
./getting_started/azure_vm/install_ccf_on_azure_vm.sh | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#cloud-config | ||
package_update: true | ||
package_upgrade: true | ||
apt: | ||
sources: | ||
docker.list: | ||
source: deb [arch=amd64] https://download.docker.com/linux/ubuntu $RELEASE stable | ||
keyid: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88 | ||
|
||
packages: | ||
- apt-transport-https | ||
- ca-certificates | ||
- curl | ||
- gnupg-agent | ||
- software-properties-common | ||
- docker-ce | ||
- docker-ce-cli | ||
- containerd.io | ||
- git | ||
- jq | ||
|
||
# Enable ipv4 forwarding, required on CIS hardened machines | ||
write_files: | ||
- path: /etc/sysctl.d/enabled_ipv4_forwarding.conf | ||
content: | | ||
net.ipv4.conf.all.forwarding=1 | ||
# create the docker group | ||
groups: | ||
- docker | ||
|
||
# Add default auto created user to docker group | ||
system_info: | ||
default_user: | ||
groups: [docker] | ||
|
||
runcmd: | ||
- cd /home/azureuser && git clone https://github.com/microsoft/CCF.git ccf-install -b release/2.x | ||
- sudo -u azureuser /home/azureuser/ccf-install/getting_started/setup_vm/run.sh /home/azureuser/ccf-install/getting_started/setup_vm/app-run.yml | ||
- export CCF_VERSION=$(curl -ILs -o /dev/null -w %{url_effective} https://github.com/microsoft/CCF/releases/latest | sed 's/^.*ccf-//') | ||
- wget https://github.com/microsoft/CCF/releases/download/ccf-${CCF_VERSION}/ccf_${CCF_VERSION}_amd64.deb | ||
- apt install /home/azureuser/ccf_${CCF_VERSION}_amd64.deb -y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the Apache 2.0 License. | ||
|
||
# !!! These are defaults and you can change these if you wish !!! | ||
resourceGroup=rg_ccf_demo | ||
vm_name=ccfdemo | ||
location=westeurope | ||
# This is the smallest VM, you may wish to change this. | ||
vm_size=Standard_DC1s_v2 | ||
vnetName=ccf | ||
subnetName=nodes | ||
vnetAddressPrefix=10.0.0.0/16 | ||
ccfAddressPrefix=10.0.0.0/24 | ||
|
||
az group create --name $resourceGroup --location $location | ||
|
||
az network vnet create \ | ||
--name $vnetName \ | ||
--resource-group $resourceGroup \ | ||
--address-prefixes $vnetAddressPrefix \ | ||
--subnet-name $subnetName \ | ||
--subnet-prefixes $ccfAddressPrefix | ||
|
||
# Automatically generates a ssh key if one is not present | ||
# https://learn.microsoft.com/en-us/azure/virtual-machines/linux/create-ssh-keys-detailed#generate-keys-automatically-during-deployment | ||
az vm create \ | ||
--resource-group $resourceGroup \ | ||
--name $vm_name \ | ||
--image canonical:0001-com-ubuntu-server-focal:20_04-lts-gen2:20.04.202210180 \ | ||
--vnet-name $vnetName \ | ||
--subnet $subnetName \ | ||
--size $vm_size \ | ||
--public-ip-sku Standard \ | ||
--admin-username azureuser \ | ||
--custom-data ccf-cloudinit.yml \ | ||
--generate-ssh-keys \ | ||
--output json |