deployment

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvVarTCPNoDelay = "MM_LOADTEST_TCPNODELAY"
)

Variables

This section is empty.

Functions

func BuildLoadDBDumpCmd added in v1.10.0

func BuildLoadDBDumpCmd(dumpFilename string, dbInfo DBSettings) (string, error)

BuildLoadDBDumpCmd returns a command string to feed the provided DB dump file into the database. Example:

zcat dbdump.sql | mysql/psql connection_details && custom queries

func ProvisionURL added in v1.10.0

func ProvisionURL(client *ssh.Client, url, filename string) error

ProvisionURL takes a URL pointing to a file to be provisioned. It works on both local files prefixed with file:// or remote files. In case of local files, they are uploaded to the server.

Types

type Cmd added in v1.10.0

type Cmd struct {
	Msg     string
	Value   string
	Clients []*ssh.Client
}

type Config

type Config struct {
	// AWSProfile is the name of the AWS profile to use for all AWS commands
	AWSProfile string `default:"mm-loadtest"`
	// AWSRegion is the region used to deploy all resources.
	AWSRegion string `default:"us-east-1"`
	// AWSAMI is the AMI to use for all EC2 instances.
	AWSAMI string `default:"ami-0fa37863afb290840"`
	// ClusterName is the name of the cluster.
	ClusterName string `default:"loadtest" validate:"alpha"`
	// ClusterVpcID is the id of the VPC associated to the resources.
	ClusterVpcID string
	// ClusterSubnetID is the id of the subnet associated to the resources.
	ClusterSubnetID string
	// Number of application instances.
	AppInstanceCount int `default:"1" validate:"range:[0,)"`
	// Type of the EC2 instance for app.
	AppInstanceType string `default:"c5.xlarge" validate:"notempty"`
	// Number of agents, first agent and coordinator will share the same instance.
	AgentInstanceCount int `default:"2" validate:"range:[0,)"`
	// Type of the EC2 instance for agent.
	AgentInstanceType string `default:"c5.xlarge" validate:"notempty"`
	// Logs the command output (stdout & stderr) to home directory.
	EnableAgentFullLogs bool `default:"true"`
	// Type of the EC2 instance for proxy.
	ProxyInstanceType string `default:"m4.xlarge" validate:"notempty"`
	// Path to the SSH public key.
	SSHPublicKey string `default:"~/.ssh/id_rsa.pub" validate:"notempty"`
	// Terraform database connection and provision settings.
	TerraformDBSettings TerraformDBSettings
	// External database connection settings
	ExternalDBSettings ExternalDBSettings
	// External bucket connection settings.
	ExternalBucketSettings ExternalBucketSettings
	// URL from where to download Mattermost release.
	// This can also point to a local binary path if the user wants to run loadtest
	// on a custom build. The path should be prefixed with "file://". In that case,
	// only the binary gets replaced, and the rest of the build comes from the latest
	// stable release.
	MattermostDownloadURL string `default:"https://latest.mattermost.com/mattermost-enterprise-linux" validate:"url"`
	// Path to the Mattermost EE license file.
	MattermostLicenseFile string `default:"" validate:"file"`
	// Optional path to a partial Mattermost config file to be applied as patch during
	// app server deployment.
	MattermostConfigPatchFile string `default:""`
	// Mattermost instance sysadmin e-mail.
	AdminEmail string `default:"sysadmin@sample.mattermost.com" validate:"email"`
	// Mattermost instance sysadmin user name.
	AdminUsername string `default:"sysadmin" validate:"notempty"`
	// Mattermost instance sysadmin password.
	AdminPassword string `default:"Sys@dmin-sample1" validate:"notempty"`
	// URL from where to download load-test-ng binaries and configuration files.
	// The configuration files provided in the package will be overridden in
	// the deployment process.
	LoadTestDownloadURL   string `` /* 155-byte string literal not displayed */
	ElasticSearchSettings ElasticSearchSettings
	JobServerSettings     JobServerSettings
	LogSettings           logger.Settings
	Report                report.Config
	// Directory under which the .terraform directory and state files are managed.
	// It will be created if it does not exist
	TerraformStateDir string `default:"/var/lib/mattermost-load-test-ng" validate:"notempty"`
	// URI of an S3 bucket whose contents are copied to the bucket created in the deployment
	S3BucketDumpURI string `default:"" validate:"s3uri"`
	// An optional URI to a MM server database dump file
	// to be loaded before running the load-test.
	// The file is expected to be gzip compressed.
	// This can also point to a local file if prefixed with "file://".
	// In such case, the dump file will be uploaded to the app servers.
	DBDumpURI string `default:""`
	// An optional host name that will:
	//   - Override the SiteUrl
	//   - Point to the proxy IP via a new entry in the server's /etc/hosts file
	SiteURL string `default:"ltserver"`
	// UsersFilePath specifies the path to an optional file containing a list of credentials for the controllers
	// to use. If present, it is used to automatically upload it to the agents and override the agent's config's
	// own UsersFilePath.
	UsersFilePath string `default:""`
	// PyroscopeSettings contains the settings for configuring the continuous profiling through Pyroscope
	PyroscopeSettings PyroscopeSettings
	// StorageSizes specifies the sizes of the disks for each instance type
	StorageSizes StorageSizes
}

Config contains the necessary data to deploy and provision a load test environment.

func ReadConfig

func ReadConfig(configFilePath string) (*Config, error)

ReadConfig reads the configuration file from the given string. If the string is empty, it will return a config with default values.

func (*Config) DBName added in v1.3.0

