설치 요구 사항
도커 (docker) 이미지를 사용하는 것 외에도, Systemd 서비스로 Linux 시스템 데몬을 통해 노드를 실행하는 방법이 있습니다. 이 서비스는 대부분의 Linux 운영 체제에서 작동할 것입니다. 하지만, 모든 테스트가 완료되고 매뉴얼이 작성된 환경은 Debian/Ubuntu가 유일합니다.
먼저, 노드 서비스를 구동하기 위해 서비스 계정을 생성합니다.
Copy adduser BIFROST_SERVICE --system --no-create-home
그 다음, 바이프로스트 네트워크의 체인 데이터를 저장하기 위한 로컬 디렉토리를 생성합니다. 이 디렉토리는 노드 바이너리와 제네시스 블록에서 최신 블록까지의 수집된 블록 정보를 포함합니다.
Copy # Add sudo at the beginning if it doesn't work (i.e. Permission Denied)
mkdir -p /var/lib/bifrost-data
그 다음, GitHub 릴리스 최신 노드 실행 바이너리 및 체인 사양 (JSON) 파일을 다운로드합니다. 최신 릴리스는 GitHub 저장소의 릴리스 페이지에서 확인할 수 있습니다.
Copy wget "https://github.com/bifrost-platform/bifrost-node/releases/latest/download/bifrost-node"
wget "https://github.com/bifrost-platform/bifrost-node/releases/latest/download/bifrost-testnet.json"
Copy wget "https://github.com/bifrost-platform/bifrost-node/releases/latest/download/bifrost-node"
wget "https://github.com/bifrost-platform/bifrost-node/releases/latest/download/bifrost-mainnet.json"
마지막으로 노드 바이너리에 실행 권한을 부여하고 체인데이터가 있는 디렉토리로 이동시킵니다.
Copy chmod +x bifrost-node
mv bifrost-node bifrost-testnet.json /var/lib/bifrost-data
Copy chmod +x bifrost-node
mv bifrost-node bifrost-mainnet.json /var/lib/bifrost-data
피어키 생성
바이프로스트 네트워크에서 실행되는 모든 노드는 P2P 네트워크에 연결하기 위한 피어 키 (peer key)가 요구됩니다. 새로운 피어 키를 생성하여 체인 데이터에 자동으로 주입하려면 다음 명령어를 실행합니다.
Copy # Add sudo at the beginning if it doesn't work (i.e. Permission Denied)
/var/lib/bifrost-data/bifrost-node key generate-node-key \
--chain /var/lib/bifrost-data/bifrost-testnet.json \
--base-path /var/lib/bifrost-data
Copy /var/lib/bifrost-data/bifrost-node key generate-node-key \
--chain /var/lib/bifrost-data/bifrost-mainnet.json \
--base-path /var/lib/bifrost-data
노드 서비스 실행
먼저 체인데이터 디렉토리의 소유권을 서비스 계정으로 지정합니다.
Copy chown -R BIFROST_SERVICE /var/lib/bifrost-data
다음 Systemd 설정파일을 생성합니다. 아래는 그 예제로 YOUR_NODE_NAME
부분만 운영자가 원하는 노드 서비스 이름으로 변경한 뒤 아래 디렉토리에 해당 파일을 저장합니다.
Copy sudo vi /etc/systemd/system/bifrost-node.service
Copy [Unit]
Description="Bifrost-node systemd service"
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
User=BIFROST_SERVICE
SyslogIdentifier=bifrost-node
SyslogFacility=local7
KillSignal=SIGHUP
ExecStart=/var/lib/bifrost-data/bifrost-node \
--base-path /var/lib/bifrost-data \
--chain /var/lib/bifrost-data/bifrost-testnet.json \
--port 30333 \
--rpc-port 9933 \
--state-pruning archive \
--rpc-cors all \
--rpc-external \
--ethapi debug,trace,txpool \
--runtime-cache-size 64 \
--name "YOUR_NODE_NAME"
[Install]
WantedBy=multi-user.target
Copy [Unit]
Description="Bifrost-node systemd service"
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
User=BIFROST_SERVICE
SyslogIdentifier=bifrost-node
SyslogFacility=local7
KillSignal=SIGHUP
ExecStart=/var/lib/bifrost-data/bifrost-node \
--base-path /var/lib/bifrost-data \
--chain /var/lib/bifrost-data/bifrost-mainnet.json \
--port 30333 \
--rpc-port 9933 \
--state-pruning archive \
--rpc-cors all \
--rpc-external \
--ethapi debug,trace,txpool \
--runtime-cache-size 64 \
--name "YOUR_NODE_NAME"
[Install]
WantedBy=multi-user.target
반대로, 일반노드 모드를 활성화하여 엔드포인트 노드를 실행하려면 인덱싱할 과거 블록의 최대 수를 결정해야 하며, 블록 수는 --state-pruning
옵션 뒤에 지정할 수 있습니다.
이제 아래 두개의 명령을 통해 노드 서비스가 백그라운드에서 동작하게 됩니다.
Copy systemctl enable bifrost-node.service
systemctl start bifrost-node.service
로그 확인 방법
아래 명령어를 통해 bifrost-node
서비스의 로그를 확인할 수 있습니다.
Copy journalctl -f -u bifrost-node
노드 서비스가 정상적으로 실행 되었다면, 로그는 아래와 같이 출력됩니다.
Copy 2023-07-19 17:02:53 BIFROST Network
2023-07-19 17:02:53 ✌️ version 1.2.3-0d1811a5e80
2023-07-19 17:02:53 ❤️ by bifrost-platform, 2022-2023
2023-07-19 17:02:53 📋 Chain specification: BIFROST Development
2023-07-19 17:02:53 🏷 Node name: jolly-grandfather-7771
2023-07-19 17:02:53 👤 Role: AUTHORITY
2023-07-19 17:02:53 💾 Database: RocksDb at /var/folders/vg/xzyl_nmd77x5kcvbryssc5gm0000gn/T/substrateutNaBp/chains/dev/db/full
2023-07-19 17:02:53 ⛓ Native runtime: thebifrost-dev-301 (bifrost-dev-1.tx1.au1)
2023-07-19 17:02:53 🔨 Initializing Genesis block/state (state: 0x7c59…74e5, header-hash: 0x469c…993b)
2023-07-19 17:02:53 🔨 Running Frontier DB migration from version 1 to version 2. Please wait.
2023-07-19 17:02:53 ✔️ Successful Frontier DB migration from version 1 to version 2 (0 entries).
2023-07-19 17:02:53 👴 Loading GRANDPA authority set from genesis on what appears to be first startup.
2023-07-19 17:02:54 Using default protocol ID "sup" because none is configured in the chain specs
2023-07-19 17:02:54 🏷 Local node identity is: 12D3KooWLvfoahrVYuwGjvNKyyWgkWSvBT9TofHvNGdiexgS3hRL
2023-07-19 17:02:54 💻 Operating system: macos
2023-07-19 17:02:54 💻 CPU architecture: aarch64
2023-07-19 17:02:54 📦 Highest known block at #0
2023-07-19 17:02:54 〽️ Prometheus exporter started at 127.0.0.1:9615
2023-07-19 17:02:54 Running JSON-RPC HTTP server: addr=127.0.0.1:9933, allowed origins=["*"]
2023-07-19 17:02:54 Running JSON-RPC WS server: addr=127.0.0.1:9944, allowed origins=["*"]
체인 데이터는 제네시스 블록부터 동기화되어야 하므로, 현재 동기화 중임을 나타내는 정보가 다음과 같이 출력됩니다. 동기화가 완료된 후에만 다음 단계로 진행할 수 있으며, 최대 며칠이 소요될 수 있습니다.
Copy 2023-07-19 17:06:20 ⚙️ Syncing, target=#8037656 (2 peers), best: #4371 (0xd39a…4f76), finalized #4200 (0x79ee…2eec), ⬇ 485.5kiB/s ⬆ 38.0kiB/s
2023-07-19 17:06:25 ⚙️ Syncing 745.8 bps, target=#8037658 (3 peers), best: #8100 (0xac9e…cba6), finalized #7800 (0xb93d…839f), ⬇ 334.1kiB/s ⬆ 24.0kiB/s
2023-07-19 17:06:30 ⚙️ Syncing 676.0 bps, target=#8037660 (3 peers), best: #11480 (0xbdbf…85f2), finalized #11400 (0x612b…7853), ⬇ 409.8kiB/s ⬆ 23.4kiB/s
2023-07-19 17:06:35 ⚙️ Syncing 596.8 bps, target=#8037661 (3 peers), best: #14465 (0xcce8…aadb), finalized #14400 (0x8f77…7e6b), ⬇ 356.1kiB/s ⬆ 24.5kiB/s
2023-07-19 17:06:40 ⚙️ Syncing 646.8 bps, target=#8037663 (3 peers), best: #17700 (0xf0a1…36d6), finalized #17408 (0x467b…63bf), ⬇ 372.7kiB/s ⬆ 9.2kiB/s
2023-07-19 17:06:45 ⚙️ Syncing 596.4 bps, target=#8037665 (3 peers), best: #20682 (0xcc4c…2ca9), finalized #20480 (0x1d99…7288), ⬇ 340.3kiB/s ⬆ 12.3kiB/s
2023-07-19 17:06:50 ⚙️ Syncing 560.2 bps, target=#8037666 (3 peers), best: #23485 (0x83ba…6fae), finalized #23400 (0xa031…a7e0), ⬇ 399.4kiB/s ⬆ 9.9kiB/s
2023-07-19 17:06:55 ⚙️ Syncing 575.0 bps, target=#8037668 (3 peers), best: #26362 (0xb11c…7fc4), finalized #26112 (0xbaa5…6c61), ⬇ 328.7kiB/s ⬆ 12.8kiB/s
2023-07-19 17:07:00 ⚙️ Syncing 579.4 bps, target=#8037670 (3 peers), best: #29259 (0xa287…cf05), finalized #29184 (0x7ac8…55cb), ⬇ 353.6kiB/s ⬆ 7.8kiB/s
2023-07-19 17:07:05 ⚙️ Syncing 595.4 bps, target=#8037671 (3 peers), best: #32237 (0xfc62…6b12), finalized #32100 (0x95cd…0c27), ⬇ 338.3kiB/s ⬆ 14.9kiB/s
2023-07-19 17:07:10 ⚙️ Syncing 590.2 bps, target=#8037673 (3 peers), best: #35191 (0x3b06…9e27), finalized #35100 (0xd461…5ab7), ⬇ 330.9kiB/s ⬆ 8.7kiB/s
체인 데이터가 완전히 동기화되면, 새롭게 생성된 블록들이 각 블록 타임에 맞춰서 동기화 되며, 아래와 같은 로그를 확인할 수 있습니다.
Copy 2023-07-19 08:08:09 ✨ Imported #5384451 (0xd7a8…011f)
2023-07-19 08:08:10 💤 Idle (25 peers), best: #5384451 (0xd7a8…011f), finalized #5384449 (0x1ae1…fdf3), ⬇ 47.7kiB/s ⬆ 49.5kiB/s
2023-07-19 08:08:12 ✨ Imported #5384452 (0x9bf4…9710)
2023-07-19 08:08:15 ✨ Imported #5384453 (0x90af…653a)
2023-07-19 08:08:15 💤 Idle (25 peers), best: #5384453 (0x90af…653a), finalized #5384450 (0x8026…f68a), ⬇ 37.3kiB/s ⬆ 36.9kiB/s
2023-07-19 08:08:18 ✨ Imported #5384454 (0x5c80…9b84)
2023-07-19 08:08:20 💤 Idle (25 peers), best: #5384454 (0x5c80…9b84), finalized #5384452 (0x9bf4…9710), ⬇ 38.0kiB/s ⬆ 46.4kiB/s
2023-07-19 08:08:21 ✨ Imported #5384455 (0x91d0…de42)
2023-07-19 08:08:24 ✨ Imported #5384456 (0xb7e0…832e)
2023-07-19 08:08:25 💤 Idle (25 peers), best: #5384456 (0xb7e0…832e), finalized #5384454 (0x5c80…9b84), ⬇ 46.2kiB/s ⬆ 44.2kiB/s
2023-07-19 08:08:27 ✨ Imported #5384457 (0xcc84…0e00)
2023-07-19 08:08:30 ✨ Imported #5384458 (0xc499…2475)
2023-07-19 08:08:30 💤 Idle (25 peers), best: #5384458 (0xc499…2475), finalized #5384455 (0x91d0…de42), ⬇ 28.5kiB/s ⬆ 44.0kiB/s
노드 클라이언트 업데이트
바이프로스트 네트워크는 계속 발전하고 있어, 노드 클라이언트 업그레이드가 필요할 때가 있습니다. 업그레이드 가능 여부와 필수 여부(일부 업그레이드는 선택 사항)는 디스코드 채널이나 개별 연락을 통해 노드 운영자에게 알려드립니다.
노드 클라이언트 업그레이드 전에는 혹시 모를 데이터, 키 또는 자격 증명 손실을 막기 위해 반드시 체인 데이터를 백업해 두셔야 합니다.
Copy # Stop and delete bifrost-node binary
systemctl stop bifrost-node.service
rm /var/lib/bifrost-data/bifrost-node
# Download the latest bifrost-node binary
wget "https://github.com/bifrost-platform/bifrost-node/releases/latest/download/bifrost-node"
# Grant execute permission & move to chain data directory
chmod +x bifrost-node
chown BIFROST_SERVICE bifrost-node
mv bifrost-node /var/lib/bifrost-data
systemctl restart bifrost-node.service