rework server-side daemon to be reloadable via ssh
This commit is contained in:
parent
5f86f4cee7
commit
0191ce9f70
|
@ -1,9 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
cd "$TREEHOUSE_PATH"
|
||||
|
||||
echo
|
||||
echo "* Running editor"
|
||||
"$EDITOR" content/index.tree
|
||||
|
||||
bash admin/client_push.bash
|
|
@ -1,19 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
cd "$TREEHOUSE_PATH"
|
||||
|
||||
echo
|
||||
echo "* Fixing the tree"
|
||||
cargo run -p treehouse fix-all --apply
|
||||
|
||||
echo
|
||||
echo "* Committing changes"
|
||||
git add \
|
||||
content static template \
|
||||
treehouse.toml
|
||||
git commit
|
||||
git push
|
||||
|
||||
echo
|
||||
echo "* Uploading to server"
|
||||
bash admin/client_sync.bash
|
|
@ -1,3 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
ssh "$TREEHOUSE_SERVER" -p "$TREEHOUSE_SERVER_PORT" 'fish' '$TREEHOUSE_PATH/admin/server_sync.fish'
|
27
admin/daemon.bash
Normal file
27
admin/daemon.bash
Normal file
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source "${BASH_SOURCE%/*}/daemon/common.bash"
|
||||
build_log="/tmp/treehouse_build.log"
|
||||
|
||||
trap 'kill 0' EXIT
|
||||
|
||||
rm -f $reload_fifo
|
||||
mkfifo $reload_fifo
|
||||
|
||||
reload() {
|
||||
# This just kind of assumes regeneration doesn't take too long.
|
||||
kill "$treehouse_pid"
|
||||
cargo run --release -- serve --port 8082 > "$build_log" &
|
||||
treehouse_pid="$!"
|
||||
}
|
||||
|
||||
reload
|
||||
|
||||
while true; do
|
||||
read command < "$reload_fifo"
|
||||
case "$command" in
|
||||
reload)
|
||||
echo "Reloading"
|
||||
reload;;
|
||||
esac
|
||||
done
|
3
admin/daemon/common.bash
Normal file
3
admin/daemon/common.bash
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
reload_fifo="/tmp/treehouse_reload.fifo"
|
5
admin/daemon/reload.bash
Normal file
5
admin/daemon/reload.bash
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source "${BASH_SOURCE%/*}/common.bash"
|
||||
|
||||
echo "reload" > "$reload_fifo"
|
3
admin/deploy.bash
Normal file
3
admin/deploy.bash
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
ssh "$TREEHOUSE_SERVER" -p "$TREEHOUSE_SERVER_PORT" "bash" "~/repo/admin/daemon/reload.bash"
|
|
@ -1,8 +0,0 @@
|
|||
#!/usr/bin/env fish
|
||||
|
||||
# This script runs on the server.
|
||||
|
||||
cd $TREEHOUSE_PATH
|
||||
|
||||
git pull
|
||||
cargo run --release -p treehouse generate
|
Loading…
Reference in a new issue