Skip to content

Commit

Permalink
Add replicate and swap recipes (ordinals#4083)
Browse files Browse the repository at this point in the history
  • Loading branch information
casey authored Nov 21, 2024
1 parent 8f9c2ee commit 40ffa5a
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
15 changes: 15 additions & 0 deletions bin/replicate
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

set -euxo pipefail

systemctl stop ord

for host in alpha bravo; do
rsync \
--archive \
--progress \
/var/lib/ord/index.redb \
root@$host.ordinals.net:/var/lib/ord/index.redb.new
done

systemctl restart ord
25 changes: 25 additions & 0 deletions bin/swap
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

set -euxo pipefail

die() {
echo "$1"
exit 1
}

new=/var/lib/ord/index.redb.new
current=/var/lib/ord/index.redb
old=/var/lib/ord/index.redb.old

[[ -f $new ]] || die "new index missing: $new"
[[ -f $current ]] || die "old index missing: $current"
[[ ! -f $old ]] || die "backup index already exists: $old"

systemctl stop ord

chown ord:ord $new

mv $current $old
mv $new $current

systemctl restart ord
8 changes: 8 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,11 @@ benchmark-server:

update-contributors:
cargo run --release --package update-contributors

replicate:
rsync --archive bin/replicate [email protected]:replicate
ssh [email protected] ./replicate

swap host:
rsync --archive bin/swap root@{{ host }}.ordinals.net:swap
ssh root@{{ host }}.ordinals.net ./swap

0 comments on commit 40ffa5a

Please sign in to comment.