Commit cd8e0921 authored by Lincoln Thurlow's avatar Lincoln Thurlow 👈🏻 Committed by Ryan Goodfellow
Browse files

cli assets


Signed-off-by: Lincoln Thurlow's avatarLincoln Thurlow <lincoln@isi.edu>
parent 9a8e26a8
FROM debian:bullseye
MAINTAINER Geoff Lawler glawler@isi.edu
RUN apt-get update && apt-get install -y \
npm \
git
# copy over all our development files
# this is not a mount, so changes need re-run
COPY / /
# install dependencies
RUN npm install
# run npm build script
RUN npm run build
# cheeky, change npm start script to host for external
RUN sed -i 's/docusaurus start/docusaurus start --host 0.0.0.0/g' package.json
# expose default port
EXPOSE 3000
# run webserver
CMD ["npm", "run", "start"]
all: run
build:
docker build -t website:dev -f Dockerfile .
#docker build --no-cache -t website:dev -f Dockerfile .
run: build
docker run -p 3000:3000 website:dev
......@@ -2,6 +2,18 @@
This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator.
## Container Development
There is now a container which can be used to verify rendering. Unlike modern web development
containers, this container does not have a watch function and is not mounted to the host, so
no changes are rendered while editing is being done. Make sure to rebuild the container.
```
sudo make
```
The website will show up locally on your host machine on port `3000`.
### Installation
```
......
......@@ -93,6 +93,13 @@ augment your systems CA pool with an additional CA chain from a PEM file.
- [addkey](#addkey)
- [rmkey](#rmkey)
### Assets
- [new](#newasset)
- [delete](#deleteasset)
- [show](#showasset)
- [list](#listasset)
## Command reference
### Administrative
......@@ -650,3 +657,93 @@ Global Flags:
-p, --project string project to use (defaults to personal project)
```
#### newasset
Create a new asset (experiment storage).
```shell
Create a new static asset object
Usage:
mergetb new asset [command]
Available Commands:
blockdevice Create a new block device
filesystem Create a new filesystem mount
Flags:
-h, --help help for asset
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-j, --json output as json
-p, --project string project to use (defaults to personal project)
```
Create a new filesystem asset on given sites.
```shell
Usage:
mergetb new asset filesystem <site[,site]> <name> <size> [flags]
Flags:
-h, --help help for filesystem
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-j, --json output as json
-p, --project string project to use (defaults to personal project)
```
#### deleteasset
Delete an asset (experiment storage).
```shell
Usage:
mergetb delete asset <site[,site]> <name> [flags]
Flags:
-h, --help help for asset
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-j, --json output as json
-p, --project string project to use (defaults to personal project)
```
#### showasset
Show details about a specific asset.
```shell
Usage:
mergetb show asset <site[,site]> <name> [flags]
Flags:
-h, --help help for asset
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-j, --json output as json
-p, --project string project to use (defaults to personal project)
```
#### listasset
List details for all assets under the current project.
```shell
List project assets
Usage:
mergetb list assets [flags]
Flags:
-h, --help help for assets
Global Flags:
-c, --cert string TLS cert to use for connecting to portal
-j, --json output as json
-p, --project string project to use (defaults to personal project)
```
......@@ -146,6 +146,48 @@ topology. When we realize this experiment, this constraint will cause Merge to
launch something called a reticulator to calculate a complete set of
routes for our experiment and generate an augmented model with routes included.
## Experiment storage
We can also define filesystems where we can store experiment data and artifacts.
There is currently one type of storage (filesystems), with two types of
longevity (storage lifetime): experiment and site. Experiment storage lives for
the duration of the experiment, and site storage lives for the lifetime of a
site. These will be explained further in later sections, but for now, let us
look at an example of creating an experiment using storage in our experiment
description.
```python
import mergexp as mx
from mergexp.unit import gb
# create a topology named storage
net = mx.Topology('storage')
# create a definition for a filesystem (fs) storage with a 10GB quota
siteAsset = mx.Storage(kind="fs", size=gb(10), name="staticAsset")
# create three nodes: a, b, and c and connect them on a LAN
nodes = [net.device(name) for name in ['a', 'b', 'c']]
lan = net.connect(nodes)
# statically assign each node with an ip address
for i,e in enumerate(lan.endpoints, 1):
e.ip.addrs = ['10.0.0.%d/24' % i]
# mount our filesystem on each node under /mnt directory
# mount takes 2 arguments: where to mount, and the object to mount
for node in nodes:
node.mount("/mnt/%s" % siteAsset.name, siteAsset)
mx.experiment(net)
```
In this example we've created a 3 node experiment, with each node mounting
the storage at /mnt/staticAsset. Each node will have access to the network
storage, creating an ideal situtation for sharing large amounts of data between
nodes.
## Realization
Realization is the process calculating a minimum cost embedding of an
......@@ -228,11 +270,11 @@ guide](/docs/automation-basics).
The following set of links will help guide you through the process of creating
Merge experiments.
- [Beginner Walk-through via the Web Interface](/docs/web):
- [Beginner Walk-through via the Web Interface](/docs/web):
The complete experimentation using the web interface.
- [Example Experiment Topologies](/docs/hello-world):
- [Example Experiment Topologies](/docs/hello-world):
Example topologies to get a feel for what describing experiments in Merge is like.
- [Managing Experiments through the CLI](/docs/cli):
- [Managing Experiments through the CLI](/docs/cli):
A guided tour of using the command line interface to interact with merge.
- [Experiment Automation Guide](/docs/automation-basics):
- [Experiment Automation Guide](/docs/automation-basics):
How to automate experiment scenarios once an experiment has been materialized.
---
id: storage-example
title: Storage
---
We can also define filesystems where we can store experiment data and artifacts.
There is currently one type of storage (filesystems), with two types of
longevity (storage lifetime): experiment and site. Experiment storage lives for
the duration of the experiment, and site storage lives for the lifetime of a
site. These will be explained further in later sections, but for now, let us
look at an example of creating an experiment using storage in our experiment
description.
### Complete Example
```python
import mergexp as mx
from mergexp.unit import gb
# create a topology named storage
net = mx.Topology('storage')
# create a definition for a filesystem (fs) storage with a 10GB quota
siteAsset = mx.Storage(kind="fs", size=gb(10), name="staticAsset")
# create three nodes: a, b, and c and connect them on a LAN
nodes = [net.device(name) for name in ['a', 'b', 'c']]
lan = net.connect(nodes)
# statically assign each node with an ip address
for i,e in enumerate(lan.endpoints, 1):
e.ip.addrs = ['10.0.0.%d/24' % i]
# mount our filesystem on each node under /mnt directory
# mount takes 2 arguments: where to mount, and the object to mount
for node in nodes:
node.mount("/mnt/%s" % siteAsset.name, siteAsset)
mx.experiment(net)
```
There are two important parts of this code. First is creating an asset:
```python
siteAsset = mx.Storage(kind="fs", size=gb(10), name="staticAsset")
```
Here we define an xir.Storage resource of type `fs` (filesystem), a quota
of 10gb, and a name of `staticAsset`. That name is what will be referenced
when using the cli to get the details of the asset.
The second integral piece is that we need to tell the xir that while we've
create this asset, that we would like this asset to be apart of our
experiment, and for that we need to invoke `mount`:
```python
node.mount("/mnt/%s" % siteAsset.name, siteAsset)
```
Mount, tells the xir, that this asset will be attached to a node in our
experiment. The first input to mount is the path to mount on the node,
in the exmaple above it would be `/mnt/[a,b,c]` depending on the node,
and the asset itself. You can mount multiple assets to a node.
This diff is collapsed.
......@@ -17,6 +17,7 @@ module.exports = {
'emulation',
'images',
'fattree',
'storage-example',
],
'Experiment Development': [
'automation-basics',
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment