From 4ee99d5d3e6345df449b2b2be617f63f2282dd25 Mon Sep 17 00:00:00 2001 From: Dan Langford <721364+danlangford@users.noreply.github.com> Date: Sat, 20 Nov 2021 00:18:15 -0700 Subject: [PATCH 1/8] explore what an ubuntu upgrade might look like. see how well tests run --- .circleci/config.yml | 2 +- deploy/vagrant/Vagrantfile | 8 ++++---- deploy/vagrant/manifests/init.pp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c5c5f965f..369a08fae 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2 jobs: build: docker: - - image: ubuntu:16.04 + - image: ubuntu:20.04 steps: - checkout - run: diff --git a/deploy/vagrant/Vagrantfile b/deploy/vagrant/Vagrantfile index 349d0e48f..7d3538a8f 100644 --- a/deploy/vagrant/Vagrantfile +++ b/deploy/vagrant/Vagrantfile @@ -10,11 +10,11 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # please see the online documentation at vagrantup.com. # Every Vagrant virtual environment requires a box to build off of. - config.vm.box = "ubuntu/xenial32" + config.vm.box = "ubuntu/focal64" # The url from where the 'config.vm.box' box will be fetched if it # doesn't already exist on the user's system. - #config.vm.box_url = "http://files.vagrantup.com/xenial32.box" + #config.vm.box_url = "http://files.vagrantup.com/focal64.box" # Create a forwarded port mapping which allows access to a specific port # within the machine from a port on the host machine. In the example below, @@ -65,8 +65,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| aws.security_groups = ["buttonmen-dev"] aws.iam_instance_profile_name = "ec2_instance_perms" - aws.instance_type = "t1.micro" - aws.ami = "ami-0735ea082a1534cac" + aws.instance_type = "t2.micro" + aws.ami = "ami-022d4249382309a48" override.ssh.username = "ubuntu" override.ssh.private_key_path = "BUTTONMEN_SSH_PRIVATE_KEY_PATH" diff --git a/deploy/vagrant/manifests/init.pp b/deploy/vagrant/manifests/init.pp index bd0076427..b3ac1d6df 100644 --- a/deploy/vagrant/manifests/init.pp +++ b/deploy/vagrant/manifests/init.pp @@ -39,7 +39,7 @@ $puppet_timestamp = generate('/bin/date', '+%s') case "$operatingsystemrelease" { - "14.04", "16.04": { + "14.04", "16.04", "18.04", "20.04": { $puppet_apache_sitesdir = "sites-enabled" } default: { From 84e68e7e71967a984ad5ba333687d77a9885096d Mon Sep 17 00:00:00 2001 From: Dan Langford <721364+danlangford@users.noreply.github.com> Date: Sat, 20 Nov 2021 00:41:21 -0700 Subject: [PATCH 2/8] plz dont prompt for input --- deploy/vagrant/bootstrap.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/deploy/vagrant/bootstrap.sh b/deploy/vagrant/bootstrap.sh index d614886ae..d52369637 100755 --- a/deploy/vagrant/bootstrap.sh +++ b/deploy/vagrant/bootstrap.sh @@ -4,6 +4,8 @@ # Exit if anything goes wrong set -e +export DEBIAN_FRONTEND=noninteractive + # Make sure puppet is installed if which puppet > /dev/null ; then echo "Puppet is already installed" From 121d319e117c1a365803792e3b8923d47e502b01 Mon Sep 17 00:00:00 2001 From: Dan Langford <721364+danlangford@users.noreply.github.com> Date: Sat, 20 Nov 2021 00:58:29 -0700 Subject: [PATCH 3/8] playing with puppet_hostname --- .../modules/buttonmen/templates/create_rds_database.erb | 2 +- deploy/vagrant/modules/postfix/templates/main.cf.erb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/deploy/vagrant/modules/buttonmen/templates/create_rds_database.erb b/deploy/vagrant/modules/buttonmen/templates/create_rds_database.erb index 294f44a80..9ea246311 100644 --- a/deploy/vagrant/modules/buttonmen/templates/create_rds_database.erb +++ b/deploy/vagrant/modules/buttonmen/templates/create_rds_database.erb @@ -15,7 +15,7 @@ if [ "$?" = "0" ]; then else echo "Creating <%= buttonmen_db1_name %>" echo "CREATE DATABASE <%= buttonmen_db1_name %>" | mysql ${MYSQL_ARGS} - echo "GRANT ALL ON <%= buttonmen_db1_name %>.* TO <%= buttonmen_db1_user %>@'<%= puppet_hostname %>' IDENTIFIED BY '<%= buttonmen_db1_pass %>'" | mysql ${MYSQL_ARGS} + echo "GRANT ALL ON <%= buttonmen_db1_name %>.* TO <%= buttonmen_db1_user %>@'<%= @puppet_hostname %>' IDENTIFIED BY '<%= buttonmen_db1_pass %>'" | mysql ${MYSQL_ARGS} echo "Populating <%= buttonmen_db1_name %>" cd /buttonmen/deploy/database diff --git a/deploy/vagrant/modules/postfix/templates/main.cf.erb b/deploy/vagrant/modules/postfix/templates/main.cf.erb index e47764105..a7fa86985 100644 --- a/deploy/vagrant/modules/postfix/templates/main.cf.erb +++ b/deploy/vagrant/modules/postfix/templates/main.cf.erb @@ -19,13 +19,13 @@ smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for # information on enabling SSL in the smtp client. -myhostname = <%= puppet_hostname %> +myhostname = <%= @puppet_hostname %> mydomain = buttonweavers.com alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases -myorigin = <%= puppet_hostname %> +myorigin = <%= @puppet_hostname %> masquerade_domains = $mydomain -mydestination = <%= puppet_hostname %>, localhost.buttonweavers.com, localhost +mydestination = <%= @puppet_hostname %>, localhost.buttonweavers.com, localhost relayhost = mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mailbox_size_limit = 0 From 30fcbb9d62271f03a2f6deb7d17b1a4633d2771f Mon Sep 17 00:00:00 2001 From: Dan Langford <721364+danlangford@users.noreply.github.com> Date: Sat, 20 Nov 2021 01:33:34 -0700 Subject: [PATCH 4/8] addtnl puppet changes --- deploy/vagrant/modules/apache/manifests/init.pp | 4 ++-- deploy/vagrant/modules/apache/templates/site_default.erb | 2 +- deploy/vagrant/modules/buttonmen/templates/apache.conf.erb | 2 +- .../vagrant/modules/buttonmen/templates/backup_database.erb | 2 +- .../modules/buttonmen/templates/create_rds_database.erb | 2 +- deploy/vagrant/modules/buttonmen/templates/mysql_root_cli.erb | 2 +- deploy/vagrant/modules/buttonmen/templates/test_config.erb | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/deploy/vagrant/modules/apache/manifests/init.pp b/deploy/vagrant/modules/apache/manifests/init.pp index 71722e8fc..ccadb4890 100644 --- a/deploy/vagrant/modules/apache/manifests/init.pp +++ b/deploy/vagrant/modules/apache/manifests/init.pp @@ -15,7 +15,7 @@ } # Monitor the error log - include "apache::server::feature::monitor-logs" + include "apache::server::feature::monitorlogs" # Install and configure letsencrypt (SSL/certbot) for AWS instances case "${ec2_services_partition}" { @@ -49,7 +49,7 @@ include "apache::server::vagrant" } -class apache::server::feature::monitor-logs { +class apache::server::feature::monitorlogs { # Install the logtail package package { diff --git a/deploy/vagrant/modules/apache/templates/site_default.erb b/deploy/vagrant/modules/apache/templates/site_default.erb index 790d56f86..bc8d40040 100644 --- a/deploy/vagrant/modules/apache/templates/site_default.erb +++ b/deploy/vagrant/modules/apache/templates/site_default.erb @@ -9,7 +9,7 @@ ## Set environment variables for buttonmen database access # Database 1 (primary) - SetEnv DB1_HOST <%= database_fqdn %> + SetEnv DB1_HOST <%= @database_fqdn %> SetEnv DB1_PORT 3306 SetEnv DB1_NAME buttonmen SetEnv DB1_USER bmuser1 diff --git a/deploy/vagrant/modules/buttonmen/templates/apache.conf.erb b/deploy/vagrant/modules/buttonmen/templates/apache.conf.erb index 070d0bef0..8f9229de7 100644 --- a/deploy/vagrant/modules/buttonmen/templates/apache.conf.erb +++ b/deploy/vagrant/modules/buttonmen/templates/apache.conf.erb @@ -3,7 +3,7 @@ ## Set environment variables for buttonmen database access # Database 1 (primary) - SetEnv DB1_HOST <%= database_fqdn %> + SetEnv DB1_HOST <%= @database_fqdn %> SetEnv DB1_PORT 3306 SetEnv DB1_NAME <%= buttonmen_db1_name %> SetEnv DB1_USER <%= buttonmen_db1_user %> diff --git a/deploy/vagrant/modules/buttonmen/templates/backup_database.erb b/deploy/vagrant/modules/buttonmen/templates/backup_database.erb index ee3d22c4e..06d29ee14 100644 --- a/deploy/vagrant/modules/buttonmen/templates/backup_database.erb +++ b/deploy/vagrant/modules/buttonmen/templates/backup_database.erb @@ -18,7 +18,7 @@ fi if [ -f "${CREDS_FILE}" ]; then . ${CREDS_FILE} # Need to disable GTID restores to backup/restore a remote RDS MySQL DB with default args - MYSQL_ARGS="-u ${BM_DB_ADMIN_USER} -p${BM_DB_ADMIN_PW} -h <%= database_fqdn %> --set-gtid-purged=OFF" + MYSQL_ARGS="-u ${BM_DB_ADMIN_USER} -p${BM_DB_ADMIN_PW} -h <%= @database_fqdn %> --set-gtid-purged=OFF" else MYSQL_ARGS="-u root" fi diff --git a/deploy/vagrant/modules/buttonmen/templates/create_rds_database.erb b/deploy/vagrant/modules/buttonmen/templates/create_rds_database.erb index 9ea246311..b52ef6273 100644 --- a/deploy/vagrant/modules/buttonmen/templates/create_rds_database.erb +++ b/deploy/vagrant/modules/buttonmen/templates/create_rds_database.erb @@ -7,7 +7,7 @@ if [ ! -f ${CREDS_FILE} ]; then fi . ${CREDS_FILE} -MYSQL_ARGS="-u ${BM_DB_ADMIN_USER} -p${BM_DB_ADMIN_PW} -h <%= database_fqdn %>" +MYSQL_ARGS="-u ${BM_DB_ADMIN_USER} -p${BM_DB_ADMIN_PW} -h <%= @database_fqdn %>" mysqlshow ${MYSQL_ARGS} <%= buttonmen_db1_name %> | grep -q "^Database: buttonmen" if [ "$?" = "0" ]; then diff --git a/deploy/vagrant/modules/buttonmen/templates/mysql_root_cli.erb b/deploy/vagrant/modules/buttonmen/templates/mysql_root_cli.erb index 48c895320..14fa5ca6f 100644 --- a/deploy/vagrant/modules/buttonmen/templates/mysql_root_cli.erb +++ b/deploy/vagrant/modules/buttonmen/templates/mysql_root_cli.erb @@ -9,7 +9,7 @@ DBNAME=buttonmen # database, and in particular an admin password if [ -f "${CREDS_FILE}" ]; then . ${CREDS_FILE} - MYSQL_ARGS="-u ${BM_DB_ADMIN_USER} -p${BM_DB_ADMIN_PW} -h <%= database_fqdn %>" + MYSQL_ARGS="-u ${BM_DB_ADMIN_USER} -p${BM_DB_ADMIN_PW} -h <%= @database_fqdn %>" else MYSQL_ARGS="-u root" fi diff --git a/deploy/vagrant/modules/buttonmen/templates/test_config.erb b/deploy/vagrant/modules/buttonmen/templates/test_config.erb index 4a335fec1..735530029 100644 --- a/deploy/vagrant/modules/buttonmen/templates/test_config.erb +++ b/deploy/vagrant/modules/buttonmen/templates/test_config.erb @@ -9,7 +9,7 @@ CONFIGFILE=/var/www/ui/js/Config.js # database, and in particular an admin password if [ -f "${CREDS_FILE}" ]; then . ${CREDS_FILE} - MYSQL_ARGS="-u ${BM_DB_ADMIN_USER} -p${BM_DB_ADMIN_PW} -h <%= database_fqdn %> --set-gtid-purged=OFF" + MYSQL_ARGS="-u ${BM_DB_ADMIN_USER} -p${BM_DB_ADMIN_PW} -h <%= @database_fqdn %> --set-gtid-purged=OFF" else MYSQL_ARGS="-u root" fi From d3d6af077ea25aab5668ac3aacb79c8a16b214ca Mon Sep 17 00:00:00 2001 From: Dan Langford <721364+danlangford@users.noreply.github.com> Date: Sat, 20 Nov 2021 01:33:34 -0700 Subject: [PATCH 5/8] addtnl puppet changes --- .../vagrant/modules/apache/manifests/init.pp | 4 +-- .../modules/apache/templates/site_default.erb | 2 +- .../buttonmen/templates/apache.conf.erb | 14 +++++----- .../buttonmen/templates/backup_database.erb | 2 +- .../buttonmen/templates/create_databases.erb | 28 +++++++++---------- .../templates/create_rds_database.erb | 16 +++++------ .../templates/create_test_database.erb | 14 +++++----- .../buttonmen/templates/mysql_root_cli.erb | 2 +- .../buttonmen/templates/test_config.erb | 2 +- 9 files changed, 42 insertions(+), 42 deletions(-) diff --git a/deploy/vagrant/modules/apache/manifests/init.pp b/deploy/vagrant/modules/apache/manifests/init.pp index 71722e8fc..ccadb4890 100644 --- a/deploy/vagrant/modules/apache/manifests/init.pp +++ b/deploy/vagrant/modules/apache/manifests/init.pp @@ -15,7 +15,7 @@ } # Monitor the error log - include "apache::server::feature::monitor-logs" + include "apache::server::feature::monitorlogs" # Install and configure letsencrypt (SSL/certbot) for AWS instances case "${ec2_services_partition}" { @@ -49,7 +49,7 @@ include "apache::server::vagrant" } -class apache::server::feature::monitor-logs { +class apache::server::feature::monitorlogs { # Install the logtail package package { diff --git a/deploy/vagrant/modules/apache/templates/site_default.erb b/deploy/vagrant/modules/apache/templates/site_default.erb index 790d56f86..bc8d40040 100644 --- a/deploy/vagrant/modules/apache/templates/site_default.erb +++ b/deploy/vagrant/modules/apache/templates/site_default.erb @@ -9,7 +9,7 @@ ## Set environment variables for buttonmen database access # Database 1 (primary) - SetEnv DB1_HOST <%= database_fqdn %> + SetEnv DB1_HOST <%= @database_fqdn %> SetEnv DB1_PORT 3306 SetEnv DB1_NAME buttonmen SetEnv DB1_USER bmuser1 diff --git a/deploy/vagrant/modules/buttonmen/templates/apache.conf.erb b/deploy/vagrant/modules/buttonmen/templates/apache.conf.erb index 070d0bef0..79a7927f2 100644 --- a/deploy/vagrant/modules/buttonmen/templates/apache.conf.erb +++ b/deploy/vagrant/modules/buttonmen/templates/apache.conf.erb @@ -3,16 +3,16 @@ ## Set environment variables for buttonmen database access # Database 1 (primary) - SetEnv DB1_HOST <%= database_fqdn %> + SetEnv DB1_HOST <%= @database_fqdn %> SetEnv DB1_PORT 3306 - SetEnv DB1_NAME <%= buttonmen_db1_name %> - SetEnv DB1_USER <%= buttonmen_db1_user %> - SetEnv DB1_PASS <%= buttonmen_db1_pass %> + SetEnv DB1_NAME <%= @buttonmen_db1_name %> + SetEnv DB1_USER <%= @buttonmen_db1_user %> + SetEnv DB1_PASS <%= @buttonmen_db1_pass %> # Database 2 (test) SetEnv DB2_HOST 127.0.0.1 SetEnv DB2_PORT 3306 - SetEnv DB2_NAME <%= buttonmen_db2_name %> - SetEnv DB2_USER <%= buttonmen_db2_user %> - SetEnv DB2_PASS <%= buttonmen_db2_pass %> + SetEnv DB2_NAME <%= @buttonmen_db2_name %> + SetEnv DB2_USER <%= @buttonmen_db2_user %> + SetEnv DB2_PASS <%= @buttonmen_db2_pass %> diff --git a/deploy/vagrant/modules/buttonmen/templates/backup_database.erb b/deploy/vagrant/modules/buttonmen/templates/backup_database.erb index ee3d22c4e..06d29ee14 100644 --- a/deploy/vagrant/modules/buttonmen/templates/backup_database.erb +++ b/deploy/vagrant/modules/buttonmen/templates/backup_database.erb @@ -18,7 +18,7 @@ fi if [ -f "${CREDS_FILE}" ]; then . ${CREDS_FILE} # Need to disable GTID restores to backup/restore a remote RDS MySQL DB with default args - MYSQL_ARGS="-u ${BM_DB_ADMIN_USER} -p${BM_DB_ADMIN_PW} -h <%= database_fqdn %> --set-gtid-purged=OFF" + MYSQL_ARGS="-u ${BM_DB_ADMIN_USER} -p${BM_DB_ADMIN_PW} -h <%= @database_fqdn %> --set-gtid-purged=OFF" else MYSQL_ARGS="-u root" fi diff --git a/deploy/vagrant/modules/buttonmen/templates/create_databases.erb b/deploy/vagrant/modules/buttonmen/templates/create_databases.erb index 5f515e6ca..09c64274e 100644 --- a/deploy/vagrant/modules/buttonmen/templates/create_databases.erb +++ b/deploy/vagrant/modules/buttonmen/templates/create_databases.erb @@ -1,26 +1,26 @@ #!/bin/sh -mysqlshow -u root <%= buttonmen_db1_name %> | grep -q "^Database: buttonmen" +mysqlshow -u root <%= @buttonmen_db1_name %> | grep -q "^Database: buttonmen" if [ "$?" = "0" ]; then - echo "<%= buttonmen_db1_name %> already exists" + echo "<%= @buttonmen_db1_name %> already exists" else - echo "Creating <%= buttonmen_db1_name %>" - echo "CREATE DATABASE <%= buttonmen_db1_name %>" | mysql -u root - echo "GRANT ALL ON <%= buttonmen_db1_name %>.* TO <%= buttonmen_db1_user %>@localhost IDENTIFIED BY '<%= buttonmen_db1_pass %>'" | mysql -u root + echo "Creating <%= @buttonmen_db1_name %>" + echo "CREATE DATABASE <%= @buttonmen_db1_name %>" | mysql -u root + echo "GRANT ALL ON <%= @buttonmen_db1_name %>.* TO <%= @buttonmen_db1_user %>@localhost IDENTIFIED BY '<%= @buttonmen_db1_pass %>'" | mysql -u root - echo "Populating <%= buttonmen_db1_name %>" + echo "Populating <%= @buttonmen_db1_name %>" cd /buttonmen/deploy/database - mysql -u root <%= buttonmen_db1_name %> < initialize_all.sql + mysql -u root <%= @buttonmen_db1_name %> < initialize_all.sql fi -mysqlshow -u root <%= buttonmen_db2_name %> | grep -q "^Database: buttonmen_test" +mysqlshow -u root <%= @buttonmen_db2_name %> | grep -q "^Database: buttonmen_test" if [ "$?" = "0" ]; then - echo "<%= buttonmen_db2_name %> already exists - recreating it" + echo "<%= @buttonmen_db2_name %> already exists - recreating it" echo "DROP DATABASE buttonmen_test" | mysql -u root fi -echo "Creating <%= buttonmen_db2_name %>" -echo "CREATE DATABASE <%= buttonmen_db2_name %>" | mysql -u root -echo "GRANT ALL ON <%= buttonmen_db2_name %>.* TO <%= buttonmen_db2_user %>@localhost IDENTIFIED BY '<%= buttonmen_db2_pass %>'" | mysql -u root -echo "Populating <%= buttonmen_db2_name %>" +echo "Creating <%= @buttonmen_db2_name %>" +echo "CREATE DATABASE <%= @buttonmen_db2_name %>" | mysql -u root +echo "GRANT ALL ON <%= @buttonmen_db2_name %>.* TO <%= @buttonmen_db2_user %>@localhost IDENTIFIED BY '<%= @buttonmen_db2_pass %>'" | mysql -u root +echo "Populating <%= @buttonmen_db2_name %>" cd /buttonmen/deploy/database -mysql -u <%= buttonmen_db2_user%> -p<%= buttonmen_db2_pass %> <%= buttonmen_db2_name %> < initialize_all.sql +mysql -u <%= @buttonmen_db2_user%> -p<%= @buttonmen_db2_pass %> <%= @buttonmen_db2_name %> < initialize_all.sql diff --git a/deploy/vagrant/modules/buttonmen/templates/create_rds_database.erb b/deploy/vagrant/modules/buttonmen/templates/create_rds_database.erb index 9ea246311..cd0e3ee56 100644 --- a/deploy/vagrant/modules/buttonmen/templates/create_rds_database.erb +++ b/deploy/vagrant/modules/buttonmen/templates/create_rds_database.erb @@ -7,17 +7,17 @@ if [ ! -f ${CREDS_FILE} ]; then fi . ${CREDS_FILE} -MYSQL_ARGS="-u ${BM_DB_ADMIN_USER} -p${BM_DB_ADMIN_PW} -h <%= database_fqdn %>" +MYSQL_ARGS="-u ${BM_DB_ADMIN_USER} -p${BM_DB_ADMIN_PW} -h <%= @database_fqdn %>" -mysqlshow ${MYSQL_ARGS} <%= buttonmen_db1_name %> | grep -q "^Database: buttonmen" +mysqlshow ${MYSQL_ARGS} <%= @buttonmen_db1_name %> | grep -q "^Database: buttonmen" if [ "$?" = "0" ]; then - echo "<%= buttonmen_db1_name %> already exists" + echo "<%= @buttonmen_db1_name %> already exists" else - echo "Creating <%= buttonmen_db1_name %>" - echo "CREATE DATABASE <%= buttonmen_db1_name %>" | mysql ${MYSQL_ARGS} - echo "GRANT ALL ON <%= buttonmen_db1_name %>.* TO <%= buttonmen_db1_user %>@'<%= @puppet_hostname %>' IDENTIFIED BY '<%= buttonmen_db1_pass %>'" | mysql ${MYSQL_ARGS} + echo "Creating <%= @buttonmen_db1_name %>" + echo "CREATE DATABASE <%= @buttonmen_db1_name %>" | mysql ${MYSQL_ARGS} + echo "GRANT ALL ON <%= @buttonmen_db1_name %>.* TO <%= @buttonmen_db1_user %>@'<%= @puppet_hostname %>' IDENTIFIED BY '<%= @buttonmen_db1_pass %>'" | mysql ${MYSQL_ARGS} - echo "Populating <%= buttonmen_db1_name %>" + echo "Populating <%= @buttonmen_db1_name %>" cd /buttonmen/deploy/database - mysql ${MYSQL_ARGS} <%= buttonmen_db1_name %> < initialize_all.sql + mysql ${MYSQL_ARGS} <%= @buttonmen_db1_name %> < initialize_all.sql fi diff --git a/deploy/vagrant/modules/buttonmen/templates/create_test_database.erb b/deploy/vagrant/modules/buttonmen/templates/create_test_database.erb index 9766a7a76..906f3b577 100644 --- a/deploy/vagrant/modules/buttonmen/templates/create_test_database.erb +++ b/deploy/vagrant/modules/buttonmen/templates/create_test_database.erb @@ -1,13 +1,13 @@ #!/bin/sh -mysqlshow -u root <%= buttonmen_db2_name %> | grep -q "^Database: buttonmen_test" +mysqlshow -u root <%= @buttonmen_db2_name %> | grep -q "^Database: buttonmen_test" if [ "$?" = "0" ]; then - echo "<%= buttonmen_db2_name %> already exists - recreating it" + echo "<%= @buttonmen_db2_name %> already exists - recreating it" echo "DROP DATABASE buttonmen_test" | mysql -u root fi -echo "Creating <%= buttonmen_db2_name %>" -echo "CREATE DATABASE <%= buttonmen_db2_name %>" | mysql -u root -echo "GRANT ALL ON <%= buttonmen_db2_name %>.* TO <%= buttonmen_db2_user %>@localhost IDENTIFIED BY '<%= buttonmen_db2_pass %>'" | mysql -u root -echo "Populating <%= buttonmen_db2_name %>" +echo "Creating <%= @buttonmen_db2_name %>" +echo "CREATE DATABASE <%= @buttonmen_db2_name %>" | mysql -u root +echo "GRANT ALL ON <%= @buttonmen_db2_name %>.* TO <%= @buttonmen_db2_user %>@localhost IDENTIFIED BY '<%= @buttonmen_db2_pass %>'" | mysql -u root +echo "Populating <%= @buttonmen_db2_name %>" cd deploy/database -mysql -u <%= buttonmen_db2_user%> -p<%= buttonmen_db2_pass %> <%= buttonmen_db2_name %> < initialize_all.sql +mysql -u <%= @buttonmen_db2_user%> -p<%= @buttonmen_db2_pass %> <%= @buttonmen_db2_name %> < initialize_all.sql diff --git a/deploy/vagrant/modules/buttonmen/templates/mysql_root_cli.erb b/deploy/vagrant/modules/buttonmen/templates/mysql_root_cli.erb index 48c895320..14fa5ca6f 100644 --- a/deploy/vagrant/modules/buttonmen/templates/mysql_root_cli.erb +++ b/deploy/vagrant/modules/buttonmen/templates/mysql_root_cli.erb @@ -9,7 +9,7 @@ DBNAME=buttonmen # database, and in particular an admin password if [ -f "${CREDS_FILE}" ]; then . ${CREDS_FILE} - MYSQL_ARGS="-u ${BM_DB_ADMIN_USER} -p${BM_DB_ADMIN_PW} -h <%= database_fqdn %>" + MYSQL_ARGS="-u ${BM_DB_ADMIN_USER} -p${BM_DB_ADMIN_PW} -h <%= @database_fqdn %>" else MYSQL_ARGS="-u root" fi diff --git a/deploy/vagrant/modules/buttonmen/templates/test_config.erb b/deploy/vagrant/modules/buttonmen/templates/test_config.erb index 4a335fec1..735530029 100644 --- a/deploy/vagrant/modules/buttonmen/templates/test_config.erb +++ b/deploy/vagrant/modules/buttonmen/templates/test_config.erb @@ -9,7 +9,7 @@ CONFIGFILE=/var/www/ui/js/Config.js # database, and in particular an admin password if [ -f "${CREDS_FILE}" ]; then . ${CREDS_FILE} - MYSQL_ARGS="-u ${BM_DB_ADMIN_USER} -p${BM_DB_ADMIN_PW} -h <%= database_fqdn %> --set-gtid-purged=OFF" + MYSQL_ARGS="-u ${BM_DB_ADMIN_USER} -p${BM_DB_ADMIN_PW} -h <%= @database_fqdn %> --set-gtid-purged=OFF" else MYSQL_ARGS="-u root" fi From 472697b417eb3d7c2ea6a9592fba28fc6d94a1b0 Mon Sep 17 00:00:00 2001 From: Dan Langford <721364+danlangford@users.noreply.github.com> Date: Sat, 20 Nov 2021 01:49:20 -0700 Subject: [PATCH 6/8] file mode strings --- .../vagrant/modules/apache/manifests/init.pp | 4 ++-- .../modules/buttonmen/manifests/init.pp | 18 +++++++++--------- .../modules/cloudwatch/manifests/init.pp | 2 +- deploy/vagrant/modules/fqdn/manifests/init.pp | 2 +- deploy/vagrant/modules/sudo/manifests/init.pp | 2 +- deploy/vagrant/modules/user/manifests/init.pp | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/deploy/vagrant/modules/apache/manifests/init.pp b/deploy/vagrant/modules/apache/manifests/init.pp index ccadb4890..ca16d36b3 100644 --- a/deploy/vagrant/modules/apache/manifests/init.pp +++ b/deploy/vagrant/modules/apache/manifests/init.pp @@ -60,13 +60,13 @@ # Setup a directory for logtail2 to use for its offset files "/var/spool/logtail": ensure => directory, - mode => 0755; + mode => "0755"; # Install a script to use for monitoring logs "/usr/local/sbin/monitor_apache_logs": ensure => file, content => template("apache/monitor_apache_logs.erb"), - mode => 0555; + mode => "0555"; } # Run the log-monitoring script from a nightly cron job diff --git a/deploy/vagrant/modules/buttonmen/manifests/init.pp b/deploy/vagrant/modules/buttonmen/manifests/init.pp index 227ecb3d8..98d3fe205 100644 --- a/deploy/vagrant/modules/buttonmen/manifests/init.pp +++ b/deploy/vagrant/modules/buttonmen/manifests/init.pp @@ -20,42 +20,42 @@ "/usr/local/bin/create_buttonmen_databases": ensure => file, content => template("buttonmen/create_databases.erb"), - mode => 0555; + mode => "0555"; "/usr/local/bin/create_rds_database": ensure => file, content => template("buttonmen/create_rds_database.erb"), - mode => 0555; + mode => "0555"; "/usr/local/bin/backup_buttonmen_database": ensure => file, content => template("buttonmen/backup_database.erb"), - mode => 0555; + mode => "0555"; "/usr/local/bin/test_buttonmen_config": ensure => file, content => template("buttonmen/test_config.erb"), - mode => 0555; + mode => "0555"; "/usr/local/bin/mysql_root_cli": ensure => file, content => template("buttonmen/mysql_root_cli.erb"), - mode => 0544; + mode => "0544"; "/usr/local/bin/run_buttonmen_tests": ensure => file, content => template("buttonmen/run_buttonmen_tests.erb"), - mode => 0555; + mode => "0555"; "/usr/local/bin/setup_buttonmen_ui_cache_links": ensure => file, content => template("buttonmen/setup_ui_cache_links.erb"), - mode => 0555; + mode => "0555"; "/usr/local/bin/audit_js_unit_test_coverage": ensure => file, content => template("buttonmen/audit_js_unit_test_coverage.erb"), - mode => 0555; + mode => "0555"; "/usr/local/etc/buttonmen_phpunit.php": ensure => file, @@ -64,7 +64,7 @@ "/srv/backup": ensure => directory, group => "adm", - mode => 0750; + mode => "0750"; } exec { diff --git a/deploy/vagrant/modules/cloudwatch/manifests/init.pp b/deploy/vagrant/modules/cloudwatch/manifests/init.pp index a00dc6660..57e3b0455 100644 --- a/deploy/vagrant/modules/cloudwatch/manifests/init.pp +++ b/deploy/vagrant/modules/cloudwatch/manifests/init.pp @@ -9,7 +9,7 @@ "/usr/local/bin/record_buttonmen_cloudwatch_metrics": ensure => file, content => template("cloudwatch/record_buttonmen_metrics.erb"), - mode => 0555; + mode => "0555"; } # Record cloudwatch metrics from apache logs every five minutes diff --git a/deploy/vagrant/modules/fqdn/manifests/init.pp b/deploy/vagrant/modules/fqdn/manifests/init.pp index a50ade07e..5c87cc673 100644 --- a/deploy/vagrant/modules/fqdn/manifests/init.pp +++ b/deploy/vagrant/modules/fqdn/manifests/init.pp @@ -11,7 +11,7 @@ "/usr/local/bin/fqdn_from_ec2_tags": ensure => file, content => template("fqdn/from_ec2_tags.erb"), - mode => 555; + mode => "0555"; } # Use fqdn_from_ec2_tags to populate or update a site file diff --git a/deploy/vagrant/modules/sudo/manifests/init.pp b/deploy/vagrant/modules/sudo/manifests/init.pp index 3276ca932..ea6e1c8e9 100644 --- a/deploy/vagrant/modules/sudo/manifests/init.pp +++ b/deploy/vagrant/modules/sudo/manifests/init.pp @@ -2,7 +2,7 @@ file { "/etc/sudoers.d/99-buttonmen-dev": ensure => file, - mode => 0440, + mode => "0440", content => "%admin ALL=(ALL) NOPASSWD:ALL\n"; } } diff --git a/deploy/vagrant/modules/user/manifests/init.pp b/deploy/vagrant/modules/user/manifests/init.pp index b0d51e362..5ba8581c7 100644 --- a/deploy/vagrant/modules/user/manifests/init.pp +++ b/deploy/vagrant/modules/user/manifests/init.pp @@ -51,7 +51,7 @@ owner => "chaos", group => "chaos", content => template("user/chaos_install_rcfiles.erb"), - mode => 0544, + mode => "0544", require => User["chaos"]; } } From c60467b7e6d78d331e7cc0b435c0a162215e9628 Mon Sep 17 00:00:00 2001 From: Dan Langford <721364+danlangford@users.noreply.github.com> Date: Sat, 20 Nov 2021 01:56:50 -0700 Subject: [PATCH 7/8] try to force onto php7.4 --- deploy/vagrant/modules/php/manifests/init.pp | 30 ++++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/deploy/vagrant/modules/php/manifests/init.pp b/deploy/vagrant/modules/php/manifests/init.pp index 152c860ab..a59eed9df 100644 --- a/deploy/vagrant/modules/php/manifests/init.pp +++ b/deploy/vagrant/modules/php/manifests/init.pp @@ -2,19 +2,19 @@ # Make sure php7 and libapache2-mod-php are installed package { - "php": ensure => installed; + "php7.4": ensure => installed; "libapache2-mod-php": ensure => installed; - "php7.0-mbstring": ensure => installed; + "php7.4-mbstring": ensure => installed; } file { - "/etc/php/7.0/apache2/conf.d/buttonmen.ini": + "/etc/php/7.4/apache2/conf.d/buttonmen.ini": ensure => file, content => template("php/buttonmen.ini.erb"), notify => Service["apache2"], require => Package["libapache2-mod-php"]; - "/etc/php/7.0/deploy-includes": + "/etc/php/7.4/deploy-includes": ensure => directory, require => Package["libapache2-mod-php"]; } @@ -46,19 +46,19 @@ unless => "/usr/bin/pear config-get auto_discover | /bin/grep -q 1"; "php_wget_install_phpmd": - command => "/usr/bin/wget --no-verbose -O /etc/php/7.0/deploy-includes/phpmd.phar http://static.phpmd.org/php/latest/phpmd.phar", - creates => "/etc/php/7.0/deploy-includes/phpmd.phar", - require => File["/etc/php/7.0/deploy-includes"]; + command => "/usr/bin/wget --no-verbose -O /etc/php/7.4/deploy-includes/phpmd.phar http://static.phpmd.org/php/latest/phpmd.phar", + creates => "/etc/php/7.4/deploy-includes/phpmd.phar", + require => File["/etc/php/7.4/deploy-includes"]; "php_wget_install_phpcpd": - command => "/usr/bin/wget --no-verbose -O /etc/php/7.0/deploy-includes/phpcpd.phar https://phar.phpunit.de/phpcpd.phar", - creates => "/etc/php/7.0/deploy-includes/phpcpd.phar", - require => File["/etc/php/7.0/deploy-includes"]; + command => "/usr/bin/wget --no-verbose -O /etc/php/7.4/deploy-includes/phpcpd.phar https://phar.phpunit.de/phpcpd.phar", + creates => "/etc/php/7.4/deploy-includes/phpcpd.phar", + require => File["/etc/php/7.4/deploy-includes"]; "php_wget_install_phpcb": - command => "/usr/bin/wget --no-verbose -O /etc/php/7.0/deploy-includes/phpcb.phar https://github.com/bytepark/php-phar-qatools/blob/master/phpcb.phar", - creates => "/etc/php/7.0/deploy-includes/phpcb.phar", - require => File["/etc/php/7.0/deploy-includes"]; + command => "/usr/bin/wget --no-verbose -O /etc/php/7.4/deploy-includes/phpcb.phar https://github.com/bytepark/php-phar-qatools/blob/master/phpcb.phar", + creates => "/etc/php/7.4/deploy-includes/phpcb.phar", + require => File["/etc/php/7.4/deploy-includes"]; "php_pear_discover_phpdoc": command => "/usr/bin/pear channel-discover pear.phpdoc.org", @@ -66,12 +66,12 @@ unless => "/usr/bin/pear list-channels | /bin/grep pear.phpdoc.org"; "php_pear_install_phpcs": - command => "/usr/bin/wget --no-verbose -O /etc/php/7.0/deploy-includes/phpcs.phar https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar", + command => "/usr/bin/wget --no-verbose -O /etc/php/7.4/deploy-includes/phpcs.phar https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar", require => Exec["php_pear_set_auto_discover"], creates => "/usr/bin/phpcs"; "php_pear_install_phpdocumenter": - command => "/usr/bin/pear install phpdoc/phpDocumentor-2.7.0", + command => "/usr/bin/pear install phpdoc/phpDocumentor-2.7.4", require => Exec["php_pear_discover_phpdoc"], creates => "/usr/share/php/phpDocumentor"; } From f34170165cff63c6e2a764668f229ac4f3f42f57 Mon Sep 17 00:00:00 2001 From: Dan Langford <721364+danlangford@users.noreply.github.com> Date: Sat, 20 Nov 2021 02:20:46 -0700 Subject: [PATCH 8/8] addressing some php phar things --- deploy/vagrant/modules/php/manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/vagrant/modules/php/manifests/init.pp b/deploy/vagrant/modules/php/manifests/init.pp index a59eed9df..09f726f6f 100644 --- a/deploy/vagrant/modules/php/manifests/init.pp +++ b/deploy/vagrant/modules/php/manifests/init.pp @@ -46,7 +46,7 @@ unless => "/usr/bin/pear config-get auto_discover | /bin/grep -q 1"; "php_wget_install_phpmd": - command => "/usr/bin/wget --no-verbose -O /etc/php/7.4/deploy-includes/phpmd.phar http://static.phpmd.org/php/latest/phpmd.phar", + command => "/usr/bin/wget --no-verbose -O /etc/php/7.4/deploy-includes/phpmd.phar https://phpmd.org/static/latest/phpmd.phar", creates => "/etc/php/7.4/deploy-includes/phpmd.phar", require => File["/etc/php/7.4/deploy-includes"];