forked from ordinals/ord
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add replicate and swap recipes (ordinals#4083)
- Loading branch information
Showing
3 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 |