Try to force certificate issuance on second try
[discourse_docker.git] / discourse-doctor
index eebaf8b8ba49c784c3a408518b62a23d516f5266..92796e50611130b2df455b2f11eea3d0f835ef7f 100755 (executable)
@@ -250,7 +250,7 @@ get_yml_file() {
     web_file=containers/$app_name.yml
     log "Found $web_file"
   else
-    log "Can't find app.yml or web_ony.yml."
+    log "Can't find app.yml or web_only.yml."
     log "Giving up."
     exit
   fi
@@ -270,19 +270,29 @@ check_docker() {
     # too hard to pass STDERR of ./launcher to log()
     ./launcher rebuild $app_name 2>&1 | tee -a $LOG_FILE
     log "==================== END REBUILD LOG ===================="
-    docker ps| tail -n +2 > /tmp/$UUID-docker.txt
+    docker ps | tail -n +2 > /tmp/$UUID-docker.txt
     if grep $app_name /tmp/$UUID-docker.txt
     then
       log -e "\nDiscourse container $app_name is now running."
       log ". . . waiting 30 seconds for container to crank up. . . "
       sleep 30
     else
-      log "$app_name still not running!"
+      log "Failed to rebuild $app_name."
       # check_ip_match checks if curl to $DISCOURSE_HOSTNAME gets to this server
       # It works only if ports 80 and 443 are free
       check_ip_match $DISCOURSE_HOSTNAME
       log "You should probably remove any non-standard plugins and rebuild."
       NO_CONTAINER='y'
+      log "Attempting to restart existing container. . . "
+      ./launcher start $app_name 2>&1 | tee -a $LOG_FILE
+      docker ps | tail -n +2 > /tmp/$UUID-docker.txt
+      if grep $app_name /tmp/$UUID-docker.txt
+      then
+        log "Restarted the container."
+        NO_CONTAINER='n'
+      else
+        log "Failed to restart the container."
+      fi
     fi
   fi
 }