Skip to content

Commit

Permalink
Add recipes to copy keys to servers (ordinals#2927)
Browse files Browse the repository at this point in the history
  • Loading branch information
casey authored Jan 1, 2024
1 parent eb7bc9d commit 8d2ffd6
Showing 1 changed file with 41 additions and 23 deletions.
64 changes: 41 additions & 23 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,53 @@ fmt:
cargo fmt --all

clippy:
cargo clippy --all --all-targets -- -D warnings
cargo clippy --all --all-targets -- --deny warnings

deploy branch remote chain domain:
ssh root@{{domain}} "mkdir -p deploy \
ssh root@{{domain}} 'mkdir -p deploy \
&& apt-get update --yes \
&& apt-get upgrade --yes \
&& apt-get install --yes git rsync"
&& apt-get install --yes git rsync'
rsync -avz deploy/checkout root@{{domain}}:deploy/checkout
ssh root@{{domain}} 'cd deploy && ./checkout {{branch}} {{remote}} {{chain}} {{domain}}'

deploy-mainnet-balance branch="master" remote="ordinals/ord": (deploy branch remote "main" "balance.ordinals.net")
deploy-mainnet-alpha branch='master' remote='ordinals/ord': (deploy branch remote 'main' 'alpha.ordinals.net')

deploy-mainnet-equilibrium branch="master" remote="ordinals/ord": (deploy branch remote "main" "equilibrium.ordinals.net")
deploy-mainnet-balance branch='master' remote='ordinals/ord': (deploy branch remote 'main' 'balance.ordinals.net')

deploy-mainnet-stability branch="master" remote="ordinals/ord": (deploy branch remote "main" "stability.ordinals.net")
deploy-mainnet-stability branch='master' remote='ordinals/ord': (deploy branch remote 'main' 'stability.ordinals.net')

deploy-signet branch="master" remote="ordinals/ord": (deploy branch remote "signet" "signet.ordinals.net")
deploy-signet branch='master' remote='ordinals/ord': (deploy branch remote 'signet' 'signet.ordinals.net')

deploy-testnet branch="master" remote="ordinals/ord": (deploy branch remote "test" "testnet.ordinals.net")
deploy-testnet branch='master' remote='ordinals/ord': (deploy branch remote 'test' 'testnet.ordinals.net')

deploy-regtest branch="master" remote="ordinals/ord": (deploy branch remote "regtest" "regtest.ordinals.net")
deploy-regtest branch='master' remote='ordinals/ord': (deploy branch remote 'regtest' 'regtest.ordinals.net')

save-ord-dev-state domain="ordinals-dev.com":
initialize-server-keys:
#!/usr/bin/env bash
set -euxo pipefail
rm -rf tmp/ssh
mkdir -p tmp/ssh
ssh-keygen -C ordinals -f tmp/ssh/id_ed25519 -t ed25519 -N ''
for server in alpha balance regtest signet stability testnet; do
ssh-copy-id -i tmp/ssh/id_ed25519.pub root@$SERVER.ordinals.net
scp tmp/ssh/* root@$server.ordinals.net:.ssh
done
rm -rf tmp/ssh
install-personal-key key='~/.ssh/id_ed25519.pub':
#!/usr/bin/env bash
set -euxo pipefail
for server in alpha balance regtest signet stability testnet; do
ssh-copy-id -i '{{ key }}' root@$server.ordinals.net
done
save-ord-dev-state domain='ordinals-dev.com':
$EDITOR ./deploy/save-ord-dev-state
scp ./deploy/save-ord-dev-state root@{{domain}}:~
ssh root@{{domain}} "./save-ord-dev-state"

log unit="ord" domain="ordinals.net":
log unit='ord' domain='ordinals.net':
ssh root@{{domain}} 'journalctl -fu {{unit}}'

test-deploy:
Expand Down Expand Up @@ -95,11 +114,11 @@ prepare-release revision='master':
git log --pretty='format:- %s' >> CHANGELOG.md
$EDITOR CHANGELOG.md
$EDITOR Cargo.toml
VERSION=`sed -En 's/version[[:space:]]*=[[:space:]]*"([^"]+)"/\1/p' Cargo.toml | head -1`
version=`sed -En 's/version[[:space:]]*=[[:space:]]*"([^"]+)"/\1/p' Cargo.toml | head -1`
cargo check
git checkout -b release-$VERSION
git checkout -b release-$version
git add -u
git commit -m "Release $VERSION"
git commit -m "Release $version"
gh pr create --web
publish-release revision='master':
Expand All @@ -120,9 +139,9 @@ publish-tag-and-crate revision='master':
git clone [email protected]:ordinals/ord.git tmp/release
cd tmp/release
git checkout {{revision}}
VERSION=`sed -En 's/version[[:space:]]*=[[:space:]]*"([^"]+)"/\1/p' Cargo.toml | head -1`
git tag -a $VERSION -m "Release $VERSION"
git push [email protected]:ordinals/ord.git $VERSION
version=`sed -En 's/version[[:space:]]*=[[:space:]]*"([^"]+)"/\1/p' Cargo.toml | head -1`
git tag -a $version -m "Release $version"
git push [email protected]:ordinals/ord.git $version
cargo publish
cd ../..
rm -rf tmp/release
Expand Down Expand Up @@ -153,10 +172,10 @@ benchmark index height-limit:
./bin/benchmark $1 $2

benchmark-revision rev:
ssh [email protected] "mkdir -p benchmark \
ssh [email protected] 'mkdir -p benchmark \
&& apt-get update --yes \
&& apt-get upgrade --yes \
&& apt-get install --yes git rsync"
&& apt-get install --yes git rsync'
rsync -avz benchmark/checkout [email protected]:benchmark/checkout
ssh [email protected] 'cd benchmark && ./checkout {{rev}}'

Expand Down Expand Up @@ -200,10 +219,9 @@ serve-docs: build-docs
build-docs:
#!/usr/bin/env bash
mdbook build docs -d build
for lang in "de" "fr" "es" "pt" "ru" "zh" "ja" "ko" "fil" "ar" "hi" "it"; do
MDBOOK_BOOK__LANGUAGE=$lang \
mdbook build docs -d build/$lang
mv docs/build/$lang/html docs/build/html/$lang
for language in ar de es fil fr hi it ja ko pt ru zh; do
MDBOOK_BOOK__LANGUAGE=$language mdbook build docs -d build/$language
mv docs/build/$language/html docs/build/html/$language
done
update-changelog:
Expand Down

0 comments on commit 8d2ffd6

Please sign in to comment.