platform

package
v0.0.0-...-53feb6c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2016 License: GPL-2.0 Imports: 19 Imported by: 0

README

Deployment

Configure(*Config)
Build() (error)
Deploy() (error)
Start() (error)
Stop() (error)

The Life of a simulation:

  1. Configure
    • read configuration
    • compile eventual files
  2. Build
    • builds all files
    • eventually for different platforms
  3. Cleanup
    • send killall to applications
  4. Deploy
    • make sure the environment is up and running
    • copy files
  5. Start
    • start all logservers
    • start all nodes
    • start all clients
  6. Wait
    • wait for the applications to finish

Documentation

Overview

Package platform contains interface and implementation to run SDA code amongst multiple platforms. Such implementations include Localhost (run your test locally) and Deterlab (similar to emulab).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(path, out, goarch, goos string, buildArgs ...string) (string, error)

Build builds the the golang packages in `path` and stores the result in `out`. Besides specifying the environment variables GOOS and GOARCH you can pass any additional argument using the buildArgs argument. The command which will be executed is of the following form: $ go build -v buildArgs... -o out path

func KillGo

func KillGo()

KillGo kills all go-instances

func Rsync

func Rsync(username, host, file, dest string) error

Rsync copies files or directories to the remote host. If the DebugVisible is > 1, the rsync-operation is displayed on screen.

func SSHRun

func SSHRun(username, host, command string) ([]byte, error)

SSHRun runs a command on the remote host

func SSHRunStdout

func SSHRunStdout(username, host, command string) error

SSHRunStdout runs a command on the remote host but redirects stdout and stderr of the Ssh-command to the os.Stderr and os.Stdout

func Scp

func Scp(username, host, file, dest string) error

Scp copies the given files to the remote host

Types

type Config

type Config struct {
	MonitorPort int
	Debug       int
}

Config is passed to Platform.Config and prepares the platform for specific system-wide configurations

type Deterlab

type Deterlab struct {
	// *** Deterlab-related configuration
	// The login on the platform
	Login string
	// The outside host on the platform
	Host string
	// The name of the project
	Project string
	// Name of the Experiment - also name of hosts
	Experiment string

	// DNS-resolvable names
	Phys []string
	// VLAN-IP names (physical machines)
	Virt []string

	// ProxyAddress : the proxy will redirect every traffic it
	// receives to this address
	ProxyAddress string
	// MonitorAddress is the address given to clients to connect to the monitor
	// It is actually the Proxy that will listen to that address and clients
	// won't know a thing about it
	MonitorAddress string
	// Port number of the monitor and the proxy
	MonitorPort int

	// Number of available servers
	Servers int
	// Name of the simulation
	Simulation string
	// Number of machines
	Hosts int
	// Debugging-level: 0 is none - 5 is everything
	Debug int
	// The number of seconds to wait for closing the connection
	CloseWait int
	// contains filtered or unexported fields
}

Deterlab holds all fields necessary for a Deterlab-run

func (*Deterlab) Build

func (d *Deterlab) Build(build string, arg ...string) error

Build prepares all binaries for the Deterlab-simulation. If 'build' is empty, all binaries are created, else only the ones indicated. Either "simul" or "users"

func (*Deterlab) Cleanup

func (d *Deterlab) Cleanup() error

Cleanup kills all eventually remaining processes from the last Deploy-run

func (*Deterlab) Configure

func (d *Deterlab) Configure(pc *Config)

Configure initialises the directories and loads the saved config for Deterlab

func (*Deterlab) Deploy

func (d *Deterlab) Deploy(rc RunConfig) error

Deploy creates the appropriate configuration-files and copies everything to the deterlab-installation.

func (*Deterlab) Start

func (d *Deterlab) Start(args ...string) error

Start creates a tunnel for the monitor-output and contacts the Deterlab- server to run the simulation

func (*Deterlab) Wait

func (d *Deterlab) Wait() error

Wait for the process to finish

type Localhost

type Localhost struct {

	// The simulation to run
	Simulation string
	// contains filtered or unexported fields
}

Localhost is the platform for launching thee apps locally

func (*Localhost) Build

func (d *Localhost) Build(build string, arg ...string) error

Build makes sure that the binary is available for our local platform

func (*Localhost) Cleanup

func (d *Localhost) Cleanup() error

Cleanup kills all running cothority-binaryes

func (*Localhost) Configure

func (d *Localhost) Configure(pc *Config)

Configure various internal variables

func (*Localhost) Deploy

func (d *Localhost) Deploy(rc RunConfig) error

Deploy copies all files to the run-directory

func (*Localhost) Start

func (d *Localhost) Start(args ...string) error

Start will execute one cothority-binary for each server configured

func (*Localhost) Wait

func (d *Localhost) Wait() error

Wait for all processes to finish

type Platform

type Platform interface {
	// Does the initial configuration of all structures needed for the platform
	Configure(*Config)
	// Build builds all necessary binaries
	Build(build string, arg ...string) error
	// Makes sure that there is no part of the application still running
	Cleanup() error
	// Copies the binaries to the appropriate directory/machines, together with
	// the necessary configuration. RunConfig is a simple string that should
	// be copied as 'app.toml' to the directory where the app resides
	Deploy(RunConfig) error
	// Starts the application and returns - non-blocking!
	Start(args ...string) error
	// Waits for the application to quit
	Wait() error
}

Platform interface that has to be implemented to add another simulation- platform.

func NewPlatform

func NewPlatform(t string) Platform

NewPlatform returns the appropriate platform [deterlab,localhost]

type RunConfig

type RunConfig struct {
	// contains filtered or unexported fields
}

RunConfig is a struct that represent the configuration to apply for one "test" Note: a "simulation" is a set of "tests"

func NewRunConfig

func NewRunConfig() *RunConfig

NewRunConfig returns an initialised config to be used for reading in runconfig-files

func ReadRunFile

func ReadRunFile(p Platform, filename string) []RunConfig

ReadRunFile reads from a configuration-file for a run. The configuration-file has the following syntax: Name1 = value1 Name2 = value2 [empty line] n1, n2, n3, n4 v11, v12, v13, v14 v21, v22, v23, v24

The Name1...Namen are global configuration-options. n1..nn are configuration-options for one run Both the global and the run-configuration are copied to both the platform and the app-configuration.

func (*RunConfig) Clone

func (r *RunConfig) Clone() *RunConfig

Clone this runconfig so it has all fields-value relationship already present

func (*RunConfig) Delete

func (r *RunConfig) Delete(field string)

Delete a field from the runconfig (delete for example Simulation which we dont care in the final csv)

func (*RunConfig) Get

func (r *RunConfig) Get(field string) string

Get returns the associated value of the field in the config

func (*RunConfig) GetInt

func (r *RunConfig) GetInt(field string) (int, error)

GetInt returns the integer of the field, or error if not defined

func (*RunConfig) Map

func (r *RunConfig) Map() map[string]string

Map returns this config as a Map

func (*RunConfig) Put

func (r *RunConfig) Put(field, value string)

Put inserts a new field - value relationship

func (*RunConfig) String

func (r *RunConfig) String() string

String prints out the current status-line

func (*RunConfig) Toml

func (r *RunConfig) Toml() []byte

Toml returns this config as bytes in a Toml format

Directories

Path Synopsis
Deterlab-specific files
Deterlab-specific files
users
This is run on the users.deterlab.net server and will clean up the servers and then run 'cothority' on every server.
This is run on the users.deterlab.net server and will clean up the servers and then run 'cothority' on every server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL