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

Configure machine classes for MySQL DB Admin #11359

Merged
merged 4 commits into from
Dec 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions hieradata_aws/class/integration/release_db_admin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
govuk_env_sync::tasks:
"pull_release_production_daily":
ensure: "present"
hour: "0"
minute: "0"
action: "pull"
dbms: "mysql"
storagebackend: "s3"
database: "release_production"
database_hostname: "release-mysql"
temppath: "/tmp/release_production"
url: "govuk-production-database-backups"
path: "release-mysql"
# "push_release_production_daily":
# ensure: "present"
# hour: "5"
# minute: "0"
# action: "push"
# dbms: "mysql"
# storagebackend: "s3"
# database: "release_production"
# database_hostname: "release-mysql"
# temppath: "/tmp/release_production"
# url: "govuk-integration-database-backups"
# path: "release-mysql"
25 changes: 25 additions & 0 deletions hieradata_aws/class/integration/search_admin_db_admin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
govuk_env_sync::tasks:
"pull_search_admin_production_daily":
ensure: "present"
hour: "0"
minute: "0"
action: "pull"
dbms: "mysql"
storagebackend: "s3"
database: "search_admin_production"
database_hostname: "search-admin-mysql"
temppath: "/tmp/search_admin_production"
url: "govuk-production-database-backups"
path: "search-admin-mysql"
# "push_search_admin_production_daily":
# ensure: "present"
# hour: "5"
# minute: "0"
# action: "push"
# dbms: "mysql"
# storagebackend: "s3"
# database: "search_admin_production"
# database_hostname: "search-admin-mysql"
# temppath: "/tmp/search_admin_production"
# url: "govuk-integration-database-backups"
# path: "search-admin-mysql"
25 changes: 25 additions & 0 deletions hieradata_aws/class/integration/signon_db_admin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
govuk_env_sync::tasks:
"pull_signon_production_daily":
ensure: "present"
hour: "0"
minute: "0"
action: "pull"
dbms: "mysql"
storagebackend: "s3"
database: "signon_production"
database_hostname: "signon-mysql"
temppath: "/tmp/signon_production"
url: "govuk-production-database-backups"
path: "signon-mysql"
# "push_signon_production_daily":
# ensure: "present"
# hour: "5"
# minute: "0"
# action: "push"
# dbms: "mysql"
# storagebackend: "s3"
# database: "signon_production"
# database_hostname: "signon-mysql"
# temppath: "/tmp/signon_production"
# url: "govuk-integration-database-backups"
# path: "signon-mysql"
25 changes: 25 additions & 0 deletions hieradata_aws/class/integration/whitehall_db_admin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
govuk_env_sync::tasks:
"pull_whitehall_production_daily":
ensure: "present"
hour: "0"
minute: "0"
action: "pull"
dbms: "mysql"
storagebackend: "s3"
database: "whitehall_production"
database_hostname: "whitehall-mysql"
temppath: "/tmp/whitehall_production"
url: "govuk-production-database-backups"
path: "whitehall-mysql"
# "push_whitehall_production_daily":
# ensure: "present"
# hour: "5"
# minute: "0"
# action: "push"
# dbms: "mysql"
# storagebackend: "s3"
# database: "whitehall_production"
# database_hostname: "whitehall-mysql"
# temppath: "/tmp/whitehall_production"
# url: "govuk-integration-database-backups"
# path: "whitehall-mysql"
13 changes: 13 additions & 0 deletions hieradata_aws/class/production/release_db_admin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# govuk_env_sync::tasks:
# "push_release_production_daily":
# ensure: "present"
# hour: "23"
# minute: "0"
# action: "push"
# dbms: "mysql"
# storagebackend: "s3"
# database: "release_production"
# database_hostname: "release-mysql"
# temppath: "/tmp/release_production"
# url: "govuk-production-database-backups"
# path: "release-mysql"
13 changes: 13 additions & 0 deletions hieradata_aws/class/production/search_admin_db_admin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# govuk_env_sync::tasks:
# "push_search_admin_production_daily":
# ensure: "present"
# hour: "23"
# minute: "0"
# action: "push"
# dbms: "mysql"
# storagebackend: "s3"
# database: "search_admin_production"
# database_hostname: "search-admin-mysql"
# temppath: "/tmp/search_admin_production"
# url: "govuk-production-database-backups"
# path: "search-admin-mysql"
13 changes: 13 additions & 0 deletions hieradata_aws/class/production/signon_db_admin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# govuk_env_sync::tasks:
# "push_signon_production_daily":
# ensure: "present"
# hour: "23"
# minute: "0"
# action: "push"
# dbms: "mysql"
# storagebackend: "s3"
# database: "signon_production"
# database_hostname: "signon-mysql"
# temppath: "/tmp/signon_production"
# url: "govuk-production-database-backups"
# path: "signon-mysql"
13 changes: 13 additions & 0 deletions hieradata_aws/class/production/whitehall_db_admin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# govuk_env_sync::tasks:
# "push_whitehall_production_daily":
# ensure: "present"
# hour: "23"
# minute: "0"
# action: "push"
# dbms: "mysql"
# storagebackend: "s3"
# database: "whitehall_production"
# database_hostname: "whitehall-mysql"
# temppath: "/tmp/whitehall_production"
# url: "govuk-production-database-backups"
# path: "whitehall-mysql"
25 changes: 25 additions & 0 deletions hieradata_aws/class/staging/release_db_admin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
govuk_env_sync::tasks:
"pull_release_production_daily":
ensure: "present"
hour: "0"
minute: "0"
action: "pull"
dbms: "mysql"
storagebackend: "s3"
database: "release_production"
database_hostname: "release-mysql"
temppath: "/tmp/release_production"
url: "govuk-production-database-backups"
path: "release-mysql"
# "push_release_production_daily":
# ensure: "present"
# hour: "5"
# minute: "0"
# action: "push"
# dbms: "mysql"
# storagebackend: "s3"
# database: "release_production"
# database_hostname: "release-mysql"
# temppath: "/tmp/release_production"
# url: "govuk-staging-database-backups"
# path: "release-mysql"
25 changes: 25 additions & 0 deletions hieradata_aws/class/staging/search_admin_db_admin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
govuk_env_sync::tasks:
"pull_search_admin_production_daily":
ensure: "present"
hour: "0"
minute: "0"
action: "pull"
dbms: "mysql"
storagebackend: "s3"
database: "search_admin_production"
database_hostname: "search-admin-mysql"
temppath: "/tmp/search_admin_production"
url: "govuk-production-database-backups"
path: "search-admin-mysql"
# "push_search_admin_production_daily":
# ensure: "present"
# hour: "5"
# minute: "0"
# action: "push"
# dbms: "mysql"
# storagebackend: "s3"
# database: "search_admin_production"
# database_hostname: "search-admin-mysql"
# temppath: "/tmp/search_admin_production"
# url: "govuk-staging-database-backups"
# path: "search-admin-mysql"
25 changes: 25 additions & 0 deletions hieradata_aws/class/staging/signon_db_admin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
govuk_env_sync::tasks:
"pull_signon_production_daily":
ensure: "present"
hour: "0"
minute: "0"
action: "pull"
dbms: "mysql"
storagebackend: "s3"
database: "signon_production"
database_hostname: "signon-mysql"
temppath: "/tmp/signon_production"
url: "govuk-production-database-backups"
path: "signon-mysql"
# "push_signon_production_daily":
# ensure: "present"
# hour: "5"
# minute: "0"
# action: "push"
# dbms: "mysql"
# storagebackend: "s3"
# database: "signon_production"
# database_hostname: "signon-mysql"
# temppath: "/tmp/signon_production"
# url: "govuk-staging-database-backups"
# path: "signon-mysql"
25 changes: 25 additions & 0 deletions hieradata_aws/class/staging/whitehall_db_admin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
govuk_env_sync::tasks:
"pull_whitehall_production_daily":
ensure: "present"
hour: "0"
minute: "0"
action: "pull"
dbms: "mysql"
storagebackend: "s3"
database: "whitehall_production"
database_hostname: "whitehall-mysql"
temppath: "/tmp/whitehall_production"
url: "govuk-production-database-backups"
path: "whitehall-mysql"
# "push_whitehall_production_daily":
# ensure: "present"
# hour: "5"
# minute: "0"
# action: "push"
# dbms: "mysql"
# storagebackend: "s3"
# database: "whitehall_production"
# database_hostname: "whitehall-mysql"
# temppath: "/tmp/whitehall_production"
# url: "govuk-staging-database-backups"
# path: "whitehall-mysql"
8 changes: 8 additions & 0 deletions hieradata_aws/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,8 @@ govuk::apps::whitehall::admin_db_name: whitehall_production
govuk::apps::whitehall::admin_db_password: "%{hiera('govuk::apps::whitehall::db::mysql_whitehall_admin')}"
govuk::apps::whitehall::admin_db_username: whitehall
# TODO this should be using a replica, but we can change that when we have deployed one
# TODO: switch to "whitehall-mysql" and uncomment the 'push'
# `govuk_env_sync::tasks` tasks when we're ready to switch to the dedicated RDS instance
govuk::apps::whitehall::db_hostname: 'mysql-primary'
govuk::apps::whitehall::db_name: whitehall_production
govuk::apps::whitehall::db_password: "%{hiera('govuk::apps::whitehall::db::mysql_whitehall')}"
Expand Down Expand Up @@ -652,6 +654,8 @@ govuk::apps::publishing_api::db::allow_auth_from_lb: true
govuk::apps::publishing_api::db::lb_ip_range: "%{hiera('environment_ip_prefix')}.0.0/16"
govuk::apps::publishing_api::govuk_content_schemas_path: '/data/apps/govuk-content-schemas/current'

