Remove additional exit command (#485)
[discourse_docker.git] / discourse-setup
index c4daa6b9f62dcf48ff37211b6f277954d3e51fa4..ec1adaffbd3d4334ca972fb7b4b6d26c3767423a 100755 (executable)
@@ -52,27 +52,32 @@ check_IP_match() {
       echo "Connection to $HOST succeeded."
       ;;
     1)
-      echo "WARNING:: This server does not appear to be accessible at $HOST:443."
-      echo
+      echo "WARNING: Port 443 of computer does not appear to be accessible using hostname:  $HOST."
       if connect_to_port $HOST 80; then
-        echo A connection to port 80 succeeds, however.
+        echo
+        echo SUCCESS: A connection to port 80 succeeds!
         echo This suggests that your DNS settings are correct,
         echo but something is keeping traffic to port 443 from getting to your server.
         echo Check your networking configuration to see that connections to port 443 are allowed.
       else
-        echo "A connection to http://$HOST (port 80) also fails."
+        echo "WARNING: Connection to http://$HOST (port 80) also fails."
         echo
-        echo "This suggests that $HOST resolves to the wrong IP address"
-        echo or that traffic is not being routed to your server.
+        echo "This suggests that $HOST resolves to some IP address that does not reach this "
+        echo machine where you are installing discourse.
       fi
       echo
-      echo Google: \"open ports YOUR CLOUD SERVICE\" for information for resolving this problem.
+      echo "The first thing to do is confirm that $HOST resolves to the IP address of this server."
+      echo You usually do this at the same place you purchased the domain.
+      echo
+      echo If you are sure that the IP address resolves correctly, it could be a firewall issue.
+      echo A web search for  \"open ports YOUR CLOUD SERVICE\" might help.
       echo
-      echo You should probably answer \"n\" at the next prompt and disable Let\'s Encrypt.
+      echo This tool is designed only for the most standard installations. If you cannot resolve
+      echo the issue above, you will need to edit containers/app.yml yourself and then type
       echo
-      echo This test might not work for all situations,
-      echo "so if you can access Discourse at http://$HOST, you might try anyway."
-      sleep 3
+      echo                   ./launcher rebuild app
+      echo
+      exit 1
       ;;
     2)
       echo "Continuing without port check."
@@ -374,6 +379,8 @@ ask_user_for_config() {
       fi
     fi
 
+    check_IP_match $hostname
+
     if [ ! -z "$developer_emails" ]
     then
       read -p "Email address for admin account(s)? [$developer_emails]: " new_value
@@ -437,7 +444,7 @@ ask_user_for_config() {
 
     if [ ! -z $letsencrypt_account_email ]
     then
-      read -p "Optional email address for setting up Let's Encrypt? ($letsencrypt_status) [$letsencrypt_account_email]: " new_value
+      read -p "Optional email address for Let's Encrypt warnings? ($letsencrypt_status) [$letsencrypt_account_email]: " new_value
       if [ ! -z "$new_value" ]
       then
           letsencrypt_account_email="$new_value"
@@ -450,11 +457,6 @@ ask_user_for_config() {
       fi
     fi
 
-    if [ "$letsencrypt_status" == "Enter 'OFF' to disable." ]
-    then
-       check_IP_match $hostname
-    fi
-
     echo -e "\nDoes this look right?\n"
     echo "Hostname      : $hostname"
     echo "Email         : $developer_emails"
@@ -559,57 +561,37 @@ ask_user_for_config() {
       update_ok="n"
     fi
   fi
-  if [ "$letsencrypt_status" = "ENTER to skip" ]
-  then
-      local src='^  #\?- "templates\/web.ssl.template.yml"'
-      local dst='  #\- "templates\/web.ssl.template.yml"'
-      sed -i -e "s/$src/$dst/w $changelog" $web_file
-      if [ ! -s $changelog ]
-      then
-        update_ok="n"
-        echo "web.ssl.template.yml NOT DISABLED--Are you using a non-standard template?"
-      fi
-      local src='^  #\?- "templates\/web.letsencrypt.ssl.template.yml"'
-      local dst='  #- "templates\/web.letsencrypt.ssl.template.yml"'
 
-      sed -i -e "s/$src/$dst/w $changelog" $web_file
-      if [ ! -s $changelog ]
-      then
-        update_ok="n"
-        echo "web.ssl.template.yml NOT DISABLED--Are you using a non-standard template?"
-      fi
-  else # enable let's encrypt
-    echo "Let's Encrypt will be enabled for $letsencrypt_account_email"
-      sed -i -e "s/^  #\?LETSENCRYPT_ACCOUNT_EMAIL:.*/  LETSENCRYPT_ACCOUNT_EMAIL: $letsencrypt_account_email/w $changelog" $web_file
-      if [ -s $changelog ]
-      then
-        rm $changelog
-      else
-        echo "LETSENCRYPT_ACCOUNT_EMAIL change failed."
-        update_ok="n"
-      fi
-      local src='^  #\?- "templates\/web.ssl.template.yml"'
-      local dst='  \- "templates\/web.ssl.template.yml"'
-      sed -i -e "s/$src/$dst/w $changelog" $web_file
-      if [ -s $changelog ]
-      then
-         echo "web.ssl.template.yml enabled"
-      else
-        update_ok="n"
-        echo "web.ssl.template.yml NOT ENABLED--was it on already?"
-      fi
-      local src='^  #\?- "templates\/web.letsencrypt.ssl.template.yml"'
-      local dst='  - "templates\/web.letsencrypt.ssl.template.yml"'
+  echo "Enabling Let's Encrypt"
+    sed -i -e "s/^  #\?LETSENCRYPT_ACCOUNT_EMAIL:.*/  LETSENCRYPT_ACCOUNT_EMAIL: $letsencrypt_account_email/w $changelog" $web_file
+    if [ -s $changelog ]
+    then
+      rm $changelog
+    else
+      echo "LETSENCRYPT_ACCOUNT_EMAIL change failed."
+      update_ok="n"
+    fi
+    local src='^  #\?- "templates\/web.ssl.template.yml"'
+    local dst='  \- "templates\/web.ssl.template.yml"'
+    sed -i -e "s/$src/$dst/w $changelog" $web_file
+    if [ -s $changelog ]
+    then
+  echo "web.ssl.template.yml enabled"
+    else
+      update_ok="n"
+      echo "web.ssl.template.yml NOT ENABLED--was it on already?"
+    fi
+    local src='^  #\?- "templates\/web.letsencrypt.ssl.template.yml"'
+    local dst='  - "templates\/web.letsencrypt.ssl.template.yml"'
 
-      sed -i -e "s/$src/$dst/w $changelog" $web_file
-      if [ -s $changelog ]
-      then
-             echo "letsencrypt.ssl.template.yml enabled"
-      else
-        update_ok="n"
-        echo "letsencrypt.ssl.template.yml NOT ENABLED -- was it on already?"
-      fi
-  fi
+    sed -i -e "s/$src/$dst/w $changelog" $web_file
+    if [ -s $changelog ]
+    then
+      echo "letsencrypt.ssl.template.yml enabled"
+    else
+      update_ok="n"
+      echo "letsencrypt.ssl.template.yml NOT ENABLED -- was it on already?"
+    fi
 
   if [ "$update_ok" == "y" ]
   then