manual removed files

This commit is contained in:
2024-04-15 17:49:09 +00:00
parent a567404ef3
commit c19931fd32
1763 changed files with 0 additions and 51340 deletions

View File

@@ -1,7 +0,0 @@
<svg width="516" height="171" viewBox="0 0 516 171" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="516" height="171" rx="12" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M63.0724 90.8698C66.9836 88.6116 66.9901 81.3006 63.0869 74.5402C59.1837 67.7799 52.8489 64.1303 48.9377 66.3885C45.0265 68.6467 45.02 75.9576 48.9231 82.7179C52.8263 89.4783 59.1612 93.128 63.0724 90.8698ZM63.0958 105.345C66.999 112.106 66.9925 119.417 63.0813 121.675C59.17 123.933 52.8352 120.283 48.932 113.523C45.0288 106.763 45.0353 99.4517 48.9465 97.1935C52.8578 94.9353 59.1926 98.585 63.0958 105.345ZM89.7495 120.755C93.6527 127.515 93.6462 134.826 89.735 137.085C85.8238 139.343 79.4889 135.693 75.5857 128.933C71.6826 122.172 71.6891 114.862 75.6003 112.603C79.5115 110.345 85.8463 113.995 89.7495 120.755ZM89.7408 89.9505C93.644 96.7108 93.6375 104.022 89.7263 106.28C85.8151 108.538 79.4803 104.888 75.5771 98.1281C71.6739 91.3677 71.6804 84.0568 75.5916 81.7986C79.5028 79.5404 85.8377 83.1902 89.7408 89.9505Z" fill="#F26E7E"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M143.061 82.7349C146.964 75.9746 146.958 68.6636 143.047 66.4054C139.136 64.1472 132.801 67.7969 128.898 74.5573C124.994 81.3176 125.001 88.6285 128.912 90.8868C132.823 93.145 139.158 89.4953 143.061 82.7349ZM143.062 97.2032C146.973 99.4614 146.98 106.772 143.077 113.533C139.173 120.293 132.839 123.943 128.927 121.685C125.016 119.426 125.01 112.115 128.913 105.355C132.816 98.5947 139.151 94.945 143.062 97.2032ZM116.414 112.588C120.325 114.846 120.331 122.157 116.428 128.917C112.525 135.677 106.19 139.327 102.279 137.069C98.3677 134.811 98.3612 127.5 102.264 120.74C106.168 113.979 112.502 110.329 116.414 112.588ZM116.399 81.7897C120.31 84.0479 120.316 91.3589 116.413 98.1192C112.51 104.88 106.175 108.529 102.264 106.271C98.3526 104.013 98.3461 96.7019 102.249 89.9416C106.153 83.1812 112.487 79.5315 116.399 81.7897Z" fill="#8A3391"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M110.122 40.1777C110.122 44.6941 103.794 48.3554 95.9875 48.3554C88.1811 48.3554 81.8528 44.6941 81.8528 40.1777C81.8528 35.6613 88.1811 32 95.9875 32C103.794 32 110.122 35.6613 110.122 40.1777ZM83.474 55.5464C83.474 60.0628 77.1457 63.7241 69.3393 63.7241C61.5329 63.7241 55.2046 60.0628 55.2046 55.5464C55.2046 51.03 61.5329 47.3687 69.3393 47.3687C77.1457 47.3687 83.474 51.03 83.474 55.5464ZM122.671 63.7241C130.477 63.7241 136.805 60.0628 136.805 55.5464C136.805 51.03 130.477 47.3687 122.671 47.3687C114.864 47.3687 108.536 51.03 108.536 55.5464C108.536 60.0628 114.864 63.7241 122.671 63.7241ZM110.122 70.9496C110.122 75.466 103.794 79.1272 95.9875 79.1272C88.1811 79.1272 81.8528 75.466 81.8528 70.9496C81.8528 66.4332 88.1811 62.7719 95.9875 62.7719C103.794 62.7719 110.122 66.4332 110.122 70.9496Z" fill="#F7BF2A"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M300.218 51H305.473C307.104 51 308.01 51.906 308.01 53.5368V114.556C308.01 116.187 307.104 117.093 305.473 117.093H300.218C298.587 117.093 297.681 116.187 297.681 114.556V53.5368C297.681 51.906 298.587 51 300.218 51ZM199.154 117.093C200.785 117.093 201.691 116.187 201.691 114.556V94.1255H212.336C225.836 94.1255 234.307 86.0621 234.307 73.9217C234.307 61.8265 225.836 53.7178 212.336 53.7178H193.537C191.906 53.7178 191 54.6238 191 56.2546V114.556C191 116.187 191.906 117.093 193.537 117.093H199.154ZM201.691 62.7325H211.657C219.267 62.7325 223.571 67.1266 223.571 73.9217C223.571 80.762 219.267 85.1561 211.657 85.1561H201.691V62.7325ZM241.918 72.744V99.1087C241.918 110.66 249.393 118.135 260.673 118.135C266.652 118.135 271.771 115.19 274.942 110.887V114.556C274.942 116.187 275.848 117.093 277.479 117.093H282.779C284.41 117.093 285.316 116.187 285.316 114.556V72.744C285.316 71.1132 284.41 70.2072 282.779 70.2072H277.479C275.848 70.2072 274.942 71.1132 274.942 72.744V95.7565C274.942 103.548 269.325 109.029 262.802 109.029C256.55 109.029 252.247 104.59 252.247 98.248V72.744C252.247 71.1132 251.341 70.2072 249.71 70.2072H244.455C242.824 70.2072 241.918 71.1132 241.918 72.744ZM319.517 72.744V99.1087C319.517 110.66 326.991 118.135 338.271 118.135C344.251 118.135 349.37 115.19 352.541 110.887V114.556C352.541 116.187 353.447 117.093 355.078 117.093H360.378C362.009 117.093 362.915 116.187 362.915 114.556V72.744C362.915 71.1132 362.009 70.2072 360.378 70.2072H355.078C353.447 70.2072 352.541 71.1132 352.541 72.744V95.7565C352.541 103.548 346.924 109.029 340.4 109.029C334.149 109.029 329.845 104.59 329.845 98.248V72.744C329.845 71.1132 328.939 70.2072 327.309 70.2072H322.054C320.423 70.2072 319.517 71.1132 319.517 72.744ZM447.897 88.1915V114.602C447.897 116.232 446.991 117.138 445.361 117.138H440.061C438.43 117.138 437.524 116.232 437.524 114.602V89.0975C437.524 82.7555 433.583 78.3161 427.784 78.3161C421.94 78.3161 416.414 84.2051 416.414 91.3172V114.602C416.414 116.232 415.508 117.138 413.877 117.138H408.577C406.946 117.138 406.04 116.232 406.04 114.602V89.0975C406.04 82.7555 402.099 78.3161 396.301 78.3161C390.729 78.3161 384.93 83.6615 384.93 91.3172V114.602C384.93 116.232 384.024 117.138 382.393 117.138H377.093C375.463 117.138 374.557 116.232 374.557 114.602V72.7442C374.557 71.1133 375.463 70.2073 377.093 70.2073H382.393C384.024 70.2073 384.93 71.1133 384.93 72.7442V76.3229C388.237 71.974 392.994 69.1201 398.475 69.1201C405.542 69.1201 411.476 72.7894 414.421 78.8597C417.501 72.9706 423.209 69.1201 429.913 69.1201C440.106 69.1201 447.897 76.64 447.897 88.1915ZM471 57.4328C471 53.8541 468.191 51.0908 464.567 51.0908C460.943 51.0908 458.18 53.8541 458.18 57.4328C458.18 60.9662 460.943 63.7295 464.567 63.7295C468.191 63.7295 471 60.9662 471 57.4328ZM469.732 72.7442C469.732 71.1134 468.826 70.2074 467.195 70.2074H461.94C460.309 70.2074 459.403 71.1134 459.403 72.7442V114.556C459.403 116.187 460.309 117.093 461.94 117.093H467.195C468.826 117.093 469.732 116.187 469.732 114.556V72.7442Z" fill="black"/>
</svg>

