Skip to content

Commands

Axel Niklasson edited this page Oct 16, 2019 · 6 revisions

Commands

This page contains information about all commands in plcli.

Usage: plcli [global_flags] command [command_flags] arguments..

Global flags

  • --slice SLICE_NAME: name of slice to use when connecting to PlanetLab
  • --workers WORKER_COUNT: number of workers (goroutines) to use
  • --sudo: if set, all commands will be run as sudo on nodes

Example: executing "ls /" on all nodes with all global flags present

Global flags are used as follows: plcli --slice customSlice --workers 3 --sudo execute "ls /" all

Init

init creates a file ~/.plcli that contains four entries that are used by plcli:

Usage: plcli init

  1. Your PlanetLab username
  2. Your PlanetLab password
  3. Your default slice to use when connecting (can always be overridden with global flag --slice)
  4. What SSH key to use

How a ~/.plcli file might look:

[auth]
pl_username      = axelni@student.chalmers.se
pl_password      = correcthorsebatterystaple
pl_slice         = chalmersple_2018_10_29
ssh_key_abs_path = ~/.ssh/id_rsa

Connect

connect is used to establish a SSH connection to a node attached to your slice.

Usage: plcli connect NODE

Example: connecting to node cse-yellow.cse.chalmers.se

plcli connect cse-yellow.cse.chalmers.se

Execute

execute helps you execute commands on one, several or all nodes attached to your default slice. If you wish to execute on multiple hosts, then make sure to supply the hostnames as a comma-separated string. Make sure to enclose the command you wish to execute with quotes.

Usage: plcli execute COMMAND all|HOSTNAME|HOSTNAME1,HOSTNAME2...

Example: execute command on one node

plcli execute "ls /" cse-yellow.cse.chalmers.se

Example: execute on multiple nodes

plcli execute "ls /" cse-yellow.cse.chalmers.se,cse-white.cse.chalmers.se

Example: execute command on all nodes attached to slice

plcli execute "ls /" all

Transfer

transfer helps you transfer files/folders to a given node.

Usage: plcli transfer NODE LOCAL_PATH_TO_FILE_FOLDER TARGET_PATH

Example: transfer folder foo/ in same directory to ~/bar on node cse-yellow.cse.chalmers.se

plcli transfer cse-yellow.cse.chalmers.se ./foo \~/bar

Slice details

slice-details list a bunch of information of your slice.

Usage: plcli slice-details

Example: list details for default slice

plcli slice-details

$ plcli slice-details
2019/10/16 13:44:05 Slice details

Creator: 1952
Instantiation: plc-instantiated
SliceAttributeIDS: []
Name: chalmersple_2018_10_29
SliceID: 1578
Created: 1540838211
URL: https://chalmers.se
MaxNodes: 100
PersonIDs: [67982 65557 68247]
Expires: 1573497411
SiteID: 115
PeerSliceID: 0
NodeIDs: [7 22 36 76 91 166 220 288 2603 2607 2644 2667 14784 16111]
PeerID: 0
Description: This slice is currently being used for testing the implementation of a BFT SMR protocol based on Failure Detectors, as part of a M.Sc. thesis during 2019.

List nodes

list-nodes lists nodes attached to your default slice (surprise!)

Usage: plcli list-nodes

Example: list nodes attached to default slice

plcli list-nodes

$ plcli list-nodes
2019/10/16 13:45:48 IDs of nodes attached to slice chalmersple_2018_10_29: [7 22 36 76 91 166 220 288 2603 2607 2644 2667 14784 16111]

Health check

health-check performs a health check on all nodes attached to your slice through the bundled health check script. It essentially checks for internet access and opens a port and makes sure that it is possible to connect to the node on that port.

Usage: plcli health-check [--remove-faulty]

Flags

  • --remove-faulty: if set, all unhealthy nodes are removed from slice
$ plcli health-check

...

2019/10/16 13:47:26 Found 14 healthy and 0 faulty nodes!