# TODO: switch to "release-mysql" and uncomment the 'push'
# `govuk_env_sync::tasks` tasks when we're ready to switch to the dedicated RDS instance
govuk::apps::release::db_hostname: "mysql-primary"
govuk::apps::release::db_username: "release"
govuk::apps::release::db_password: "%{hiera('govuk::apps::release::db::mysql_release')}"
Expand All @@ -669,6 +673,8 @@ govuk::apps::search_api::redis_port: '6379'
govuk::apps::search_api::unicorn_worker_processes: "9"

govuk::apps::search_admin::db_name: 'search_admin_production'
# TODO: switch to "search-admin-mysql" and uncomment the 'push'
# `govuk_env_sync::tasks` tasks when we're ready to switch to the dedicated RDS instance
govuk::apps::search_admin::db_hostname: 'mysql-primary'
govuk::apps::search_admin::db_password: "%{hiera('govuk::apps::search_admin::db::mysql_search_admin')}"
govuk::apps::search_admin::db_username: 'search_admin'
Expand Down Expand Up @@ -728,6 +734,8 @@ govuk::apps::sidekiq_monitoring::travel_advice_publisher_redis_port: "%{hiera('g
govuk::apps::sidekiq_monitoring::whitehall_redis_host: "%{hiera('govuk::apps::whitehall::redis_host')}"
govuk::apps::sidekiq_monitoring::whitehall_redis_port: "%{hiera('govuk::apps::whitehall::redis_port')}"