Before

Width:  |  Height:  |  Size: 5.8 KiB

View File

@@ -1,449 +0,0 @@
<h1>Deployment Details</h1>
<h2>Table of Contents</h2>
- [Introduction](#introduction)
- [Installation](#installation)
- [Essential Workflow](#essential-workflow)
- [State](#state)
- [Creating an Empty Stack](#creating-an-empty-stack)
- [Bringing up the Infrastructure](#bringing-up-the-infrastructure)
- [Destroy the Infrastructure](#destroy-the-infrastructure)
- [Pulumi Makefile](#pulumi-makefile)
- [Creating a Network](#creating-a-network)
- [Pulumi File](#pulumi-file)
- [Creating a Virtual Machine](#creating-a-virtual-machine)
- [Kubernetes](#kubernetes)
- [Creating a Domain](#creating-a-domain)
- [Example of a Simple Domain Prefix](#example-of-a-simple-domain-prefix)
- [Example of a Fully Controlled Domain](#example-of-a-fully-controlled-domain)
- [Conclusion](#conclusion)
***
## Introduction
We present here noteworthy details concerning different types of deployments that are possible with the ThreeFold Pulumi plugin.
Please note that the Pulumi plugin for ThreeFold Grid is not yet officially published. We look forward to your feedback on this project.
## Installation
If this isn't already done, [install Pulumi](./pulumi_install.md) on your machine.
## Essential Workflow
### State
We will be creating a state directory and informing pulumi we want to use that local directory to manage the state, no need to use a cloud backend managed by pulumi or other providers (for the sake of testing).
```sh
mkdir ${current_dir}/state
pulumi login --cloud-url file://${current_dir}/state
```
### Creating an Empty Stack
```sh
pulumi stack init test
```
### Bringing up the Infrastructure
```sh
pulumi up --yes
```
Here we create an empty stack using `stack init` and we give it the name `test`
then to bring up the infrastructure we execute `pulumi up --yes`.
> The `pulumi up` command shows the plan before agreeing to execute it
### Destroy the Infrastructure
```sh
pulumi destroy --yes
pulumi stack rm --yes
pulumi logout
```
### Pulumi Makefile
In every example directory, you will find a project file `Pulumi.yaml` and a `Makefile` to reduce the amount of typing:
```Makefile
current_dir = $(shell pwd)
run:
rm -rf ${current_dir}/state
mkdir ${current_dir}/state
pulumi login --cloud-url file://${current_dir}/state
pulumi stack init test
pulumi up --yes
destroy:
pulumi destroy --yes
pulumi stack rm --yes
pulumi logout
```
This means that, to execute, you just need to type `make run` and to destroy, you need to type `make destroy`.
## Creating a Network
We address here how to create a [network](https://github.com/threefoldtech/pulumi-provider-grid/blob/development/examples/network).
### Pulumi File
You can find the original file [here](https://github.com/threefoldtech/pulumi-provider-grid/blob/development/examples/network/Pulumi.yaml).
```yml
name: pulumi-provider-grid
runtime: yaml
plugins:
providers:
- name: grid
path: ../..
resources:
provider:
type: pulumi:providers:grid
properties:
mnemonic:
scheduler:
type: grid:internal:Scheduler
options:
provider: ${provider}
properties:
farm_ids: [1]
network:
type: grid:internal:Network
options:
provider: ${provider}
dependsOn:
- ${scheduler}
properties:
name: testing
description: test network
nodes:
- ${scheduler.nodes[0]}
ip_range: 10.1.0.0/16
outputs:
node_deployment_id: ${network.node_deployment_id}
nodes_ip_range: ${network.nodes_ip_range}
```
We will now go through this file section by section to properly understand what is happening.
```yml
name: pulumi-provider-grid
runtime: yaml
```
- name is for the project name (can be anything)
- runtime: the runtime we are using can be code in yaml, python, go, etc.
```yml
plugins:
providers:
- name: grid
path: ../..
```
Here, we define the plugins we are using within our project and their locations. Note that we use `../..` due to the repository hierarchy.
```yml
resources:
provider:
type: pulumi:providers:grid
properties:
mnemonic:
```
We then start by initializing the resources. The provider which we loaded in the plugins section is also a resource that has properties (the main one now is just the mnemonic of TCHhain).
```yaml
scheduler:
type: grid:internal:Scheduler
options:
provider: ${provider}
properties:
farm_ids: [1]
```
Then, we create a scheduler `grid:internal:Scheduler`, that does the planning for us. Instead of being too specific about node IDs, we just give it some generic information. For example, "I want to work against these data centers (farms)". As long as the necessary criteria are provided, the scheduler can be more specific in the planning and select the appropriate resources available on the TFGrid.
```yaml
network:
type: grid:internal:Network
options:
provider: ${provider}
dependsOn:
- ${scheduler}
properties:
name: testing
description: test network
nodes:
- ${scheduler.nodes[0]}
ip_range: 10.1.0.0/16
```
Now, that we created the scheduler, we can go ahead and create the network resource `grid:internal:Network`. Please note that the network depends on the scheduler's existence. If we remove it, the scheduler and the network will be created in parallel, that's why we have the `dependsOn` section. We then proceed to specify the network resource properties, e.g. the name, the description, which nodes to deploy our network on, the IP range of the network. In our case, we only choose one node.
To access information related to our deployment, we set the section **outputs**. This will display results that we can use, or reuse, while we develop our infrastructure further.
```yaml
outputs:
node_deployment_id: ${network.node_deployment_id}
nodes_ip_range: ${network.nodes_ip_range}
```
## Creating a Virtual Machine
Now, we will check an [example](https://github.com/threefoldtech/pulumi-provider-grid/blob/development/examples/virtual_machine) on how to create a virtual machine.
Just like we've seen above, we will have two files `Makefile` and `Pulumi.yaml` where we describe the infrastructure.
```yml
name: pulumi-provider-grid
runtime: yaml
plugins:
providers:
- name: grid
path: ../..
resources:
provider:
type: pulumi:providers:grid
properties:
mnemonic: <to be filled>
scheduler:
type: grid:internal:Scheduler
options:
provider: ${provider}
properties:
mru: 256
sru: 2048
farm_ids: [1]
network:
type: grid:internal:Network
options:
provider: ${provider}
dependsOn:
- ${scheduler}
properties:
name: test
description: test network
nodes:
- ${scheduler.nodes[0]}
ip_range: 10.1.0.0/16
deployment:
type: grid:internal:Deployment
options:
provider: ${provider}
dependsOn:
- ${network}
properties:
node_id: ${scheduler.nodes[0]}
name: deployment
network_name: test
vms:
- name: vm
flist: https://hub.grid.tf/tf-official-apps/base:latest.flist
entrypoint: "/sbin/zinit init"
network_name: test
cpu: 2
memory: 256
planetary: true
mounts:
- disk_name: data
mount_point: /app
env_vars:
SSH_KEY:
disks:
- name: data
size: 2
outputs:
node_deployment_id: ${deployment.node_deployment_id}
ygg_ip: ${deployment.vms_computed[0].ygg_ip}
```
We have a scheduler, and a network just like before. But now, we also have a deployment `grid:internal:Deployment` object that can have one or more disks and virtual machines.
```yaml
deployment:
type: grid:internal:Deployment
options:
provider: ${provider}
dependsOn:
- ${network}
properties:
node_id: ${scheduler.nodes[0]}
name: deployment
network_name: test
vms:
- name: vm
flist: https://hub.grid.tf/tf-official-apps/base:latest.flist
entrypoint: "/sbin/zinit init"
network_name: test
cpu: 2
memory: 256
planetary: true
mounts:
- disk_name: data
mount_point: /app
env_vars:
SSH_KEY: <to be filled>
disks:
- name: data
size: 2
```
The deployment can be linked to a network using `network_name` and can have virtual machines in the `vms` section, and disks in the `disks` section. The disk can be linked and mounted in the VM if `disk_name` is used in the `mounts` section of the VM.
We also specify a couple of essential properties, like how many virtual cores, how much memory, what FList to use, and the environment variables in the `env_vars` section.
That's it! You can now execute `make run` to bring the infrastructure up.
## Kubernetes
We now see how to deploy a [Kubernetes cluster using Pulumi](https://github.com/threefoldtech/pulumi-provider-grid/blob/development/examples/kubernetes/Pulumi.yaml).
```yaml
content was removed for brevity
kubernetes:
type: grid:internal:Kubernetes
options:
provider: ${provider}
dependsOn:
- ${network}
properties:
master:
name: kubernetes
node: ${scheduler.nodes[0]}
disk_size: 2
planetary: true
cpu: 2
memory: 2048
workers:
- name: worker1
node: ${scheduler.nodes[0]}
disk_size: 2
cpu: 2
memory: 2048
- name: worker2
node: ${scheduler.nodes[0]}
disk_size: 2
cpu: 2
memory: 2048
token: t123456789
network_name: test
ssh_key: <to be filled>
outputs:
node_deployment_id: ${kubernetes.node_deployment_id}
ygg_ip: ${kubernetes.master_computed.ygg_ip}
```
Now, we define the Kubernetes resource `grid:internal:Kubernetes` that has master and workers blocks. You define almost everything like a normal VM except for the FLiist. Also note that the token is the `cluster token`. This will ensure that the workers and the master communicate properly.
## Creating a Domain
The ThreeFold Pulumi repository also covers examples on [how to work with TFGrid gateways](https://github.com/threefoldtech/pulumi-provider-grid/blob/development/examples/gateway_name/Pulumi.yaml).
The basic idea is that you have a virtual machine workload on a specific IP, e.g. public IPv4, IPv6, or Planetary Network, and you want to access it using domains.
There are two versions to achieve this, a simple and a fully controlled version.
- Simple domain version:
- subdomain.gent01.dev.grid.tf
- This is a generous service from ThreeFold to reserve a subdomain on a set of defined gateway domains like **gent01.dev.grid.tf**.
- Fully controlled domain version:
- e.g. `mydomain.com` where you manage the domain with the name provider.
### Example of a Simple Domain Prefix
We present here the file for a simple domain prefix.
```yml
content was removed for brevity
scheduler:
type: grid:internal:Scheduler
options:
provider: ${provider}
properties:
mru: 256
farm_ids: [1]
ipv4: true
free_ips: 1
gatewayName:
type: grid:internal:GatewayName
options:
provider: ${provider}
dependsOn:
- ${scheduler}
properties:
name: pulumi
node_id: ${scheduler.nodes[0]}
backends:
- "http://69.164.223.208"
outputs:
node_deployment_id: ${gatewayName.node_deployment_id}
fqdn: ${gatewayName.fqdn}
```
In this example, we create a gateway name resource `grid:internal:GatewayName` for the name `pulumi.gent01.dev.grid.tf`.
Some things to note:
- **pulumi** is the prefix we want to reserve.
- It's assuming that the gateway domain we received by scheduler was the one managed by freefarm `gent01.dev.grid.tf`.
- **backends:** defines a list of IPs to load balance against when a request for `pulumi.gent01.dev.grid.tf` is received on the gateway.
### Example of a Fully Controlled Domain
Here's an [example](https://github.com/threefoldtech/pulumi-provider-grid/blob/development/examples/gateway_fqdn/Pulumi.yaml) of a more complicated, but fully controlled domain.
```yml
code removed for brevity
gatewayFQDN:
type: grid:internal:GatewayFQDN
options:
provider: ${provider}
dependsOn:
- ${deployment}
properties:
name: testing
node_id: 14
fqdn: mydomain.com
backends:
- http://[${deployment.vms_computed[0].ygg_ip}]:9000
```
Here, we informed the gateway that any request coming for the domain `mydomain.com` needs to be balanced through the backends.
> Note: You need to create an A record for your domain (here `mydomain.com`) pointing to the gateway IP.
## Conclusion
We covered in this guide some basic details concerning the use of the ThreeFold Pulumi plugin.
If you have any questions, you can ask the ThreeFold community for help on the [ThreeFold Forum](http://forum.threefold.io/) or on the [ThreeFold Grid Tester Community](https://t.me/threefoldtesting) on Telegram.

View File

@@ -1,89 +0,0 @@
<h1> Deployment Examples</h1>
<h2>Table of Contents</h2>
- [Introduction](#introduction)
- [Prerequisites](#prerequisites)
- [Set the Environment Variables](#set-the-environment-variables)
- [Test the Plugin](#test-the-plugin)
- [Destroy the Deployment](#destroy-the-deployment)
- [Questions and Feedback](#questions-and-feedback)
***
## Introduction
[Pulumi](https://www.pulumi.com/) is an infrastructure as code platform that allows you to use familiar programming languages and tools to build, deploy, and manage cloud infrastructure.
We present here the basic steps to test the examples within the [ThreeFold Pulumi](https://github.com/threefoldtech/pulumi-threefold) plugin repository. Once you've set the plugin and exported the necessary variables, the deployment process from one example to another is very similar.
Please note that the Pulumi plugin for ThreeFold Grid is not yet officially published. We look forward to your feedback on this project.
## Prerequisites
There are a few things to set up before exploring Pulumi. Since we will be using the examples in the ThreeFold Pulumi repository, we must clone the repository before going further.
* [Install Pulumi](./pulumi_install.md) on your machine
* Clone the **Pulumi-ThreeFold** repository
* ```
git clone https://github.com/threefoldtech/pulumi-threefold
```
* Change directory
* ```
cd ./pulumi-threefold
```
## Set the Environment Variables
You can export the environment variables before deploying workloads.
* Export the network (**dev**, **qa**, **test**, **main**). Note that we are using the **dev** network by default.
* ```
export NETWORK="Enter the network"
```
* Export your mnemonics.
* ```
export MNEMONIC="Enter the mnemonics"
```
* Export the SSH_KEY (public key).
* ```
export SSH_KEY="Enter the public Key"
```
## Test the Plugin
Once you've properly set the prerequisites, you can test many of the examples by simply going into the proper repository and running **make run**.
The different examples that work simply by running **make run** are the following:
* virtual_machine
* kubernetes
* network
* zdb
* gateway_name
We give an example with **virtual_machine**.
* Go to the directory **virtual_machine**
* ```
cd examples/virtual_machine
```
* Deploy the Pulumi workload with **make**
* ```
make run
```
Note: To test **gateway_fqdn**, you will have to update the fqdn in **Pulumi.yaml** and create an A record for your domain pointing to the gateway IP.
## Destroy the Deployment
You can destroy your Pulumi deployment at any time with the following make command:
```
make destroy
```
## Questions and Feedback
If you have any questions, you can ask the ThreeFold community for help on the [ThreeFold Forum](http://forum.threefold.io/) or on the [ThreeFold Grid Tester Community](https://t.me/threefoldtesting) on Telegram.

View File

@@ -1,44 +0,0 @@
<h1> Installing Pulumi </h1>
<h2>Table of Contents</h2>
- [Introduction](#introduction)
- [Installation](#installation)
- [Verification](#verification)
***
## Introduction
You can install [Pulumi](https://www.pulumi.com/) on Linux, MAC and Windows.
To install Pulumi, simply follow the steps provided in the [Pulumi documentation](https://www.pulumi.com/docs/install/). We cover the basic steps here for convenience.
## Installation
* Install on Linux
* ```
curl -fsSL https://get.pulumi.com | sh
```
* Install on MAC
* ```
brew install pulumi/tap/pulumi
```
* Install on Windows
* ```
choco install pulumi
```
For Linux, if you prefer checking the shell script before executing, please do so.
For Windows, note that there are other installation methods. Read the [Pulumi documentation](https://www.pulumi.com/docs/install/) for more information.
## Verification
To verify that Pulumi is properly installed on your machine, use the following command:
```
pulumi version
```
If you need more in-depth information, e.g. installing a specific version or migrating from an older version, please check the [installation documentation](https://www.pulumi.com/docs/install/).

View File

@@ -1,130 +0,0 @@
<h1>Introduction to Pulumi</h1>
With Pulumi, you can express your infrastructure requirements using the languages you know and love, creating a seamless bridge between development and operations. Let's go!
<h2>Table of Contents</h2>
- [Introduction](#introduction)
- [Benefits of Using Pulumi](#benefits-of-using-pulumi)
- [Declarative vs. Imperative Programming](#declarative-vs-imperative-programming)
- [Declaration Programming Example](#declaration-programming-example)
- [Benefits of declarative programming in IaC](#benefits-of-declarative-programming-in-iac)
- [Concepts](#concepts)
- [Pulumi Project](#pulumi-project)
- [Project File](#project-file)
- [Stacks](#stacks)
- [Resources](#resources)
- [Questions and Feedback](#questions-and-feedback)
***
## Introduction
[ThreeFold Grid](https://threefold.io) is a decentralized cloud infrastructure platform that provides developers with a secure and scalable way to deploy and manage their applications. It is based on a peer-to-peer network of nodes that are distributed around the world.
[Pulumi](https://www.pulumi.com/) is a cloud-native infrastructure as code (IaC) platform that allows developers to manage their infrastructure using code. It supports a wide range of cloud providers, including ThreeFold Grid.
The [Pulumi plugin for ThreeFold Grid](https://github.com/threefoldtech/pulumi-provider-grid) provides developers with a way to deploy and manage their ThreeFold Grid resources using Pulumi. This means that developers can benefit from all of the features and benefits that Pulumi offers, such as cross-cloud support, type safety, preview and diff, and parallel execution -still in the works-.
Please note that the Pulumi plugin for ThreeFold Grid is not yet officially published. We look forward to your feedback on this project.
## Benefits of Using Pulumi
Here are some additional benefits of using the Pulumi plugin for ThreeFold Grid:
- Increased productivity: Pulumi allows developers to manage their infrastructure using code, which can significantly increase their productivity.
- Reduced errors: Pulumi's type safety and preview and diff features can help developers catch errors early, which can reduce the number of errors that occur in production.
- Improved collaboration: Pulumi programs can be shared with other developers, which can make it easier to collaborate on infrastructure projects.
The Pulumi plugin for ThreeFold Grid is a powerful tool that can be used to deploy and manage a wide range of ThreeFold Grid applications. It is a good choice for developers who want to manage their ThreeFold Grid infrastructure using code and benefit from all of the features and benefits that Pulumi offers.
## Declarative vs. Imperative Programming
Declarative programming and imperative programming are two different ways to write code. Declarative programming focuses on describing the desired outcome, while imperative programming focuses on describing the steps needed to achieve that outcome.
In the context of infrastructure as code (IaC), declarative programming allows you to describe your desired infrastructure state, and the IaC tool will figure out how to achieve it. Imperative programming, on the other hand, requires you to describe the steps needed to create and configure your infrastructure.
### Declaration Programming Example
Say I want an infrastructure of two virtual machines with X disks. The following would happen:
1. Connect to the backend services.
2. Send the requests to create the virtual machines.
3. Sign the requests.
4. Execute the requests in a careful order.
As you can see, the declarative code is much simpler and easier to read. It also makes it easier to make changes to your infrastructure, as you only need to change the desired state, and the IaC tool will figure out how to achieve it.
### Benefits of declarative programming in IaC
There are several benefits to using declarative programming in IaC:
- Simpler code: Declarative code is simpler and easier to read than imperative code. This is because declarative code focuses on describing the desired outcome, rather than the steps needed to achieve it.
- More concise code: Declarative code is also more concise than imperative code. This is because declarative code does not need to specify the steps needed to achieve the desired outcome.
- Easier to make changes: Declarative code makes it easier to make changes to your infrastructure. This is because you only need to change the desired state, and the IaC tool will figure out how to achieve it.
- More reliable code: Declarative code is more reliable than imperative code. This is because declarative code does not need to worry about the order in which the steps are executed. The IaC tool will take care of that.
We will be taking a look at a couple of examples, I'll be linking the source directory of the example and go through it, but first let's go through some concepts first
## Concepts
### Pulumi Project
A Pulumi project is any folder that contains a **Pulumi.yaml** file. When in a subfolder, the closest enclosing folder with a **Pulumi.yaml** file determines the current project. A new project can be created with pulumi new. A project specifies which runtime to use and determines where to look for the program that should be executed during deployments. Supported runtimes are nodejs, python, dotnet, go, java, and yaml.
### Project File
The **Pulumi.yaml** project file specifies metadata about your project. The project file must begin with a capitalized P, although either a **.yml** or **.yaml** extension will work.
A typical Pulumi.yaml file looks like the following:
```yaml
name: my-project
runtime:
name: go
options:
binary: mybinary
description: A minimal Go Pulumi program
```
or
```yaml
name: my-project
runtime: yaml
resources:
bucket:
type: aws:s3:Bucket
```
For more on project or project files, please check the [Pulumi documentation](https://www.pulumi.com/docs/concepts/projects/).
### Stacks
Every Pulumi program is deployed to a [stack](https://www.pulumi.com/docs/concepts/stack/). A stack is an isolated, independently configurable instance of a Pulumi program. Stacks are commonly used to denote different phases of development (such as development, staging, and production) or feature branches (such as feature-x-dev).
A project can have as many stacks as you need. By default, Pulumi creates a stack for you when you start a new project using the **pulumi new** command.
### Resources
Resources represent the fundamental units that make up your cloud infrastructure, such as a compute instance, a storage bucket, or a Kubernetes cluster.
All infrastructure resources are described by one of two subclasses of the Resource class. These two subclasses are:
- CustomResource: A custom resource is a cloud resource managed by a resource provider such as AWS, Microsoft Azure, Google Cloud, or Kubernetes.
- ComponentResource: A component resource is a logical grouping of other resources that creates a larger, higher-level abstraction that encapsulates its implementation details.
Here's an example:
```yaml
resources:
res:
type: the:resource:Type
properties: ...args
options: ...options
```
## Questions and Feedback
If you have any questions, you can ask the ThreeFold community for help on the [ThreeFold Forum](http://forum.threefold.io/) or on the [ThreeFold Grid Tester Community](https://t.me/threefoldtesting) on Telegram.

View File

@@ -1,12 +0,0 @@
<h1> Pulumi Plugin</h1>
Welcome to the *Pulumi Plugin* section of the ThreeFold Manual!
In this section, we will explore the dynamic world of infrastructure as code (IaC) through the lens of Pulumi, a versatile tool that empowers you to define, deploy, and manage infrastructure using familiar programming languages.
<h2>Table of Contents</h2>
- [Introduction to Pulumi](./pulumi_intro.md)
- [Installing Pulumi](./pulumi_install.md)
- [Deployment Examples](./pulumi_examples.md)
- [Deployment Details](./pulumi_deployment_details.md)