Skip to content

Commit 5c5135f

Browse files
authored
server: improve do run, add do mosh, add do restart-queue (#130)
`do run` used to run the given command with mosh instead of ssh, but this is annoying for bulk maintenance tasks, because mosh takes over the whole screen, has no scrollback, and the output disappears when complete. this patch adds `do mosh` that runs mosh for one server, and makes `do run` just use ssh. for example, some typical commands: ``` $ cd server/nixos $ ./do run ci{0..4} -- rm -v /config/monitor/data/profiles/\*/snapshot $ ./do mosh ci0 tmux new journalctl -afu monitor ``` `do restart-monitor` restarts monitor.service, but when reconfiguring the queue or updating the GitHub API token, we also need to restart queue.service. this patch adds a `do restart-queue` command for use in those situations. for example, to update the GitHub API token, edit `server/nixos/*/.env` and then run the following: ``` $ cd server/nixos $ ./do restart-monitor ci{0..4} $ ./do restart-queue ci0 ```
1 parent ee6300a commit 5c5135f

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

  • server/nixos

server/nixos/do

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ case "$action" in
3030
printf '>>> %s\n' https://"$host".servo.org
3131
done
3232
;;
33+
(restart-queue)
34+
for host; do
35+
ssh root@"$host".servo.org systemctl restart queue
36+
done
37+
for host; do
38+
printf '>>> %s\n' https://"$host".servo.org/queue/
39+
done
40+
;;
3341
(run)
3442
hosts=
3543
for arg; do
@@ -45,17 +53,21 @@ case "$action" in
4553
esac
4654
done
4755
for host in $hosts; do
48-
mosh root@"$host".servo.org -- "$@"
56+
ssh root@"$host".servo.org -- "$@"
4957
done
5058
;;
59+
(mosh)
60+
host=$1; shift
61+
mosh root@"$host".servo.org -- "$@"
62+
;;
5163
(logs)
5264
mosh root@"$1".servo.org tmux new 'journalctl -af'
5365
;;
5466
(htop)
5567
mosh root@"$1".servo.org tmux new 'htop'
5668
;;
5769
(*)
58-
>&2 echo 'usage: ./do <deploy|read|write|restart-monitor|run|logs|htop> [args ...]'
70+
>&2 echo 'usage: ./do <deploy|read|write|restart-monitor|restart-queue|run|mosh|logs|htop> [args ...]'
5971
exit 1
6072
;;
6173
esac

0 commit comments

Comments
 (0)