# TODO: switch to "signon-mysql" and uncomment the 'push'
# `govuk_env_sync::tasks` tasks when we're ready to switch to the dedicated RDS instance
govuk::apps::signon::db_hostname: 'mysql-primary'
govuk::apps::signon::db_name: 'signon_production'
govuk::apps::signon::db_password: "%{hiera('govuk::apps::signon::db::mysql_signonotron')}"
Expand Down
34 changes: 34 additions & 0 deletions modules/govuk/manifests/node/s_release_db_admin.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# == Class: govuk_node::s_release_db_admin
#
# This machine class is used to administer the Release
# MySQL RDS instances.
#
# === Parameters
#
# [*mysql_db_host*]
# The database hostname
#
# [*mysql_db_password*]
# The database password
#
# [*mysql_db_user*]
# The database user to connect to the remote database as
#
class govuk::node::s_release_db_admin(
$mysql_db_host = undef,
$mysql_db_password = undef,
$mysql_db_user = undef,
) {
include ::govuk::node::s_base
include govuk_env_sync

file { '/root/.my.cnf':
ensure => 'present',
owner => 'root',
group => 'root',
content => template('govuk/mysql_my.cnf.erb'),
}

# include all MySQL classes that create databases and users
-> class { '::govuk::apps::release::db': }
}
34 changes: 34 additions & 0 deletions modules/govuk/manifests/node/s_search_admin_db_admin.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# == Class: govuk_node::s_search_admin_db_admin
#
# This machine class is used to administer the Search Admin
# MySQL RDS instances.
#
# === Parameters
#
# [*mysql_db_host*]
# The database hostname
#
# [*mysql_db_password*]
# The database password
#
# [*mysql_db_user*]
# The database user to connect to the remote database as
#
class govuk::node::s_search_admin_db_admin(
$mysql_db_host = undef,
$mysql_db_password = undef,
$mysql_db_user = undef,
) {
include ::govuk::node::s_base
include govuk_env_sync

file { '/root/.my.cnf':
ensure => 'present',
owner => 'root',
group => 'root',
content => template('govuk/mysql_my.cnf.erb'),
}

# include all MySQL classes that create databases and users
-> class { '::govuk::apps::search_admin::db': }
}
Loading