Skip to content

Commit

Permalink
Add script to deploy dev server on production machines (ordinals#550)
Browse files Browse the repository at this point in the history
  • Loading branch information
casey committed Sep 26, 2022
1 parent 4195aef commit 0941284
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
19 changes: 19 additions & 0 deletions bin/update-dev-server
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

set -euxo pipefail

mkdir -p /etc/systemd/system/ord-dev.service.d

cp /etc/systemd/system/{ord,ord-dev}.service.d/override.conf

cargo build --release

if [[ -f /usr/local/bin/ord-dev ]]; then
mv /usr/local/bin/ord-dev{,.bak}
fi

cp target/release/ord /usr/local/bin/ord-dev

cp deploy/ord-dev.service /etc/systemd/system/
systemctl daemon-reload
systemctl restart ord-dev
31 changes: 31 additions & 0 deletions deploy/ord-dev.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[Unit]
After=network.target
Description=Ord Dev Server
StartLimitBurst=120
StartLimitIntervalSec=10m

[Service]
AmbientCapabilities=CAP_NET_BIND_SERVICE
Environment=RUST_BACKTRACE=1
Environment=RUST_LOG=info
ExecStart=/usr/local/bin/ord-dev \
--bitcoin-data-dir /var/lib/bitcoind \
--data-dir /var/lib/ord-dev \
--chain ${CHAIN} \
server \
--http-port 8080
Group=ord
MemoryDenyWriteExecute=true
NoNewPrivileges=true
PrivateDevices=true
PrivateTmp=true
ProtectHome=true
ProtectSystem=full
Restart=on-failure
RestartSec=5s
StateDirectory=ord-dev
StateDirectoryMode=0700
TimeoutStopSec=10m
Type=simple
User=ord
WorkingDirectory=/var/lib/ord-dev
3 changes: 3 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ print-paper-wallet path:
doc:
cargo doc --all --open

update-dev-server:
./bin/update-dev-server

# publish current GitHub master branch
publish:
#!/usr/bin/env bash
Expand Down

0 comments on commit 0941284

Please sign in to comment.