Cross-platform tools for running perf and stress tests
Перейти к файлу
Immo Landwerth bbddd6b4ff
Link Code of Conduct (#59)
2020-04-09 13:07:50 -07:00
.vscode Cold Start automation logic 2016-06-22 15:06:25 -07:00
broker Update Broker image: Add support for readonly user 2016-05-28 07:07:16 +00:00
brokeragent Add docker image - Broker + Agent 2016-05-30 09:27:49 +00:00
client Update readme file (#50) 2016-09-30 15:34:05 -07:00
flows Shutdown scenario support 2016-05-25 10:41:40 -07:00
infra Added ShutDownVMsInRescourceGroup.ps1 2016-07-15 18:17:51 -07:00
libs Fix reboot regression for simple commands 2016-06-08 02:41:28 -07:00
scripts Handle null clientid (#34) 2016-06-09 16:23:16 -07:00
tools Added a tool to download from a url and extract content to target dir… (#35) 2016-06-11 01:40:46 -07:00
.gitignore Update gitignore file to reflect the coldstart automation 2016-09-29 11:54:17 -07:00
CODE-OF-CONDUCT.md Link Code of Conduct (#59) 2020-04-09 13:07:50 -07:00
CONTRIBUTING.md Update contributing.md and LICENSE. 2016-05-08 01:31:51 -07:00
LICENSE.txt Rename LICENSE to LICENSE.txt 2016-05-08 01:33:25 -07:00
README.md Shutdown scenario support 2016-05-25 10:41:40 -07:00
app.js Shutdown scenario support 2016-05-25 10:41:40 -07:00
config.js Move the creds under the client folder so that we only need a single. 2016-05-13 12:30:22 -07:00
jsconfig.json Added reading broker and other config information from settings. 2016-04-14 13:41:10 -07:00
package.json update execute to new package. 2016-05-09 14:56:40 -07:00
setup.js Handle null clientid (#34) 2016-06-09 16:23:16 -07:00

README.md

Overview

Wave provides a tool-set for cross platform remote command execution.

  • Based on nodejs for platform abstraction
  • Uses MQTT broker for communication.
  • Mark down based execution engine
  • Controller/CLI for sending commands and viewing real time outputs from targets.

Controller & Command Execution

The controller is an orchestrator that coordinates and sequences commands. The controller subscribes on job/controllerid topic and uses commands from a markdown table as follows. The controller is based on callbacks from the target agent as a mechanism of flow control. Commands are defined in markdown table with the following layout -

Command Host Description
./startServer.sh $(server) server command
.\loadtest.cmd $(server) $(serverurl) $(client) Client command

Client CLI/Web Client

The commands can be directly sent the target using the CLI. There is also a web client which gives a remote shell like experience. For details of the command line client goto ./client

Agent & Controller Overview

The agent communication is handled through a set of topics which it listens to and outputs messages to. The controller or CLI communicates to the well-know topic as the contracts defined below.

Topic Description
hostid Subscribed by the host for synchronous command execution
hostid/async Subscribed by the host and commands are executed asynchronously
hostid/output Command output stream
hostid/status Last command executed
client/hostid/config Birth and will message which is retained and includes config details like IP and status
  • Hostid defaults to hostname unless we override the value.

The diagram below provides an overview of the communication mechanism between the agents and CLI/Controller.

Alt text

Agent Setup

Windows

Install Node if needed.

msiexec /i https://nodejs.org/dist/v5.11.0/node-v5.11.0-x64.msi /passive

Setup the agent with the required credentials.

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "&{$target='c:\cmdport\';$broker='test';$username='test';$password='test';iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Wave/master/scripts/Install.ps1'))}" 

Ubuntu 14.04

Git clone the repo and run the install script as follows.

git clone http://github.com/aspnet/Wave
sudo ./Wave/scripts/install.sh testbroker testuser testpassword

This sets up the flow and connects to the broker and makes the machine ready for remote commands. Refer to install.sh for details.
The following commands should be used to setup or remove the agent as needed.

sudo update-rc.d cmdport defaults 
sudo update-rc.d -f cmdport remove

Optional:

To allow shutdown scenario to work, add the following line to the sudoer file to avoid interactive prompt. Note that we do not currently support poweroff and reboot commands.

user_name ALL=(ALL) NOPASSWD: /sbin/shutdown

Docker

Docker Pulls

The docker image is based of the node:argon image and contains the agent that can be started using the following commands and the logs command enables you to see if the broker succcessfully connected or not.

docker pull dotnetperf/wave
docker run --name wave1 -p 8001:8000 -e BROKER=[broker] -e PORT=[port] -e USERNAME=[username] -e PASSWORD=[password] -h [hostname] -d dotnetperf/wave
docker logs wave1

The image takes 3 environment variables and the hostname which is used to setup the credentials in the agent. Refer to the Dockerfile

To connect to the running instance use the following command to start an interactive shell.

docker exec -it wave1 /bin/sh

Once you are done with the agent, you can use the following commands to stop the container and delete the image if necessary.

docker stop wave1 && docker rm wave1
docker rmi dotnetperf/wave

If you are deploying containers on Ubuntu VM on Hyper-V, then:

  • run nm-tool on the Ubuntu VM and pick any one of the DNS addresses in the output
  • sudo vi /etc/default/docker and add the DNS ip to DOCKER_OPTS parameter.
  • sudo service docker restart

Broker Setup

The following instructions are for a standard Mosquitto MQTT broker.

  1. Use the following instructions to setup an MQTT broker for command dispatch.

    sudo apt-add-repository ppa:mosquitto-dev/mosquitto-ppa
    sudo apt-get update
    sudo apt-get -y install mosquitto
    sudo apt-get -y install mosquitto-clients
    
  2. Configure the password and disable anonymous access

    sudo mosquitto_passwd -c /etc/mosquitto/pwfile  <username>
    sudo nano /etc/mosquitto/mosquitto.conf
    
  3. Add the following to disable anonymous access and enable websockets.

    password_file /etc/mosquitto/pwfile
    allow_anonymous false
    
    port 1883
    listener 1884
    protocol websockets
    
  4. Restart the service

    sudo service mosquitto restart
    
  5. To be able to connect to the broker you need to open up the port 1883 for Mosquitto. The following setup is for an azure VM. Follow the bread crumb described below and allow incoming packets for port 1883 for Azure VMs.

    VM >> Settings >> Network Interfaces >> Network Interface >> Settings >> Network Security Group >> Settings >> Inbound Rules