deploy to any host
This commit is contained in:
parent
3cbb25a82a
commit
8fc54bd349
|
|
@ -2,8 +2,10 @@
|
||||||
|
|
||||||
# It isn't enough to modify this yet.
|
# It isn't enough to modify this yet.
|
||||||
# You also need to manually update the toes.service file.
|
# You also need to manually update the toes.service file.
|
||||||
HOST="${HOST:-toes@toes.local}"
|
TOES_USER="${TOES_USER:-toes}"
|
||||||
URL="${URL:-http://toes.local}"
|
HOST="${HOST:-toes.local}"
|
||||||
|
SSH_HOST="$TOES_USER@$HOST"
|
||||||
|
URL="${URL:-http://$HOST}"
|
||||||
DEST="${DEST:-~/toes}"
|
DEST="${DEST:-~/toes}"
|
||||||
DATA_DIR="${DATA_DIR:-~/data}"
|
DATA_DIR="${DATA_DIR:-~/data}"
|
||||||
APPS_DIR="${APPS_DIR:-~/apps}"
|
APPS_DIR="${APPS_DIR:-~/apps}"
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ source "$ROOT_DIR/scripts/config.sh"
|
||||||
git push origin main
|
git push origin main
|
||||||
|
|
||||||
# SSH to target: pull, build, sync apps, restart
|
# SSH to target: pull, build, sync apps, restart
|
||||||
ssh "$HOST" DEST="$DEST" APPS_DIR="$APPS_DIR" bash <<'SCRIPT'
|
ssh "$SSH_HOST" DEST="$DEST" APPS_DIR="$APPS_DIR" bash <<'SCRIPT'
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
cd "$DEST" && git checkout -- bun.lock && git pull origin main && bun install && rm -rf dist && bun run build
|
cd "$DEST" && git checkout -- bun.lock && git pull origin main && bun install && rm -rf dist && bun run build
|
||||||
|
|
@ -35,5 +35,5 @@ done
|
||||||
sudo systemctl restart toes.service
|
sudo systemctl restart toes.service
|
||||||
SCRIPT
|
SCRIPT
|
||||||
|
|
||||||
echo "=> Deployed to $HOST"
|
echo "=> Deployed to $SSH_HOST"
|
||||||
echo "=> Visit $URL"
|
echo "=> Visit $URL"
|
||||||
|
|
|
||||||
|
|
@ -9,4 +9,4 @@ ROOT_DIR="$SCRIPT_DIR/.."
|
||||||
source "$ROOT_DIR/scripts/config.sh"
|
source "$ROOT_DIR/scripts/config.sh"
|
||||||
|
|
||||||
# Run remote install on the target
|
# Run remote install on the target
|
||||||
ssh "$HOST" "git clone https://git.nose.space/defunkt/toes $DEST && cd $DEST && ./scripts/install.sh"
|
ssh "$SSH_HOST" "git clone https://git.nose.space/defunkt/toes $DEST && cd $DEST && ./scripts/install.sh"
|
||||||
|
|
|
||||||
|
|
@ -6,4 +6,4 @@ ROOT_DIR="$SCRIPT_DIR/.."
|
||||||
|
|
||||||
source "$ROOT_DIR/scripts/config.sh"
|
source "$ROOT_DIR/scripts/config.sh"
|
||||||
|
|
||||||
ssh "$HOST" "journalctl -u toes -n 100"
|
ssh "$SSH_HOST" "journalctl -u toes -n 100"
|
||||||
|
|
|
||||||
|
|
@ -6,4 +6,4 @@ ROOT_DIR="$SCRIPT_DIR/.."
|
||||||
|
|
||||||
source "$ROOT_DIR/scripts/config.sh"
|
source "$ROOT_DIR/scripts/config.sh"
|
||||||
|
|
||||||
ssh "$HOST" "sudo systemctl restart toes.service"
|
ssh "$SSH_HOST" "sudo systemctl restart toes.service"
|
||||||
|
|
|
||||||
|
|
@ -6,4 +6,4 @@ ROOT_DIR="$SCRIPT_DIR/.."
|
||||||
|
|
||||||
source "$ROOT_DIR/scripts/config.sh"
|
source "$ROOT_DIR/scripts/config.sh"
|
||||||
|
|
||||||
ssh "$HOST" "sudo systemctl start toes.service"
|
ssh "$SSH_HOST" "sudo systemctl start toes.service"
|
||||||
|
|
|
||||||
|
|
@ -6,4 +6,4 @@ ROOT_DIR="$SCRIPT_DIR/.."
|
||||||
|
|
||||||
source "$ROOT_DIR/scripts/config.sh"
|
source "$ROOT_DIR/scripts/config.sh"
|
||||||
|
|
||||||
ssh "$HOST" "sudo systemctl stop toes.service"
|
ssh "$SSH_HOST" "sudo systemctl stop toes.service"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user