feature: discourse-setup email config improvements
authorJay Pfaffman <pfaffman@gmail.com>
Thu, 11 Feb 2021 19:19:41 +0000 (11:19 -0800)
committerRafael dos Santos Silva <xfalcox@gmail.com>
Mon, 22 Feb 2021 19:27:38 +0000 (16:27 -0300)
discourse-setup
samples/standalone.yml
samples/web_only.yml
tests/README.md [new file with mode: 0644]
tests/run-all-tests [new file with mode: 0755]
tests/standalone [new file with mode: 0755]
tests/two-container [new file with mode: 0755]
tests/update-old-templates [new file with mode: 0755]

index 75094e28fd3d1afa7fec9dd48666607c93570fed..fec83702be16b3aced76b1361f7b30981ec88e3a 100755 (executable)
@@ -2,6 +2,34 @@
 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 cd $DIR
 
+if [ "$1" == "2container" ] 
+then
+  TWO_CONTAINER="1"
+  echo "2container argument is deprecated. Use --two-container"
+  shift 1
+fi
+
+while [ ${#} -gt 0 ]; do
+  case "${1}" in
+  --debug)
+    DEBUG="1"
+    SKIP_REBUILD="1"
+    ;;
+  --skip-rebuild)
+    SKIP_REBUILD="1"
+    ;;
+  --two-container)
+    TWO_CONTAINER="1"
+    ;;
+  --skip-connection-test)
+    SKIP_CONNECTION_TEST="1"
+    echo "skipping connection test"
+    ;;
+  esac
+
+  shift 1
+done
+
 ##
 ## Make sure only root can run our script
 ##
@@ -45,8 +73,14 @@ connect_to_port () {
 check_IP_match() {
   HOST="$1"
   echo
-  echo Checking your domain name . . .
-  connect_to_port $HOST 443; ec=$?
+  if [ "$SKIP_CONNECTION_TEST" == 1 ]
+  then 
+    echo "Setting EC to 2"
+    ec=2
+  else
+    echo Checking your domain name . . .
+    connect_to_port $HOST 443; ec=$?
+  fi
   case $ec in
     0)
       echo "Connection to $HOST succeeded."
@@ -80,7 +114,7 @@ check_IP_match() {
       exit 1
       ;;
     2)
-      echo "Continuing without port check."
+      echo "Skipping port check."
       ;;
   esac
 }
