Skip to content

Commit

Permalink
Improve deploy scripts (ordinals#342)
Browse files Browse the repository at this point in the history
  • Loading branch information
casey committed Aug 22, 2022
1 parent e8e8529 commit 2a51d95
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/hirsute64"
config.vm.box = "debian/bullseye64"

config.vm.provider "virtualbox" do |v|
v.memory = 1024 * 4
Expand Down
4 changes: 2 additions & 2 deletions deploy/bitcoind.service
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ Wants=network-online.target

[Service]
ExecStart=/usr/local/bin/bitcoind \
-txindex \
-datadir=/var/lib/bitcoind \
-signet \
-datadir=/var/lib/bitcoind
-txindex

# Make sure the config directory is readable by the service user
PermissionsStartOnly=true
Expand Down
4 changes: 2 additions & 2 deletions deploy/ord.service
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ Environment=RUST_BACKTRACE=1
Environment=RUST_LOG=info
ExecStart=/usr/local/bin/ord \
--cookie-file /var/lib/bitcoind/signet/.cookie \
--max-index-size 1TiB \
--rpc-url 127.0.0.1:38332 \
--data-dir /var/lib/ord \
--max-index-size 1TiB \
--network signet \
server \
--acme-cache /var/lib/ord/acme-cache \
--acme-contact mailto:[email protected] \
Expand Down
11 changes: 6 additions & 5 deletions deploy/setup
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

set -euxo pipefail

apt-get update --yes
apt-get upgrade --yes
apt-get install --yes \
acl \
clang \
Expand All @@ -27,7 +25,9 @@ source ~/.cargo/env
rustup update stable

cargo build --release
mv /usr/local/bin/ord ord.old
if [[ -f /usr/local/bin/ord ]]; then
mv /usr/local/bin/ord /usr/local/bin/ord.bak
fi
cp target/release/ord /usr/local/bin/ord

id --user bitcoin || useradd --system bitcoin
Expand All @@ -50,10 +50,11 @@ setfacl -m ord:r /var/lib/bitcoind/signet/.cookie
cp deploy/ord.service /etc/systemd/system/
systemctl daemon-reload
systemctl stop ord
cp target/release/ord /usr/local/bin/ord
if [[ -f /var/lib/ord/signet/index.redb ]]; then
mv /var/lib/ord/signet/index.redb /var/lib/ord/signet/index.redb.bak
fi
systemctl enable ord
systemctl restart ord
rm ord.old

while ! curl --fail https://signet.ordinals.com/status; do
echo Waiting for ord…
Expand Down
10 changes: 8 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,19 @@ install-dev-deps:
cargo install cargo-criterion

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

log:
log-ord:
ssh [email protected] 'journalctl -fu ord'

log-bitcoind:
ssh [email protected] 'journalctl -fu bitcoind'

test-deploy:
ssh-keygen -f ~/.ssh/known_hosts -R 192.168.56.4
vagrant up
Expand Down

0 comments on commit 2a51d95

Please sign in to comment.