Browse Source

Start and stop Umbrel with native scripts (#52)

partition-refactor
Mayank Chhabra 4 years ago
committed by GitHub
parent
commit
3fc9bb7aef
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      README.md
  2. 4
      bin/update/01-run.sh
  3. 2
      events/triggers/reboot
  4. 2
      events/triggers/shutdown
  5. 50
      scripts/start
  6. 6
      scripts/status
  7. 24
      scripts/stop

6
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
```
---

4
bin/update/01-run.sh

@ -63,7 +63,7 @@ cat <<EOF > "$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 <<EOF > "$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

2
events/triggers/reboot

@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -euo pipefail
docker-compose stop
./scripts/stop
shutdown -r now

2
events/triggers/shutdown

@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -euo pipefail
docker-compose stop
./scripts/stop
shutdown -h now

50
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

6
scripts/status

@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -euo pipefail
# Get Umbrel Status
docker ps -a

24
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
Loading…
Cancel
Save