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

Configure contacts_admin_db_admin machine class #11360

Merged
merged 1 commit 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
2 changes: 2 additions & 0 deletions hieradata_aws/class/backend.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---

govuk::apps::contacts::vhost: contacts-admin
# TODO: switch to "contacts-admin-mysql" and uncomment the 'push'
# `govuk_env_sync::tasks` tasks when we're ready to switch to the dedicated RDS instance
govuk::apps::contacts::db_hostname: 'mysql-primary'
govuk::apps::contacts::db_username: 'contacts'
govuk::apps::contacts::db_password: "%{hiera('govuk::apps::contacts::db::mysql_contacts_admin')}"
Expand Down
25 changes: 25 additions & 0 deletions hieradata_aws/class/integration/contacts_admin_db_admin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
govuk_env_sync::tasks:
"pull_contacts_admin_production_daily":
ensure: "present"
hour: "0"
minute: "0"
action: "pull"
dbms: "mysql"
storagebackend: "s3"
database: "contacts_production"
database_hostname: "contacts-admin-mysql"
temppath: "/tmp/contacts_admin_production"
url: "govuk-production-database-backups"
path: "contacts-admin-mysql"
# "push_contacts_admin_production_daily":
# ensure: "present"
# hour: "5"
# minute: "0"
# action: "push"
# dbms: "mysql"
# storagebackend: "s3"
# database: "contacts_production"
# database_hostname: "contacts-admin-mysql"
# temppath: "/tmp/contacts_admin_production"
# url: "govuk-integration-database-backups"
# path: "contacts-admin-mysql"
13 changes: 13 additions & 0 deletions hieradata_aws/class/production/contacts_admin_db_admin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# govuk_env_sync::tasks:
# "push_contacts_admin_production_daily":
# ensure: "present"
# hour: "23"
# minute: "0"
# action: "push"
# dbms: "mysql"
# storagebackend: "s3"
# database: "contacts_production"
# database_hostname: "contacts-admin-mysql"
# temppath: "/tmp/contacts_admin_production"
# url: "govuk-production-database-backups"
# path: "contacts-admin-mysql"
25 changes: 25 additions & 0 deletions hieradata_aws/class/staging/contacts_admin_db_admin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
govuk_env_sync::tasks:
"pull_contacts_admin_production_daily":
ensure: "present"
hour: "0"
minute: "0"
action: "pull"
dbms: "mysql"
storagebackend: "s3"
database: "contacts_production"
database_hostname: "contacts-admin-mysql"
temppath: "/tmp/contacts_admin_production"
url: "govuk-production-database-backups"
path: "contacts-admin-mysql"
# "push_contacts_admin_production_daily":
# ensure: "present"
# hour: "5"
# minute: "0"
# action: "push"
# dbms: "mysql"
# storagebackend: "s3"
# database: "contacts_production"
# database_hostname: "contacts-admin-mysql"
# temppath: "/tmp/contacts_admin_production"
# url: "govuk-staging-database-backups"
# path: "contacts-admin-mysql"
2 changes: 1 addition & 1 deletion modules/govuk/manifests/apps/contacts/db.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# == Class: govuk::apps:contacts:db
#
# MySQL to store content for the Contacts app
# MySQL to store content for the Contacts Admin app
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

# https://github.com/alphagov/contacts-admin
#
# === Parameters
Expand Down
34 changes: 34 additions & 0 deletions modules/govuk/manifests/node/s_contacts_admin_db_admin.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# == Class: govuk_node::s_contacts_admin_db_admin
#
# This machine class is used to administer the Contacts 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_contacts_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::contacts::db': }
}