-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
3 changed files
with
208 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
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 | ||
rm -rf ${current_dir}/state |
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,104 @@ | ||
name: pulumi-threefold | ||
runtime: yaml | ||
|
||
resources: | ||
provider: | ||
type: pulumi:providers:threefold | ||
options: | ||
pluginDownloadURL: github://api.github.com/threefoldtech/pulumi-threefold # optional | ||
properties: | ||
mnemonic: | ||
|
||
scheduler: | ||
type: threefold:provider:Scheduler | ||
options: | ||
provider: ${provider} | ||
properties: | ||
mru: 4 # 4gb ram | ||
sru: 100 # 100gb storage | ||
farm_ids: [71,73, 74, 76, 77] | ||
|
||
network: | ||
type: threefold:provider:Network | ||
options: | ||
provider: ${provider} | ||
dependsOn: | ||
- ${scheduler} | ||
properties: | ||
name: test | ||
description: test network | ||
nodes: | ||
- ${scheduler.nodes[0]} | ||
ip_range: 10.1.0.0/16 | ||
mycelium: true | ||
# mycelium_keys: | ||
# manual_nodeID: 9751c596c7c951aedad1a5f78f18b59515064adf660e0d55abead65e6fbbd627 # hex encoded 32 bytes [example] | ||
|
||
deployment: | ||
type: threefold:provider: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: 4000 | ||
planetary: true | ||
mycelium: true | ||
# mycelium_ip_seed: b60f2b7ec39c # hex encoded 6 bytes [example] | ||
mounts: | ||
- disk_name: data | ||
mount_point: /app | ||
env_vars: | ||
SSH_KEY: | ||
|
||
- name: vm2 | ||
flist: https://hub.grid.tf/tf-official-apps/base:latest.flist | ||
entrypoint: "/sbin/zinit init" | ||
network_name: test | ||
cpu: 2 | ||
memory: 4000 | ||
planetary: true | ||
mycelium: true | ||
# mycelium_ip_seed: b60f2b7ec39c # hex encoded 6 bytes [example] | ||
mounts: | ||
- disk_name: data | ||
mount_point: /app | ||
env_vars: | ||
SSH_KEY: | ||
|
||
- name: vm3 | ||
flist: https://hub.grid.tf/tf-official-apps/base:latest.flist | ||
entrypoint: "/sbin/zinit init" | ||
network_name: test | ||
cpu: 2 | ||
memory: 4000 | ||
planetary: true | ||
mycelium: true | ||
# mycelium_ip_seed: b60f2b7ec39c # hex encoded 6 bytes [example] | ||
mounts: | ||
- disk_name: data | ||
mount_point: /app | ||
env_vars: | ||
SSH_KEY: | ||
|
||
disks: | ||
- name: data | ||
size: 2 | ||
|
||
outputs: | ||
node_deployment_id: ${deployment.node_deployment_id} | ||
planetary_ip1: ${deployment.vms_computed[0].planetary_ip} | ||
mycelium_ip1: ${deployment.vms_computed[0].mycelium_ip} | ||
planetary_ip2: ${deployment.vms_computed[1].planetary_ip} | ||
mycelium_ip2: ${deployment.vms_computed[1].mycelium_ip} | ||
planetary_ip3: ${deployment.vms_computed[2].planetary_ip} | ||
mycelium_ip3: ${deployment.vms_computed[2].mycelium_ip} |
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,90 @@ | ||
# multiple vms | ||
|
||
This examples deploys 3 vms on GE farms and prints planetary and mycelium IPs | ||
|
||
To run examples, make sure you have a mnemonic and a network set. | ||
|
||
```bash | ||
|
||
export MNEMONIC="mnemonic words" | ||
export NETWORK="network" # dev, qa, test, main -> default is dev | ||
``` | ||
|
||
- Go to the examples directory `cd yaml/multiple_vms` | ||
- Run the example `make run` | ||
- To cleanup the resources that you created `make destroy` | ||
|
||
|
||
## example of the run | ||
|
||
``` | ||
➜ multiple_vms git:(development_readme_edits) ✗ make run | ||
rm -rf /home/xmonader/wspace/pulumi-threefold/examples/yaml/multiple_vms/state | ||
mkdir /home/xmonader/wspace/pulumi-threefold/examples/yaml/multiple_vms/state | ||
pulumi login --cloud-url file:///home/xmonader/wspace/pulumi-threefold/examples/yaml/multiple_vms/state | ||
Logged in to xmonader-ThinkPad-E580 as xmonader (file:///home/xmonader/wspace/pulumi-threefold/examples/yaml/multiple_vms/state) | ||
pulumi stack init test | ||
Created stack 'test' | ||
Enter your passphrase to protect config/secrets: | ||
Re-enter your passphrase to confirm: | ||
pulumi up --yes | ||
Enter your passphrase to unlock config/secrets | ||
(set PULUMI_CONFIG_PASSPHRASE or PULUMI_CONFIG_PASSPHRASE_FILE to remember): | ||
Enter your passphrase to unlock config/secrets | ||
Previewing update (test): | ||
Type Name Plan Info | ||
+ pulumi:pulumi:Stack pulumi-threefold-test create 2 messages | ||
+ ├─ pulumi:providers:threefold provider create | ||
+ ├─ threefold:provider:Scheduler scheduler create | ||
+ ├─ threefold:provider:Network network create | ||
+ └─ threefold:provider:Deployment deployment create | ||
Diagnostics: | ||
pulumi:pulumi:Stack (pulumi-threefold-test): | ||
5:12PM INF starting peer session=tf-1370865 twin=10466 | ||
threefold grid provider setup | ||
Outputs: | ||
mycelium_ip1 : output<string> | ||
mycelium_ip2 : output<string> | ||
mycelium_ip3 : output<string> | ||
node_deployment_id: output<string> | ||
planetary_ip1 : output<string> | ||
planetary_ip2 : output<string> | ||
planetary_ip3 : output<string> | ||
Resources: | ||
+ 5 to create | ||
Updating (test): | ||
Type Name Status Info | ||
+ pulumi:pulumi:Stack pulumi-threefold-test created (55s) 2 messages | ||
+ ├─ pulumi:providers:threefold provider created (0.00s) | ||
+ ├─ threefold:provider:Scheduler scheduler created (18s) | ||
+ ├─ threefold:provider:Network network created (5s) | ||
+ └─ threefold:provider:Deployment deployment created (26s) | ||
Diagnostics: | ||
pulumi:pulumi:Stack (pulumi-threefold-test): | ||
5:12PM INF starting peer session=tf-1370948 twin=10466 | ||
threefold grid provider setup | ||
Outputs: | ||
mycelium_ip1 : "48b:f156:b548:4ba8:ff0f:c6e1:8a56:62d5" | ||
mycelium_ip2 : "48b:f156:b548:4ba8:ff0f:9474:96c9:6a4e" | ||
mycelium_ip3 : "48b:f156:b548:4ba8:ff0f:2d39:7cc9:b410" | ||
node_deployment_id: { | ||
310: 608143 | ||
} | ||
planetary_ip1 : "300:c0f2:7fbb:8e29:cc2d:85a5:7b14:ea52" | ||
planetary_ip2 : "300:c0f2:7fbb:8e29:2e5b:3c5d:6fb4:27dc" | ||
planetary_ip3 : "300:c0f2:7fbb:8e29:736c:d326:6286:3f5b" | ||
Resources: | ||
+ 5 created | ||
Duration: 56s | ||
``` |