@@ -278,7 +312,7 @@ check_ports() {
 ##
 check_port() {
 
-  local valid=$(netstat -tln | awk '{print $4}' | grep ":${1}\$")
+  local valid=$(lsof -i:${1} | grep "LISTEN")
 
   if [ -n "$valid" ]; then
     echo "Port ${1} appears to already be in use."
@@ -336,6 +370,50 @@ EOF
   fi
 }
 
+assert_smtp_domain() {
+  if  ! grep DISCOURSE_SMTP_DOMAIN $web_file >/dev/null 2>&1
+  then
+    echo "Adding SMTP_DOMAIN placeholder to $web_file"
+    sed -i '/^.*DISCOURSE_SMTP_PASSWORD.*/a \ \ #DISCOURSE_SMTP_DOMAIN: discourse.example.com    # (required by some providers)' $web_file
+  fi
+  if  ! grep DISCOURSE_SMTP_DOMAIN $web_file >/dev/null 2>&1
+  then
+    cat <<EOF
+
+    Adding DISCOURSE_SMTP_DOMAIN to $web_file has failed! This
+    indicates either that your $web_file is very old or otherwise not
+    what the script expects or that there is a bug in this script. The
+    best solution for a novice is to delete $web_file and start over.
+    An expert might prefer to edit $web_file by hand.
+
+EOF
+    read -p "Press return to continue or control-c to quit..."
+  fi
+}
+
+
+assert_notification_email() {
+  if  ! grep DISCOURSE_NOTIFICATION_EMAIL $web_file >/dev/null 2>&1
+  then
+    echo "Adding DISCOURSE_NOTIFICATION_EMAIL placeholder to $web_file"
+    sed -i '/^.*DISCOURSE_SMTP_PASSWORD.*/a \ \ #DISCOURSE_NOTIFICATION_EMAIL: nobody@discourse.example.com    # (address to send notifications from)' $web_file
+  fi
+  if  ! grep DISCOURSE_NOTIFICATION_EMAIL $web_file >/dev/null 2>&1
+  then
+    cat <<EOF
+
+    Adding DISCOURSE_NOTIFICATION_EMAIL to $web_file has failed! This
+    indicates either that your $web_file is very old or otherwise not
+    what the script expects or that there is a bug in this script. The
+    best solution for a novice is to delete $web_file and start over.
+    An expert might prefer to edit $web_file by hand.
+
+EOF
+    read -p "Press return to continue or control-c to quit..."
+  fi
+}
+
+
 ##
 ## prompt user for typical Discourse config file values
 ##
@@ -343,6 +421,8 @@ ask_user_for_config() {
 
   # NOTE: Defaults now come from standalone.yml
 
+  read_config "DISCOURSE_HOSTNAME"
+  hostname=$read_config_result
   local changelog=/tmp/changelog.$PPID
   read_config "DISCOURSE_SMTP_ADDRESS"
   local smtp_address=$read_config_result
@@ -359,6 +439,11 @@ ask_user_for_config() {
   then
     smtp_password = ""
   fi
+  read_config "DISCOURSE_NOTIFICATION_EMAIL"
+  local notification_email=$read_config_result
+  read_config "DISCOURSE_SMTP_DOMAIN"
+  local discourse_smtp_DOMAIN=$read_config_result
+
   read_config "LETSENCRYPT_ACCOUNT_EMAIL"
   local letsencrypt_account_email=$read_config_result
   if [ -z $letsencrypt_account_email ]
@@ -383,9 +468,6 @@ ask_user_for_config() {
     local maxmind_status="ENTER to continue without MAXMIND GeoLite2 geolocation database"
   fi
 
-  read_config "DISCOURSE_HOSTNAME"
-  hostname=$read_config_result
-
   local new_value=""
   local config_ok="n"
   local update_ok="y"
@@ -464,11 +546,11 @@ ask_user_for_config() {
       fi
       if [ "$smtp_address" == "smtp.sendgrid.net" ]
       then
-       smtp_user_name="apikey"
+        smtp_user_name="apikey"
       fi
       if [ "$smtp_address" == "smtp.mailgun.org" ]
       then
-       smtp_user_name="postmaster@$hostname"
+        smtp_user_name="postmaster@$hostname"
       fi
     fi
 
@@ -487,6 +569,20 @@ ask_user_for_config() {
       smtp_password="$new_value"
     fi
 
+    if [[ "$notification_email" == "noreply@discourse.example.com"* ]]
+    then
+      notification_email="noreply@$hostname"
+    fi
+  
+    read -p "notification email address? [$notification_email]: " new_value
+    if [ ! -z "$new_value" ]
+    then
+      notification_email="$new_value"
+    fi
+
+    # set smtp_domain default value here rather than use Rails default of localhost
+    smtp_domain=$(echo $notification_email | sed -e "s/.*@//")
+
     if [ ! -z $letsencrypt_account_email ]
     then
       read -p "Optional email address for Let's Encrypt warnings? ($letsencrypt_status) [$letsencrypt_account_email]: " new_value
@@ -511,12 +607,13 @@ ask_user_for_config() {
     fi
 
     echo -e "\nDoes this look right?\n"
-    echo "Hostname      : $hostname"
-    echo "Email         : $developer_emails"
-    echo "SMTP address  : $smtp_address"
-    echo "SMTP port     : $smtp_port"
-    echo "SMTP username : $smtp_user_name"
-    echo "SMTP password : $smtp_password"
+    echo "Hostname          : $hostname"
+    echo "Email             : $developer_emails"
+    echo "SMTP address      : $smtp_address"
+    echo "SMTP port         : $smtp_port"
+    echo "SMTP username     : $smtp_user_name"
+    echo "SMTP password     : $smtp_password"
+    echo "Notification email: $notification_email"
 
     if [ "$letsencrypt_status" == "Enter 'OFF' to disable." ]
     then
@@ -579,6 +676,24 @@ ask_user_for_config() {
     update_ok="n"
   fi
 
+  sed -i -e "s/^  #\?DISCOURSE_NOTIFICATION_EMAIL:.*/  DISCOURSE_NOTIFICATION_EMAIL: $notification_email/w $changelog" $web_file
+  if [ -s $changelog ]
+  then
+    rm $changelog
+  else
+    echo "DISCOURSE_NOTIFICATION_EMAIL change failed."
+    update_ok="n"
+  fi
+
+  sed -i -e "s/^  #\?DISCOURSE_SMTP_DOMAIN:.*/  DISCOURSE_SMTP_DOMAIN: $smtp_domain/w $changelog" $web_file
+  if [ -s $changelog ]
+  then
+    rm $changelog
+  else
+    echo "DISCOURSE_SMTP_DOMAIN change failed."
+    update_ok="n"
+  fi
+
   if [[ "$smtp_password" == *"\""* ]]
   then
     SLASH="BROKEN"
@@ -621,7 +736,10 @@ ask_user_for_config() {
     fi
   fi
 
-  echo "Enabling Let's Encrypt"
+  if ! [ -z $DEBUG ]
+  then
+    echo "Enabling Let's Encrypt"
+  fi
   sed -i -e "s/^  #\?LETSENCRYPT_ACCOUNT_EMAIL:.*/  LETSENCRYPT_ACCOUNT_EMAIL: $letsencrypt_account_email/w $changelog" $web_file
   if [ -s $changelog ]
   then
@@ -635,7 +753,10 @@ ask_user_for_config() {
   sed -i -e "s/$src/$dst/w $changelog" $web_file
   if [ -s $changelog ]
   then
-    echo "web.ssl.template.yml enabled"
+  if ! [ -z $DEBUG ]
+    then
+      echo "web.ssl.template.yml enabled"
+    fi
   else
     update_ok="n"
     echo "web.ssl.template.yml NOT ENABLED--was it on already?"
@@ -655,7 +776,6 @@ ask_user_for_config() {
   echo
   if [ $maxmind_license_key != "1234567890123456" ]
   then
-    echo "Setting MAXMIND key to $maxmind_license_key in $web_file"
     sed -i -e "s/^.*DISCOURSE_MAXMIND_LICENSE_KEY:.*/  DISCOURSE_MAXMIND_LICENSE_KEY: $maxmind_license_key/w $changelog" $web_file
     if [ -s $changelog ]
     then
@@ -668,10 +788,10 @@ ask_user_for_config() {
 
   if [ "$update_ok" == "y" ]
   then
-    echo -e "\nConfiguration file at $config_file updated successfully!\n"
+    echo -e "\nConfiguration file at $web_file updated successfully!\n"
   else
-    echo -e "\nUnfortunately, there was an error changing $config_file\n"
-    echo -d "This may happen if you have made unexpected changes."
+    echo -e "\nUnfortunately, there was an error changing $web_file\n"
+    echo -e "This may happen if you have made unexpected changes."
     exit 1
   fi
 }
@@ -723,7 +843,7 @@ validate_config() {
 ## template file names
 ##
 
-if [ "$1" == "2container" ] || [ -f containers/web_only.yml ]
+if [ "$TWO_CONTAINER" ] || [ -f containers/web_only.yml ]
 then
   app_name=web_only
   data_name=data
@@ -760,12 +880,17 @@ then
   echo Saving old file as $BACKUP
   cp $web_file containers/$BACKUP
   echo "Stopping existing container in 5 seconds or Control-C to cancel."
-  sleep 5
+  #sleep 5
   assert_maxmind_license_key
-  ./launcher stop $app_name
+  assert_notification_email
+  assert_smtp_domain
+  #./launcher stop $app_name
   echo
 else
-  check_ports
+  if [ "$SKIP_CONNECTION_TEST" != 1 ]
+  then 
+    check_ports
+  fi
   cp -v $web_template $web_file
   if [ "$data_name" == "data" ]
   then
@@ -802,8 +927,15 @@ validate_config
 ## if we reach this point without exiting, OK to proceed
 ## rebuild won't fail if there's nothing to rebuild and does the restart
 ##
+if [ "$SKIP_REBUILD" ]
+then
+  echo "Updates successful. --skip-rebuild requested. Exiting."
+  exit
+fi
+
 echo "Updates successful. Rebuilding in 5 seconds."
 sleep 5 # Just a chance to ^C in case they were too fast on the draw
+
 if [ "$data_name" == "$app_name" ]
 then
   echo Building $app_name
index 77a37a147014d8035b2f5a8569d84b01ef091afb..80adeafc38fe55142e31a6b23dc2e533419d1214 100644 (file)
@@ -67,6 +67,7 @@ env:
   DISCOURSE_SMTP_PASSWORD: pa$$word
   #DISCOURSE_SMTP_ENABLE_START_TLS: true           # (optional, default true)
   #DISCOURSE_SMTP_DOMAIN: discourse.example.com    # (required by some providers)
+  #DISCOURSE_NOTIFICATION_EMAIL: noreply@discourse.example.com    # (address to send notifications from)
 
   ## If you added the Lets Encrypt template, uncomment below to get a free SSL certificate
   #LETSENCRYPT_ACCOUNT_EMAIL: me@example.com
index c2b21dfd236c1cc353a5fc882c5f8110e932b1b3..08e41712fc2f8b0884ec3de98a529c3027f2a34f 100644 (file)
@@ -57,6 +57,8 @@ env:
   DISCOURSE_SMTP_USER_NAME: user@example.com
   DISCOURSE_SMTP_PASSWORD: pa$$word
   #DISCOURSE_SMTP_ENABLE_START_TLS: true           # (optional, default true)
+  #DISCOURSE_SMTP_DOMAIN: discourse.example.com    # (required by some providers)
+  #DISCOURSE_NOTIFICATION_EMAIL: noreply@discourse.example.com    # (address to send notifications from)
 
   ## If you added the Lets Encrypt template, uncomment below to get a free SSL certificate
   #LETSENCRYPT_ACCOUNT_EMAIL: me@example.com
diff --git a/tests/README.md b/tests/README.md
new file mode 100644 (file)
index 0000000..6791475
--- /dev/null
@@ -0,0 +1,28 @@
+## Smoke tests for `discourse-setup`
+
+These are not **real** tests, but do test that `discourse-setup` can produce or modify
+the YML file as expected. 
+
+Tests will not run if yml files exist already. If the tests succeed, the container files are deleted.
+
+### `standalone` tests
+
+- run the first time to do an initial creation of `app.yml` and that the values get set as expected.
+- run again to change the values
+
+### `two-container` tests
+
+- run with `--two-container` switch to create separate data and web containers
+- run again (not requiring the `--two-container` switch) and update values as expected
+
+### `update-old-templates` tests
+
+- updates a very old (Sep 6, 2016) standalone.yml 
+- updates a pretty old (Apr 13, 2018) web_only.yml 
+
+The tests won't run if `app.yml` or `web_only.yml` exist.
+
+### `run-all-tests`
+
+Runs all three of the above tests and prints an error if `app.yml` or `web_only.yml` exist.
+
diff --git a/tests/run-all-tests b/tests/run-all-tests
new file mode 100755 (executable)
index 0000000..cdd3b0e
--- /dev/null
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+$DIR/standard
+$DIR/two-container
+$DIR/update-old-templates
+
+if [ -f $DIR/../containers/app.yml ] || [ -f $DIR/../containers/web_only.yml ]
+then
+  echo Some test failed. Sad.
+fi
\ No newline at end of file
diff --git a/tests/standalone b/tests/standalone
new file mode 100755 (executable)
index 0000000..df28a96
--- /dev/null
@@ -0,0 +1,88 @@
+#!/usr/bin/env bash
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+YML=$DIR/../containers/app.yml
+if [ -f $YML ]
+then
+  echo "cannot run test if $YML exists."
+  exit
+fi
+
+check_value () {
+  VAR=$1
+  VAL=$2
+  YML=$3
+  if ! [[ $(grep $VAR $YML |sed -e "s/  $VAR: //") == "$VAL" ]]
+  then
+    echo $VAR is NOT $VAL
+    echo TEST FAILED. Aborting. 
+    exit 1
+  fi
+}
+
+hostname='test.myhost.com'
+developer='admin@mail.myhost.com'
+smtp_address='smtp.myhostn.com'
+smtp_port=''
+smtp_user='smtpuser'
+smtp_pass='smtp-pw'
+notification=''
+letsencrypt='le@myhost.com'
+maxmind=''
+$DIR/../discourse-setup --skip-connection-test --skip-rebuild <<EOF 
+$hostname
+$developer
+$smtp_address
+$smtp_port
+$smtp_user
+$smtp_pass
+$notification
+$letsencrypt
+$maxmind
+
+
+EOF
+check_value DISCOURSE_HOSTNAME $hostname $YML
+check_value DISCOURSE_SMTP_ADDRESS $smtp_address $YML
+check_value DISCOURSE_SMTP_PORT 587 $YML
+check_value DISCOURSE_SMTP_USER_NAME $smtp_user $YML
+check_value DISCOURSE_SMTP_PASSWORD \"$smtp_pass\" $YML
+check_value DISCOURSE_SMTP_DOMAIN $hostname $YML
+check_value DISCOURSE_NOTIFICATION_EMAIL noreply@$hostname $YML
+echo "################################ Initial install succeeded. ###################################"
+echo "Now running edit test."
+hostname='new.myhost.com'
+developer='new@mail.myhost.com'
+smtp_address='new.myhostn.com'
+smtp_port='2525'
+smtp_user='newuser'
+smtp_pass='new-smtp-pw'
+notification='somuser@otherhost.com'
+smtp_domain=otherhost.com # NOTE: script uses notification hostnme
+letsencrypt='le-new@myhost.com'
+maxmind='maxthisone'
+$DIR/../discourse-setup --skip-connection-test --skip-rebuild <<EOF 
+$hostname
+$developer
+$smtp_address
+$smtp_port
+$smtp_user
+$smtp_pass
+$notification
+$letsencrypt
+$maxmind
+
+
+EOF
+check_value DISCOURSE_HOSTNAME $hostname $YML
+check_value DISCOURSE_SMTP_ADDRESS $smtp_address $YML
+check_value DISCOURSE_SMTP_PORT $smtp_port $YML
+check_value DISCOURSE_SMTP_USER_NAME $smtp_user $YML
+check_value DISCOURSE_SMTP_PASSWORD \"$smtp_pass\" $YML
+check_value DISCOURSE_SMTP_DOMAIN $smtp_domain $YML
+check_value DISCOURSE_NOTIFICATION_EMAIL $notification $YML
+echo "################################ Update of values succeeded. ###################################"
+echo "Removing $YML*"
+rm $YML*
+
+echo "Test succeeded. Removing $YML"
+rm $YML
diff --git a/tests/two-container b/tests/two-container
new file mode 100755 (executable)
index 0000000..dbac725
--- /dev/null
@@ -0,0 +1,87 @@
+#!/usr/bin/env bash
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+YML=$DIR/../containers/web_only.yml
+DATA_YML=$DIR/../containers/data.yml
+if [ -f $YML ]
+then
+  echo "cannot run test if $YML exists."
+  exit
+fi
+
+check_value () {
+  VAR=$1
+  VAL=$2
+  YML=$3
+  if ! [[ $(grep $VAR $YML |sed -e "s/  $VAR: //") == "$VAL" ]]
+  then
+    echo $VAR is NOT $VAL
+    echo TEST FAILED. Aborting. 
+    exit 1
+  fi
+}
+
+hostname='test.myhost.com'
+developer='admin@mail.myhost.com'
+smtp_address='smtp.myhostn.com'
+smtp_port=''
+smtp_user='smtpuser'
+smtp_pass='smtp-pw'
+notification=''
+letsencrypt='le@myhost.com'
+maxmind=''
+$DIR/../discourse-setup --two-container --skip-connection-test --skip-rebuild <<EOF 
+$hostname
+$developer
+$smtp_address
+$smtp_port
+$smtp_user
+$smtp_pass
+$notification
+$letsencrypt
+$maxmind
+
+
+EOF
+check_value DISCOURSE_HOSTNAME $hostname $YML
+check_value DISCOURSE_SMTP_ADDRESS $smtp_address $YML
+check_value DISCOURSE_SMTP_PORT 587 $YML
+check_value DISCOURSE_SMTP_USER_NAME $smtp_user $YML
+check_value DISCOURSE_SMTP_PASSWORD \"$smtp_pass\" $YML
+check_value DISCOURSE_SMTP_DOMAIN $hostname $YML
+check_value DISCOURSE_NOTIFICATION_EMAIL noreply@$hostname $YML
+echo "################################ Initial install succeeded. ###################################"
+echo "Now running edit test."
+hostname='new.myhost.com'
+developer='new@mail.myhost.com'
+smtp_address='new.myhostn.com'
+smtp_port='2525'
+smtp_user='newuser'
+smtp_pass='new-smtp-pw'
+notification='somuser@otherhost.com'
+smtp_domain=otherhost.com # NOTE: script uses notification hostnme
+letsencrypt='le-new@myhost.com'
+maxmind='maxthisone'
+$DIR/../discourse-setup --skip-connection-test --skip-rebuild <<EOF 
+$hostname
+$developer
+$smtp_address
+$smtp_port
+$smtp_user
+$smtp_pass
+$notification
+$letsencrypt
+$maxmind
+
+
+EOF
+check_value DISCOURSE_HOSTNAME $hostname $YML
+check_value DISCOURSE_SMTP_ADDRESS $smtp_address $YML
+check_value DISCOURSE_SMTP_PORT $smtp_port $YML
+check_value DISCOURSE_SMTP_USER_NAME $smtp_user $YML
+check_value DISCOURSE_SMTP_PASSWORD \"$smtp_pass\" $YML
+check_value DISCOURSE_SMTP_DOMAIN $smtp_domain $YML
+check_value DISCOURSE_NOTIFICATION_EMAIL $notification $YML
+check_value DISCOURSE_MAXMIND_LICENSE_KEY $maxmind $YML
+echo "################################ Update of values succeeded. ###################################"
+echo "Update values Test succeeded. Removing $YML"
+rm $YML* $DATA_YML
diff --git a/tests/update-old-templates b/tests/update-old-templates
new file mode 100755 (executable)
index 0000000..3f0df98
--- /dev/null
@@ -0,0 +1,94 @@
+#!/usr/bin/env bash
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+YML=$DIR/../containers/app.yml
+if [ -f $YML ]
+then
+  echo "cannot run test if $YML exists."
+  exit
+fi
+
+check_value () {
+  VAR=$1
+  VAL=$2
+  YML=$3
+  if ! [[ $(grep $VAR $YML |sed -e "s/  $VAR: //") == "$VAL" ]]
+  then
+    echo $VAR is NOT $VAL
+    echo TEST FAILED. Aborting. 
+    exit 1
+  fi
+}
+
+# get old (Sep 6, 2016) standalone.yml that's missing MAXMIND and other values
+git show 7cf781fc0cf2542040f35e40cf79a1ab079c59f0:samples/standalone.yml>containers/app.yml > $YML
+
+hostname='new.myhost.com'
+developer='new@mail.myhost.com'
+smtp_address='new.myhostn.com'
+smtp_port='2525'
+smtp_user='newuser'
+smtp_pass='new-smtp-pw'
+notification='somuser@otherhost.com'
+smtp_domain=otherhost.com # NOTE: script uses notification hostnme
+letsencrypt='le-new@myhost.com'
+maxmind='maxthisone'
+$DIR/../discourse-setup --skip-connection-test --skip-rebuild <<EOF 
+$hostname
+$developer
+$smtp_address
+$smtp_port
+$smtp_user
+$smtp_pass
+$notification
+$letsencrypt
+$maxmind
+
+
+EOF
+check_value DISCOURSE_HOSTNAME $hostname $YML
+check_value DISCOURSE_SMTP_ADDRESS $smtp_address $YML
+check_value DISCOURSE_SMTP_PORT $smtp_port $YML
+check_value DISCOURSE_SMTP_USER_NAME $smtp_user $YML
+check_value DISCOURSE_SMTP_PASSWORD \"$smtp_pass\" $YML
+check_value DISCOURSE_SMTP_DOMAIN $smtp_domain $YML
+check_value DISCOURSE_NOTIFICATION_EMAIL $notification $YML
+check_value DISCOURSE_MAXMIND_LICENSE_KEY $maxmind $YML
+echo "Update values Test succeeded. Removing $YML"
+rm $YML*
+
+# get old (Apr 13, 2018) web_only.yml that's missing MAXMIND and other values
+YML=$DIR/../containers/web_only.yml
+git show 04a06dd05ee5aaec8082c503c8b8429e51f239e0:samples/web_only.yml> $YML
+hostname='new.myhost.com'
+developer='new-admin@mail.myhost.com'
+smtp_address='new.myhostn.com'
+smtp_port='2525'
+smtp_user='newuser'
+smtp_pass='new-smtp-pw'
+notification='somuser@otherhost.com'
+smtp_domain=otherhost.com # NOTE: script uses notification hostnme
+letsencrypt='le-new@myhost.com'
+maxmind='maxthisone'
+$DIR/../discourse-setup --skip-connection-test --skip-rebuild <<EOF 
+$hostname
+$developer
+$smtp_address
+$smtp_port
+$smtp_user
+$smtp_pass
+$notification
+$letsencrypt
+$maxmind
+
+
+EOF
+check_value DISCOURSE_HOSTNAME $hostname $YML
+check_value DISCOURSE_SMTP_ADDRESS $smtp_address $YML
+check_value DISCOURSE_SMTP_PORT $smtp_port $YML
+check_value DISCOURSE_SMTP_USER_NAME $smtp_user $YML
+check_value DISCOURSE_SMTP_PASSWORD \"$smtp_pass\" $YML
+check_value DISCOURSE_SMTP_DOMAIN $smtp_domain $YML
+check_value DISCOURSE_NOTIFICATION_EMAIL $notification $YML
+check_value DISCOURSE_MAXMIND_LICENSE_KEY $maxmind $YML
+echo "Update values Test succeeded. Removing $YML"
+rm $YML*