diff --git a/README.md b/README.md index cb5bc63..36378e0 100644 --- a/README.md +++ b/README.md @@ -98,12 +98,10 @@ TESTNET=1 ./configure-box.sh REGTEST=1 ./configure-box.sh ``` -### Step 3. Run the services +### Step 3. Run Umbrel ```bash -docker-compose up -d -# Verify the services -docker ps -a +sudo ./scripts/start ``` --- diff --git a/bin/update/01-run.sh b/bin/update/01-run.sh index 45d61f8..a088a37 100755 --- a/bin/update/01-run.sh +++ b/bin/update/01-run.sh @@ -63,7 +63,7 @@ cat < "$UMBREL_ROOT"/statuses/update-status.json {"state": "installing", "progress": 70, "description": "Removing old containers", "updateTo": "$RELEASE"} EOF cd "$UMBREL_ROOT" -docker-compose down +./scripts/stop # Overlay home dir structure with new dir tree echo "Overlaying $UMBREL_ROOT/ with new directory tree" @@ -82,4 +82,4 @@ cat < "$UMBREL_ROOT"/statuses/update-status.json {"state": "installing", "progress": 80, "description": "Starting new containers", "updateTo": "$RELEASE"} EOF cd "$UMBREL_ROOT" -docker-compose up --detach --remove-orphans +./scripts/start diff --git a/events/triggers/reboot b/events/triggers/reboot index 36eec5d..f02ce94 100755 --- a/events/triggers/reboot +++ b/events/triggers/reboot @@ -1,5 +1,5 @@ #!/usr/bin/env bash set -euo pipefail -docker-compose stop +./scripts/stop shutdown -r now diff --git a/events/triggers/shutdown b/events/triggers/shutdown index 9662331..acfd6f5 100755 --- a/events/triggers/shutdown +++ b/events/triggers/shutdown @@ -1,5 +1,5 @@ #!/usr/bin/env bash set -euo pipefail -docker-compose stop +./scripts/stop shutdown -h now diff --git a/scripts/start b/scripts/start new file mode 100755 index 0000000..e831120 --- /dev/null +++ b/scripts/start @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Start Umbrel + +if [[ $UID != 0 ]]; then + echo "Umbrel must be started as root" + echo "Please re-run this script as" + echo " sudo ./scripts/start" + exit 1 +fi + +check_dependencies () { + for cmd in "$@"; do + if ! command -v $cmd >/dev/null 2>&1; then + echo "This script requires \"${cmd}\" to be installed" + exit 1 + fi + done +} + +# Check system's dependencies +check_dependencies readlink dirname docker docker-compose git + +# Check karen's dependencies +check_dependencies fswatch + +# Check OTA update scripts' dependencies +check_dependencies rsync jq wget + +echo "Starting Umbrel..." +echo + +UMBREL_ROOT="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))/.." + +if [[ ! -d "$UMBREL_ROOT" ]]; then + echo "Root dir does not exist '$UMBREL_ROOT'" + exit 1 +fi + +cd "$UMBREL_ROOT" + +echo "Starting karen..." +echo +./karen & + +echo +echo "Starting Docker services..." +echo +docker-compose up --detach --build --remove-orphans diff --git a/scripts/status b/scripts/status new file mode 100755 index 0000000..6423615 --- /dev/null +++ b/scripts/status @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Get Umbrel Status + +docker ps -a diff --git a/scripts/stop b/scripts/stop new file mode 100755 index 0000000..375a7f2 --- /dev/null +++ b/scripts/stop @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Stop Umbrel + +if [[ $UID != 0 ]]; then + echo "Umbrel must be stopped as root" + echo "Please re-run this script as" + echo " sudo ./scripts/stop" + exit 1 +fi + +UMBREL_ROOT="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))/.." + +if [[ ! -d "$UMBREL_ROOT" ]]; then + echo "Root dir does not exist '$UMBREL_ROOT'" + exit 1 +fi + +cd "$UMBREL_ROOT" + +echo "Stopping Docker services..." +echo +docker-compose down