-
Notifications
You must be signed in to change notification settings - Fork 8
feat: deployment documentation for Azure and Azure Private #110
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,192 @@ | ||
# Local Deployment using Infrastructure as Code | ||
|
||
This guide describes how to deploy a two-party Carbyne Stack Virtual Cloud | ||
onto an Azure private Kubernetes cluster using Infrastructure as Code (IaC). | ||
|
||
## Setup | ||
|
||
1. Clone the carbynestack/carbynestack repository | ||
|
||
```shell | ||
git clone [email protected]:carbynestack/carbynestack.git | ||
``` | ||
|
||
2. Change into the `carbynestack` directory | ||
|
||
```shell | ||
cd carbynestack | ||
``` | ||
|
||
3. Checkout the tag `sdk-v0.5.0` | ||
|
||
```shell | ||
git checkout tags/sdk-v0.5.0 | ||
``` | ||
|
||
4. Change directory to the `deployments` folder | ||
|
||
```shell | ||
cd deployments | ||
``` | ||
|
||
5. Install npm dependencies: | ||
|
||
```shell | ||
npm install | ||
``` | ||
|
||
6. Generate CDKTF provider bindings and import modules (located in the `.gen` folder): | ||
|
||
```shell | ||
cdktf get | ||
``` | ||
|
||
## Azure | ||
|
||
CDKTF uses the Azure CLI under the hood to authenticate and interact with Azure. | ||
|
||
1. Log in to Azure using the Azure CLI: | ||
|
||
```shell | ||
az login | ||
``` | ||
|
||
2. Determine your Azure subscription ID: | ||
|
||
```shell | ||
az account list | ||
``` | ||
|
||
Find the subscription you want to use and save for later use. | ||
|
||
3. Create a service principal: | ||
|
||
```shell | ||
az ad sp create-for-rbac --role="Contributor" --scopes="/subscriptions/<your subscription id>" | ||
``` | ||
|
||
This command will ouput similar to the following example: | ||
|
||
```shell | ||
{ | ||
"appId": "<appId>", | ||
"displayName": "azure-cli-2022-01-01-00-00-00", | ||
"password": "<password>", | ||
"tenant": "<tenant>" | ||
} | ||
``` | ||
|
||
Save the `appId`, `password`, and `tenant` for later use. | ||
|
||
4. Export the service principal credentials as environment variables: | ||
|
||
```shell | ||
export ARM_CLIENT_ID=<appId> | ||
export ARM_CLIENT_SECRET=<password> | ||
export ARM_TENANT_ID=<tenant> | ||
export ARM_SUBSCRIPTION_ID=<subscription id> | ||
``` | ||
|
||
## Deploy the Jump Host | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we expect people interested in a private deployment to know why it is required to have a jump host or should we add a description? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The deployment till this point (and the "Destroy and Clean Up" section) are identical for public and private azure deployment. |
||
|
||
In the `./deployments` folder: | ||
|
||
1. Deploy the Jump Host using a provided password that will be used to | ||
access the Jump Host: | ||
|
||
```shell | ||
cdktf deploy azure-jump --var='admin_password=<password>' | ||
``` | ||
|
||
2. Once the Jump Host is deployed you will see the IP address of the | ||
Jump Host in the CDKTF output. | ||
|
||
```shell | ||
ssh caliper@<jump_host_ip> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. caliper? |
||
``` | ||
|
||
## Deploy the Private AKS Cluster with Carbyne Stack | ||
|
||
On the jump host, you need to install the following dependencies before deploying: | ||
|
||
1. Install OS dependencies: | ||
|
||
```shell | ||
sudo apt update && sudo apt install -y make build-essential gnupg software-properties-common apt-transport-https ca-certificates curl | ||
``` | ||
|
||
2. Install npm via nvm since it deals with permission issues for global packages | ||
|
||
```shell | ||
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash | ||
export NVM_DIR="$HOME/.nvm" | ||
source ~/.bashrc | ||
nvm install --lts | ||
``` | ||
|
||
3. Install kubectl: | ||
|
||
```shell | ||
snap install kubectl --classic | ||
``` | ||
|
||
4. Install Terraform: | ||
|
||
```shell | ||
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg > /dev/null | ||
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list | ||
sudo apt update && sudo apt install terraform | ||
``` | ||
|
||
5. Install Azure CLI: | ||
|
||
```shell | ||
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash | ||
``` | ||
|
||
6. Install CDKTF and TypeScript: | ||
|
||
```shell | ||
npm install --global [email protected] typescript | ||
``` | ||
|
||
7. Clone the Carbyne Stack repository and build: | ||
|
||
```shell | ||
git clone -b iac-azure https://github.com/carbynestack/carbynestack.git | ||
cd carbynestack/deployments | ||
npm install | ||
cdktf get && npm run build | ||
``` | ||
|
||
8. Set Azure credentials: | ||
|
||
```shell | ||
export ARM_CLIENT_ID=<appId> | ||
export ARM_CLIENT_SECRET=<password> | ||
export ARM_TENANT_ID=<tenant> | ||
export ARM_SUBSCRIPTION_ID=<subscription id> | ||
``` | ||
|
||
9. Deploy the Carbyne Stack on the private AKS cluster: | ||
|
||
```shell | ||
JUMP_HOST_RESOURCE_GROUP=rg-cs-jump JUMP_HOST_VIRTUAL_NETWORK_NAME=vn-cs-jump cdktf deploy azure-private-cluster | ||
``` | ||
|
||
## Destroy and Clean Up | ||
|
||
If you no longer need the stack or want to tear it down to apply changes to the | ||
infrastructure as code, run the following command: | ||
|
||
```bash | ||
cdktf destroy | ||
``` | ||
|
||
Alternatively, you can use: | ||
|
||
```bash | ||
kind delete clusters cs-1 cs-2 | ||
``` | ||
|
||
And delete the CDKTF state files (like `terraform.local-kind.tfstate`) manually. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
# Local Deployment using Infrastructure as Code | ||
|
||
This guide describes how to deploy a two-party Carbyne Stack Virtual Cloud | ||
onto Azure. | ||
|
||
## Setup | ||
|
||
1. Clone the carbynestack/carbynestack repository | ||
|
||
```shell | ||
git clone [email protected]:carbynestack/carbynestack.git | ||
``` | ||
|
||
2. Change into the `carbynestack` directory | ||
|
||
```shell | ||
cd carbynestack | ||
``` | ||
|
||
3. Checkout the tag `sdk-v0.5.0` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. needs to be updated once carbynestack/#103 has been merged and released |
||
|
||
```shell | ||
git checkout tags/sdk-v0.5.0 | ||
``` | ||
|
||
4. Change directory to the `deployments` folder | ||
|
||
```shell | ||
cd deployments | ||
``` | ||
|
||
5. Install npm dependencies: | ||
|
||
```shell | ||
npm install | ||
``` | ||
|
||
6. Generate CDKTF provider bindings and import modules | ||
(located in the `.gen` folder): | ||
|
||
```shell | ||
cdktf get | ||
``` | ||
|
||
## Azure | ||
|
||
CDKTF uses the Azure CLI under the hood to authenticate and interact with | ||
Azure. | ||
|
||
1. Log in to Azure using the Azure CLI: | ||
|
||
```shell | ||
az login | ||
``` | ||
|
||
2. Determine your Azure subscription ID: | ||
|
||
```shell | ||
az account list | ||
``` | ||
|
||
Find the subscription you want to use and save for later use. | ||
|
||
3. Create a service principal: | ||
|
||
```shell | ||
az ad sp create-for-rbac --role="Contributor" --scopes="/subscriptions/<your subscription id>" | ||
``` | ||
|
||
This command will ouput similar to the following example: | ||
|
||
```shell | ||
{ | ||
"appId": "<appId>", | ||
"displayName": "azure-cli-2022-01-01-00-00-00", | ||
"password": "<password>", | ||
"tenant": "<tenant>" | ||
} | ||
``` | ||
|
||
Save the `appId`, `password`, and `tenant` for later use. | ||
|
||
4. Export the service principal credentials as environment variables: | ||
|
||
```shell | ||
export ARM_CLIENT_ID=<appId> | ||
export ARM_CLIENT_SECRET=<password> | ||
export ARM_TENANT_ID=<tenant> | ||
export ARM_SUBSCRIPTION_ID=<subscription id> | ||
``` | ||
|
||
## Deploy | ||
|
||
In the `./deployments` folder: | ||
|
||
1. Deploy the stack using | ||
|
||
```shell | ||
cdktf deploy azure-cluster | ||
``` | ||
|
||
## Destroy and Clean Up | ||
|
||
If you no longer need the stack or want to tear it down to apply changes to the | ||
infrastructure as code, run the following command: | ||
|
||
```bash | ||
cdktf destroy | ||
``` | ||
|
||
Alternatively, you can use: | ||
|
||
```bash | ||
kind delete clusters cs-1 cs-2 | ||
``` | ||
|
||
And delete the CDKTF state files (like `terraform.local-kind.tfstate`) manually. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
# Infrastructure as Code | ||
|
||
!!! warning | ||
Carbyne Stack Infrastructure as Code (IaC) is still in *proof-of-concept* | ||
stage. Reach out in case you encounter problems. | ||
Carbyne Stack Infrastructure as Code (IaC) is still in *proof-of-concept* | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
stage. Reach out in case you encounter problems. | ||
|
||
Carbyne Stack has adopted Infrastructure as Code (IaC) as a core principle. | ||
IaC is the process of managing and provisioning infrastructure through code | ||
|
@@ -29,7 +29,7 @@ allows you to use a common programming language, in Carbyne Stack's | |
case, Typescript, to define the infrastructure. This allows you to | ||
leverage the full power of a programming language to define your | ||
infrastructure, including the ability to use loops, conditionals, | ||
functions, and abstractions. | ||
functions, and abstractions. | ||
|
||
### Stacks | ||
|
||
|
@@ -43,6 +43,12 @@ top of it. | |
As of today, the following deployment targets are supported: | ||
|
||
- [Local deployment](./local) to [kind](https://kind.sigs.k8s.io/) clusters | ||
- [Azure](./azure) to | ||
[Azure Kubernetes Service (AKS)](https://azure.microsoft.com/en-us/products/kubernetes-service) | ||
clusters | ||
- [Azure Private](./azure-private) to | ||
[Azure Kubernetes Service (AKS)](https://azure.microsoft.com/en-us/products/kubernetes-service) | ||
private clusters | ||
|
||
### Constructs | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs to be updated once carbynestack/#103 has been merged and released