diff --git a/scripts/cloudron-support b/scripts/cloudron-support index 9c9e1e12c..07b725a8e 100755 --- a/scripts/cloudron-support +++ b/scripts/cloudron-support @@ -17,10 +17,12 @@ readonly PASTEBIN="https://paste.cloudron.io" readonly LINE="\n========================================================\n" readonly HELP_MESSAGE=" Cloudron Support and Diagnostics Tool - + Options: --disable-dnssec Disable DNSSEC --enable-remote-access Enable SSH Remote Access for the Cloudron support team + --recreate-containers Deletes all existing containers and recreates them without loss of data + --recreate-docker Deletes docker storage (containers and images) and recreates it without loss of data --send-diagnostics Collects server diagnostics and uploads it to ${PASTEBIN} --troubleshoot Dashboard down? Run tests to identify the potential problem --owner-login Login as owner @@ -465,9 +467,43 @@ function check_disk_space() { fi } +function recreate_containers() { + readonly logfile="/home/yellowtent/platformdata/logs/box.log" + + echo "This will re-create all the containers. Services will go down for a bit." + read -p "Do you want to proceed? (y/N) " -n 1 -r choice + echo + + if [[ ! $choice =~ ^[Yy]$ ]]; then + exit 1 + fi + + echo "" + info " Follow re-create logs in a second terminal with:" + info " $ tail -f ${logfile}" + echo "" + + echo -n "Re-creating addon containers (this takes a while) ." + line_count=$(cat "${logfile}" | wc -l) + sed -e 's/"version": ".*",/"version":"48.0.0",/' -i /home/yellowtent/platformdata/INFRA_VERSION + systemctl restart box + + while ! tail -n "+${line_count}" "${logfile}" | grep -q "platform is ready"; do + echo -n "." + sleep 2 + done + + echo "" + echo "Addon containers successfully re-created. The apps in the dashboard will say 'Configuring (Queued)'. They will come up in a short while." +} + +function recreate_docker() { + echo "ok" +} + check_disk_space -args=$(getopt -o "" -l "admin-login,disable-dnssec,enable-ssh,enable-remote-access,help,owner-login,send-diagnostics,use-external-dns,troubleshoot" -n "$0" -- "$@") +args=$(getopt -o "" -l "admin-login,disable-dnssec,enable-ssh,enable-remote-access,help,owner-login,recreate-containers,recreate-docker,send-diagnostics,use-external-dns,troubleshoot" -n "$0" -- "$@") eval set -- "${args}" while true; do @@ -484,6 +520,8 @@ while true; do --troubleshoot) troubleshoot; exit 0;; --disable-dnssec) disable_dnssec; exit 0;; --use-external-dns) use_external_dns; exit 0;; + --recreate-containers) recreate_containers; exit 0;; + --recreate-docker) recreate_docker; exit 0;; --help) break;; --) break;; *) echo "Unknown option $1"; exit 1;;