deployment

package
v1.19.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: Apache-2.0 Imports: 12 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

func ClearLicensesCmd added in v1.17.0

func ClearLicensesCmd(dbInfo DBSettings) (string, error)

ClearLicensesCmd returns a command string to connect to the database and delete all rows in the Licenses table and the ActiveLicenseId row in the Systems table

func GetAWSCreds added in v1.17.0

func GetAWSCreds(profile string) (aws.Credentials, error)

GetAWSCreds returns the AWS credentials identified by the provided profile

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:"c7i.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:"c7i.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
	// ExternalAuthProviderSettings contains the settings for configuring an external auth provider.
	ExternalAuthProviderSettings ExternalAuthProviderSettings
	// 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 `` /* 163-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:""`
	// DBExtraSQL are optional URIs to SQL files containing SQL statements to be applied
	// to the Mattermost database.
	// The file is expected to be gzip compressed.
	// This can also point to a local file if prefixed with "file://".
	DBExtraSQL []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 string `default:"Elasticsearch_7.10"`
	// 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
	// SnapshotRepository is the name of the S3 bucket where the snapshot to restore lives.
	SnapshotRepository string
	// SnapshotName is the name of the snapshot to restore.
	SnapshotName string
	// RestoreTimeoutMinutes is the maximum time, in minutes, that the system will wait for the snapshot to be restored.
	RestoreTimeoutMinutes int `default:"45" validate:"range:[0,)"`
	// ClusterTimeoutMinutes is the maximum time, in minutes, that the system will wait for the cluster status to get green.
	ClusterTimeoutMinutes int `default:"45" validate:"range:[0,)"`
}

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

type ExternalAuthProviderSettings added in v1.17.0

type ExternalAuthProviderSettings struct {
	// Enabled is set to true if the external auth provider should be enabled.
	Enabled bool `default:"false"`
	// DevelopmentMode is set to true if the keycloak instance should be started in development mode.
	DevelopmentMode bool `default:"true"`
	// KeycloakVersion is the version of keycloak to deploy.
	KeycloakVersion string `default:"24.0.2"`
	// KeycloakInstanceType is the type of the EC2 instance for keycloak.
	InstanceType string `default:"c7i.xlarge"`
	// KeycloakAdminUser is the username of the keycloak admin interface (admin on the master realm)
	KeycloakAdminUser string `default:"mmuser" validate:"notempty"`
	// KeycloakAdminPassword is the password of the keycloak admin interface (admin on the master realm)
	KeycloakAdminPassword string `default:"mmpass" validate:"notempty"`
	// KeycloakRealmFilePath is the path to the realm file to be uploaded to the keycloak instance.
	// If empty, a default realm file will be used.
	KeycloakRealmFilePath string `default:""`
	// KeycloakDBDumpURI
	// An optional URI to a keycloak database dump file to be uploaded on environment
	// creation.
	// The file is expected to be gzip compressed.
	// This can also point to a local file if prefixed with "file://".
	KeycloakDBDumpURI string `default:""`
	// GenerateUsersCount is the number of users to generate in the keycloak instance.
	GenerateUsersCount int `default:"0" validate:"range:[0,)"`
	// KeycloakRealmName is the name of the realm to be used in Mattermost. Must exist in the keycloak instance.
	// It is used when creating users and to properly set the OpenID configuration in Mattermost.
	KeycloakRealmName string `default:"mattermost"`
	// KeycloakClientID is the client id to be used in Mattermost from the above realm.
	// Must exist in the keycloak instance
	KeycloakClientID string `default:"mattermost-openid"`
	// KeycloakClientSecret is the client secret from the above realm to be used in Mattermost.
	// Must exist in the keycloak instance
	KeycloakClientSecret string `default:"qbdUj4dacwfa5sIARIiXZxbsBFoopTyf"`
}

ExternalAuthProviderSettings contains the necessary data to configure an external auth provider.

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:"c7i.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"`
	// Size, in GiB, for the storage of the keycloak instances
	KeyCloak int `default:"10"`
}

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.r7g.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