### Healthy nodes ###
planetlab-1.ida.liu.se [91]
cse-yellow.cse.chalmers.se [2667]
pl1.prakinf.tu-ilmenau.de [7]
kulcha.mimuw.edu.pl [2644]
planetlab1.informatik.uni-goettingen.de [220]
planetlab-2.ing.unimo.it [22]
icnalplabs1.epfl.ch [16111]
planetlab2.xeno.cl.cam.ac.uk [166]
ple43.planet-lab.eu [2607]
ple41.planet-lab.eu [2603]
planetlab1.u-strasbg.fr [76]
planetlab1.upm.ro [36]
planetlab2.upm.ro [288]
mars.planetlab.haw-hamburg.de [14784]

### Faulty nodes ###
No nodes to print!

Discover healthy

discover-healthy attaches all nodes on PlanetLab to your slice, waits for 20 minutes to make sure that all nodes know that they are attached to your slice and then performs a health check on all these nodes The results are written to a file nodes.txt in the same directory.

Usage: plcli discover-healthy [--attach-to-slice]

Flags

  • --attach-to-slice: if set, all healthy nodes are attached to slice

Example: finding healthy nodes and attaching them to the slice

plcli discover-healthy --attach-to-slice

Deploy

deploy is used to deploy an application residing in a public git repository to a given amount of nodes.

Usage: plcli deploy [flags] GIT_URL

Flags

  • --node-count NODE_COUNT: the amount of nodes to deploy application to
  • --skip-healthcheck: if set, no health check is carried out on nodes before deployment
  • --scale COUNT: number of app instances to launch on each node
  • --git-branch BRANCH: what git branch to deploy
  • --app-path PATH: where the app should be stored on a node during deployment
  • --prometheus-sd-path PATH: if set, plcli will generate sd.json for prometheus and write to supplied path
  • --node-exporter: if set, node-exporter will be installed and launched on port 2100 on each node
  • --shuffle-nodes: if set, nodes will be shuffled prior to deployment
  • --skip-write-hosts-file: if set, no file called hosts_deployment.txt will be written to current directory
  • --blacklist HOSTS: comma-separated string of hostnames (HOSTNAME1,HOSTNAME2...) to blacklist (not use) in the deployment
  • --env ENV_VARS: string of env vars (VAR1=VAL1,VAR2=VAL2,...) to use in deployment

Example: deploying an application to six nodes without any extra flags

plcli deploy --node-count 6 https://github.com/axelniklasson/self-stabilizing-uniform-reliable-broadcast.git

Example: deploying an application to six nodes with all flags

plcli deploy --node-count 6 --skip-healthcheck --scale 1 --git-branch master --app-path /app --prometheus-sd-path ./prom/sd.json --node-exporter --shuffle-nodes --skip-write-hosts-file --blacklist cse-yellow.cse.chalmers.se,cse-white.cse.chalmers.se --env APP_ENV=planetlab https://github.com/axelniklasson/self-stabilizing-uniform-reliable-broadcast.git

Provision

provision is used to provision nodes, which essentially means to transfer a script and run it on all nodes. This script should ideally contain code for installing software needed to run your applications etc.

Usage: plcli provision PATH_TO_SCRIPT all|HOSTNAME|HOSTNAME1,HOSTNAME2...

Example: provisioning one node using a provision script in same directory

plcli provision ./provision.sh cse-yellow.cse.chalmers.se

Example: provisioning two nodes using a provision script in same directory

plcli provision ./provision.sh cse-yellow.cse.chalmers.se,cse-white.cse.chalmers.se

Example: provisioning all nodes attached to slice using a provision script in same directory

plcli provision ./provision.sh all

Cleanup

cleanup is used to kill all processes started by your user and wipe your home directory on the given nodes, so use it with care.

Usage: plcli cleanup all|HOSTNAME|HOSTNAME1,HOSTNAME2...

Example: cleanup on one node

plcli cleanup cse-yellow.cse.chalmers.se

Example: cleanup on multiple nodes

plcli cleanup cse-yellow.cse.chalmers.se,cse-white.cse.chalmers.se

Example: cleanup on all nodes attached to slice

plcli execute cleanup all