-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
70 additions
and
38 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,34 @@ | ||
#!/usr/bin/env bash | ||
set -euxo pipefail | ||
|
||
# This script deploys whatever is currently | ||
# in working directory to our dev server | ||
DOMAIN="ordinals-dev.com" | ||
|
||
# Current local working state | ||
BRANCH=$(git rev-parse --abbrev-ref HEAD) | ||
COMMIT=$(git rev-parse --short HEAD) | ||
DIR="ord-${BRANCH}-${COMMIT}" | ||
|
||
# Edit service file if you want | ||
$EDITOR ./deploy/ord-dev.service | ||
|
||
# Create own directory for every deploy | ||
ssh root@${DOMAIN} "mkdir -p /var/lib/ord/${DIR}/repo" | ||
rsync -avz --exclude-from='.gitignore' --exclude ".git" --exclude "*.redb" ./ root@${DOMAIN}:/var/lib/ord/${DIR}/repo | ||
|
||
# Store deployment info in environmental variables | ||
ssh root@${DOMAIN} "echo 'BRANCH=${BRANCH}' >> /etc/environment \ | ||
&& echo 'COMMIT=${COMMIT}' >> /etc/environment \ | ||
&& echo 'DIR=${DIR}' >> /etc/environment" | ||
|
||
# Deploy | ||
ssh root@${DOMAIN} "cd /var/lib/ord/${DIR}/repo \ | ||
&& /root/.cargo/bin/cargo build --release \ | ||
&& systemctl stop ord-dev \ | ||
&& cp ./target/release/ord /usr/local/bin/ord \ | ||
&& cp /var/lib/ord/${DIR}/repo/deploy/ord-dev.service /etc/systemd/system/ \ | ||
&& systemctl daemon-reload \ | ||
&& systemctl enable ord-dev \ | ||
&& systemctl restart ord-dev \ | ||
&& systemctl status ord-dev" |
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 |
---|---|---|
|
@@ -8,14 +8,16 @@ StartLimitIntervalSec=10m | |
AmbientCapabilities=CAP_NET_BIND_SERVICE | ||
Environment=RUST_BACKTRACE=1 | ||
Environment=RUST_LOG=info | ||
ExecStart=/usr/local/bin/ord-dev \ | ||
ExecStart=/usr/local/bin/ord \ | ||
--bitcoin-data-dir /var/lib/bitcoind \ | ||
--chain ${CHAIN} \ | ||
--data-dir /var/lib/ord-dev \ | ||
--index-sats \ | ||
--data-dir /var/lib/ord \ | ||
# --index-sats \ | ||
server \ | ||
--http-port 8080 | ||
--acme-contact mailto:[email protected] \ | ||
--http \ | ||
--https | ||
Group=ord | ||
LimitNOFILE=65536 | ||
MemoryDenyWriteExecute=true | ||
NoNewPrivileges=true | ||
PrivateDevices=true | ||
|
@@ -24,9 +26,12 @@ ProtectHome=true | |
ProtectSystem=full | ||
Restart=on-failure | ||
RestartSec=5s | ||
StateDirectory=ord-dev | ||
StateDirectory=ord | ||
StateDirectoryMode=0700 | ||
TimeoutStopSec=10m | ||
Type=simple | ||
User=ord | ||
WorkingDirectory=/var/lib/ord-dev | ||
WorkingDirectory=/var/lib/ord | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
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,17 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
# Stops, copies index and exports state of running instance | ||
systemctl stop ord-dev | ||
|
||
cd /var/lib/ord | ||
|
||
# Still have to manually set --index-sats or --height-limit | ||
/usr/local/bin/ord --bitcoin-data-dir /var/lib/bitcoind \ | ||
--data-dir /var/lib/ord \ | ||
index export | ||
|
||
mv inscription_number_to_id.tsv ./${DIR}/inscription_number_to_id-${BRANCH}-${COMMIT}.tsv | ||
|
||
mv index.redb ./${DIR}/index-${BRANCH}-${COMMIT}.redb | ||
|
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