func (c *Config) DBName() string

DBName returns the database name for the deployment.

func (*Config) IsValid

func (c *Config) IsValid() error

IsValid reports whether a given deployment config is valid or not.

type DBParameter added in v1.10.0

type DBParameter struct {
	// The unique name for the parameter.
	Name string `validate:"notempty"`
	// The value for the parameter.
	Value string `validate:"notempty"`
	// The apply method for the parameter. Can be either "immediate" or
	// "pending-reboot". It depends on the db engine used and parameter type.
	ApplyMethod string `validate:"oneof:{immediate, pending-reboot}"`
}

DBParameter contains info regarding a single RDS DB specific parameter.

type DBParameters added in v1.10.0

type DBParameters []DBParameter

func (DBParameters) String added in v1.10.0

func (p DBParameters) String() string

type DBSettings added in v1.10.0

type DBSettings struct {
	UserName string
	Password string
	DBName   string
	Host     string
	Engine   string
}

type ElasticSearchSettings

type ElasticSearchSettings struct {
	// Elasticsearch instances number.
	InstanceCount int
	// Elasticsearch instance type to be created.
	InstanceType string
	// Elasticsearch version to be deployed.
	Version float64
	// Id of the VPC associated with the instance to be created.
	VpcID string
	// Set to true if the AWSServiceRoleForAmazonElasticsearchService role should be created.
	CreateRole bool
}

ElasticSearchSettings contains the necessary data to configure an ElasticSearch instance to be deployed and provisioned.

type ExternalBucketSettings added in v1.10.0

type ExternalBucketSettings struct {
	AmazonS3AccessKeyId     string `default:""`
	AmazonS3SecretAccessKey string `default:""`
	AmazonS3Bucket          string `default:""`
	AmazonS3PathPrefix      string `default:""`
	AmazonS3Region          string `default:"us-east-1"`
	AmazonS3Endpoint        string `default:"s3.amazonaws.com"`
	AmazonS3SSL             bool   `default:"true"`
	AmazonS3SignV2          bool   `default:"false"`
	AmazonS3SSE             bool   `default:"false"`
}

ExternalBucketSettings contains the necessary data to connect to an existing S3 bucket.

type ExternalDBSettings added in v1.2.0

type ExternalDBSettings struct {
	// Mattermost database driver
	DriverName string `default:"" validate:"oneof:{mysql, postgres, cockroach}"`
	// DSN to connect to the database
	DataSource string `default:""`
	// DSN to connect to the database replicas
	DataSourceReplicas []string `default:""`
	// DSN to connect to the database search replicas
	DataSourceSearchReplicas []string `default:""`
}

ExternalDBSettings contains the necessary data to configure an instance to be deployed and provisioned.

type JobServerSettings added in v1.3.0

type JobServerSettings struct {
	// Job server instances count.
	InstanceCount int `default:"0" validate:"range:[0,1]"`
	// Job server instance type to be created.
	InstanceType string `default:"c5.xlarge"`
}

JobServerSettings contains the necessary data to deploy a job server.

type PyroscopeSettings added in v1.11.0

type PyroscopeSettings struct {
	// Enable profiling of all the app instances
	EnableAppProfiling bool `default:"true"`
	// Enable profiling of all the agent instances
	EnableAgentProfiling bool `default:"true"`
}

PyroscopeSettings contains flags to enable/disable the profiling of the different parts of the deployment.

type StorageSizes added in v1.11.0

type StorageSizes struct {
	// Size, in GiB, for the storage of the agents instances
	Agent int `default:"10"`
	// Size, in GiB, for the storage of the proxy instance
	Proxy int `default:"10"`
	// Size, in GiB, for the storage of the app instances
	App int `default:"10"`
	// Size, in GiB, for the storage of the metrics instance
	Metrics int `default:"50"`
	// Size, in GiB, for the storage of the job server instances
	Job int `default:"50"`
	// Size, in GiB, for the storage of the elasticsearch instances
	ElasticSearch int `default:"20"`
}

type TerraformDBSettings added in v1.2.0

type TerraformDBSettings struct {
	// Number of DB instances.
	InstanceCount int `default:"1" validate:"range:[0,)"`
	// Type of the DB instance.
	InstanceType string `default:"db.r6g.large" validate:"notempty"`
	// Type of the DB instance - postgres or mysql.
	InstanceEngine string `default:"aurora-postgresql" validate:"oneof:{aurora-mysql, aurora-postgresql}"`
	// Username to connect to the DB.
	UserName string `default:"mmuser" validate:"notempty"`
	// Password to connect to the DB.
	Password string `default:"mostest80098bigpass_" validate:"notempty"`
	// If set to true enables performance insights for the created DB instances.
	EnablePerformanceInsights bool `default:"true"`
	// A list of DB specific parameters to use for the created instance.
	DBParameters DBParameters
	// ClusterIdentifier indicates to point to an existing cluster
	ClusterIdentifier string `default:""`
	// DBName specifies the name of the database.
	// If ClusterIdentifier is not empty, DBName should be set to the name of the database in such cluster.
	// If ClusterIdentifier is empty, the database created will use DBName as its name.
	DBName string `default:""`
}

TerraformDBSettings contains the necessary data to configure an instance to be deployed and provisioned.

Directories

Path Synopsis
ssh
Package ssh is a simple wrapper around an ssh.Client which implements utilities to be performed with a remote server.
Package ssh is a simple wrapper around an ssh.Client which implements utilities to be performed with a remote server.

Jump to

Keyboard shortcuts

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