diff --git a/scripts/init-ubuntu.sh b/scripts/init-ubuntu.sh index 0e88a3c2c..bbe25589b 100755 --- a/scripts/init-ubuntu.sh +++ b/scripts/init-ubuntu.sh @@ -1,6 +1,7 @@ #!/bin/bash # This script is run on the base ubuntu. Put things here which are managed by ubuntu +# This script is also run after ubuntu upgrade set -euv -o pipefail diff --git a/scripts/recreate-containers b/scripts/recreate-containers new file mode 100755 index 000000000..ab159c2d9 --- /dev/null +++ b/scripts/recreate-containers @@ -0,0 +1,32 @@ +#!/bin/bash + +set -eu -o pipefail + +readonly logfile="/home/yellowtent/platformdata/logs/box.log" + +if [[ ${EUID} -ne 0 ]]; then + echo "This script should be run as root." > /dev/stderr + exit 1 +fi + +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 -n "Re-creating addon containers (this takes a while) ." +line_count=$(cat /home/yellowtent/platformdata/logs/box.log | 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 -e "\nDone.\nThe Cloudron dashboard will say 'Configuring (Queued)' for each app. The apps will come up in a short while." +