Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Commit

Permalink
Merge pull request #9338 from alphagov/gatling
Browse files Browse the repository at this point in the history
add puppet node & class for Gatling
  • Loading branch information
fredericfran-gds authored Jul 5, 2019
2 parents 2b2bcc8 + e9c1fff commit 2c18ceb
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 4 deletions.
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ task :check_consistency_between_aws_and_carrenza do
govuk::node::s_apt::gemstash_service
govuk::node::s_asset_base::alert_hostname
govuk::node::s_base::log_remote
govuk::node::s_gatling::apt_mirror_hostname
govuk::node::s_postgresql_primary::alert_hostname
govuk_bundler::config::service
govuk_containers::apps::router::envvars
Expand Down
2 changes: 2 additions & 0 deletions hieradata_aws/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,8 @@ govuk::node::s_content_data_api_db_admin::apt_mirror_hostname: "%{hiera('apt_mir

govuk::node::s_email_alert_api_db_admin::apt_mirror_hostname: "%{hiera('apt_mirror_hostname')}"

govuk::node::s_gatling::apt_mirror_hostname: "%{hiera('apt_mirror_hostname')}"

govuk::node::s_graphite::apt_mirror_hostname: "%{hiera('apt_mirror_hostname')}"

govuk::node::s_licensify_lb::backend_app_servers:
Expand Down
1 change: 1 addition & 0 deletions modules/govuk/manifests/node/s_apt.pp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
aptly::repo { 'collectd': }
aptly::repo { 'elastic-beats': }
aptly::repo { 'etcdctl': }
aptly::repo { 'govuk-gatling': }
aptly::repo { 'gdal': }
aptly::repo { 'gof3r': }
aptly::repo { 'google-cloud-sdk-trusty': }
Expand Down
77 changes: 77 additions & 0 deletions modules/govuk/manifests/node/s_gatling.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# == Class: govuk::node::s_gatling
#
# This machine class is used to run Gatling, a load testing tool.
#
# === Parameters
#
# [*root_dir*]
# The root of the website where Gatling stores its results
# Default = '/home/gatling/gatling-software/results'
#
# [*repo*]
# The github repository where GOV.UK defines its load tests
# Default = '[email protected]:alphagov/govuk-load-testing.git'
#
# [*commit*]
# The version of the repository where GOV.UK defines its load tests
# Default = 'master'
#
#
#
class govuk::node::s_gatling (
$root_dir = '/usr/local/bin/gatling/results',
$repo = 'https://github.com/alphagov/govuk-load-testing.git',
$commit = 'master',
$apt_mirror_hostname = undef,
) inherits govuk::node::s_base {

# User used to run Gatling
govuk_user { 'gatling':
fullname => 'GOV.UK Gatling',
email => '[email protected]',
groups => ['admin', 'deploy', 'adm', 'www-data' ],
}

# repository where GOV.UK stores its load tests
vcsrepo { '/home/gatling/govuk-load-testing':
ensure => present,
provider => git,
source => $repo,
revision => $commit,
force => true,
}

# install the JRE and JDK on the Gatling instance
include ::govuk_java::openjdk8::jre
include ::govuk_java::openjdk8::jdk
class { 'govuk_java::set_defaults':
jdk => 'openjdk8',
jre => 'openjdk8',
}

apt::source { 'govuk-gatling':
location => "http://${apt_mirror_hostname}/govuk-gatling",
release => 'trusty',
architecture => $::architecture,
repos => 'main',
key => '3803E444EB0235822AA36A66EC5FE1A937E3ACBB',
}

package { 'govuk-gatling':
ensure => latest,
name => 'gatling-3.1.3.deb',
require => Apt::Source['govuk-gatling'],
}

file { '/usr/local/bin/gatling':
ensure => directory,
mode => '0777',
recurse => true,
require => Package['govuk-gatling'],
}

include nginx
nginx::config::site { 'gatling_service':
content => template('govuk/node/s_gatling/gatling_cluster_vhost.conf.erb'),
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
server {
server_name gatling.* gatling-origin.*;
root <%= @root_dir -%>;

access_log /var/log/nginx/gatling-access.log timed_combined;
access_log /var/log/nginx/gatling-json.event.access.log json_event;
error_log /var/log/nginx/gatling-error.log;

location / {
autoindex on;
}
}
8 changes: 4 additions & 4 deletions modules/govuk_scripts/templates/govuk_node_list_aws.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ def ec2_nodes(stackname, nodeclass=None):
if nodeclass:
response = client.describe_instances(
Filters=[
{'Name': 'tag:aws_stackname', 'Values': [stackname]},
{'Name': 'tag:aws_stackname', 'Values': [stackname, 'govuk']},
{'Name': 'tag:aws_migration', 'Values': [nodeclass]},
{'Name': 'instance-state-name', 'Values': ['running']}
]
)
else:
response = client.describe_instances(
Filters=[
{'Name': 'tag:aws_stackname', 'Values': [stackname]},
{'Name': 'tag:aws_stackname', 'Values': [stackname, 'govuk']},
{'Name': 'instance-state-name','Values': ['running']}
]
)
Expand All @@ -47,7 +47,7 @@ def ec2_nodes_list_with_puppet_class(stackname):

response = client.describe_instances(
Filters=[
{'Name': 'tag:aws_stackname', 'Values': [stackname]},
{'Name': 'tag:aws_stackname', 'Values': [stackname, 'govuk']},
{'Name': 'instance-state-name','Values': ['running']}
]
)
Expand All @@ -72,7 +72,7 @@ def ec2_classes(stackname):

response = client.describe_instances(
Filters=[
{'Name': 'tag:aws_stackname', 'Values': [stackname]},
{'Name': 'tag:aws_stackname', 'Values': [stackname, 'govuk']},
{'Name': 'instance-state-name','Values': ['running']}
]
)
Expand Down
1 change: 1 addition & 0 deletions modules/hosts/manifests/purge.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
'mongo-api-1',
'prometheus-1',
'search-1',
'gatling-1',
]

if ! ($::hostname in $whitelist) {
Expand Down

0 comments on commit 2c18ceb

Please sign in to comment.