parent
b05b42d74d
commit
bd7e269280
|
@ -11,10 +11,7 @@
|
||||||
**/*.rs.bk
|
**/*.rs.bk
|
||||||
.cargo
|
.cargo
|
||||||
|
|
||||||
# node config that is rsynced
|
|
||||||
/config/
|
/config/
|
||||||
# node config that remains local
|
|
||||||
/config-local/
|
|
||||||
|
|
||||||
# log files
|
# log files
|
||||||
*.log
|
*.log
|
||||||
|
|
|
@ -3118,6 +3118,8 @@ dependencies = [
|
||||||
"sys-info 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"sys-info 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
"tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"tokio-fs 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"untrusted 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"untrusted 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -217,9 +217,9 @@ $ solana-wallet show-vote-account 2ozWvfaXQd1X6uKh8jERoRGApDqSqcEy6fF1oN13LL2G
|
||||||
The vote pubkey for the validator can also be found by running:
|
The vote pubkey for the validator can also be found by running:
|
||||||
```bash
|
```bash
|
||||||
# If this is a `solana-install`-installation run:
|
# If this is a `solana-install`-installation run:
|
||||||
$ solana-keygen pubkey ~/.local/share/solana/install/active_release/config-local/validator-vote-keypair.json
|
$ solana-keygen pubkey ~/.local/share/solana/install/active_release/config/validator-vote-keypair.json
|
||||||
# Otherwise run:
|
# Otherwise run:
|
||||||
$ solana-keygen pubkey ./config-local/validator-vote-keypair.json
|
$ solana-keygen pubkey ./config/validator-vote-keypair.json
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -265,7 +265,7 @@ verifyLedger() {
|
||||||
(
|
(
|
||||||
source multinode-demo/common.sh
|
source multinode-demo/common.sh
|
||||||
set -x
|
set -x
|
||||||
$solana_ledger_tool --ledger "$SOLANA_CONFIG_DIR"/$ledger-ledger verify
|
$solana_ledger_tool --ledger "$SOLANA_CONFIG_DIR"/$ledger/ledger verify
|
||||||
) || flag_error
|
) || flag_error
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,8 @@ solana-librapay-api = { path = "../programs/librapay_api", version = "0.18.0-pre
|
||||||
sys-info = "0.5.7"
|
sys-info = "0.5.7"
|
||||||
tokio = "0.1"
|
tokio = "0.1"
|
||||||
tokio-codec = "0.1"
|
tokio-codec = "0.1"
|
||||||
|
tokio-fs = "0.1"
|
||||||
|
tokio-io = "0.1"
|
||||||
untrusted = "0.7.0"
|
untrusted = "0.7.0"
|
||||||
|
|
||||||
# reed-solomon-erasure's simd_c feature fails to build for x86_64-pc-windows-msvc, use pure-rust
|
# reed-solomon-erasure's simd_c feature fails to build for x86_64-pc-windows-msvc, use pure-rust
|
||||||
|
|
|
@ -6,12 +6,17 @@ use crate::rpc::*;
|
||||||
use crate::service::Service;
|
use crate::service::Service;
|
||||||
use crate::storage_stage::StorageState;
|
use crate::storage_stage::StorageState;
|
||||||
use jsonrpc_core::MetaIoHandler;
|
use jsonrpc_core::MetaIoHandler;
|
||||||
use jsonrpc_http_server::{hyper, AccessControlAllowOrigin, DomainsValidation, ServerBuilder};
|
use jsonrpc_http_server::{
|
||||||
|
hyper, AccessControlAllowOrigin, DomainsValidation, RequestMiddleware, RequestMiddlewareAction,
|
||||||
|
ServerBuilder,
|
||||||
|
};
|
||||||
use std::net::SocketAddr;
|
use std::net::SocketAddr;
|
||||||
|
use std::path::{Path, PathBuf};
|
||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
use std::thread::{self, sleep, Builder, JoinHandle};
|
use std::thread::{self, sleep, Builder, JoinHandle};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
use tokio::prelude::Future;
|
||||||
|
|
||||||
pub struct JsonRpcService {
|
pub struct JsonRpcService {
|
||||||
thread_hdl: JoinHandle<()>,
|
thread_hdl: JoinHandle<()>,
|
||||||
|
@ -20,6 +25,61 @@ pub struct JsonRpcService {
|
||||||
pub request_processor: Arc<RwLock<JsonRpcRequestProcessor>>, // Used only by test_rpc_new()...
|
pub request_processor: Arc<RwLock<JsonRpcRequestProcessor>>, // Used only by test_rpc_new()...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
|
struct RpcRequestMiddleware {
|
||||||
|
ledger_path: PathBuf,
|
||||||
|
}
|
||||||
|
impl RpcRequestMiddleware {
|
||||||
|
pub fn new(ledger_path: PathBuf) -> Self {
|
||||||
|
Self { ledger_path }
|
||||||
|
}
|
||||||
|
|
||||||
|
fn not_found() -> hyper::Response<hyper::Body> {
|
||||||
|
hyper::Response::builder()
|
||||||
|
.status(hyper::StatusCode::NOT_FOUND)
|
||||||
|
.body(hyper::Body::empty())
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn internal_server_error() -> hyper::Response<hyper::Body> {
|
||||||
|
hyper::Response::builder()
|
||||||
|
.status(hyper::StatusCode::INTERNAL_SERVER_ERROR)
|
||||||
|
.body(hyper::Body::empty())
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get(&self, filename: &str) -> RequestMiddlewareAction {
|
||||||
|
let filename = self.ledger_path.join(filename);
|
||||||
|
RequestMiddlewareAction::Respond {
|
||||||
|
should_validate_hosts: true,
|
||||||
|
response: Box::new(
|
||||||
|
tokio_fs::file::File::open(filename)
|
||||||
|
.and_then(|file| {
|
||||||
|
let buf: Vec<u8> = Vec::new();
|
||||||
|
tokio_io::io::read_to_end(file, buf)
|
||||||
|
.and_then(|item| Ok(hyper::Response::new(item.1.into())))
|
||||||
|
.or_else(|_| Ok(RpcRequestMiddleware::internal_server_error()))
|
||||||
|
})
|
||||||
|
.or_else(|_| Ok(RpcRequestMiddleware::not_found())),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl RequestMiddleware for RpcRequestMiddleware {
|
||||||
|
fn on_request(&self, request: hyper::Request<hyper::Body>) -> RequestMiddlewareAction {
|
||||||
|
trace!("request uri: {}", request.uri());
|
||||||
|
match request.uri().path() {
|
||||||
|
"/snapshot.tgz" => self.get("snapshot.tgz"),
|
||||||
|
"/genesis.tgz" => self.get("genesis.tgz"),
|
||||||
|
_ => RequestMiddlewareAction::Proceed {
|
||||||
|
should_continue_on_invalid_cors: false,
|
||||||
|
request,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl JsonRpcService {
|
impl JsonRpcService {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
cluster_info: &Arc<RwLock<ClusterInfo>>,
|
cluster_info: &Arc<RwLock<ClusterInfo>>,
|
||||||
|
@ -27,6 +87,7 @@ impl JsonRpcService {
|
||||||
storage_state: StorageState,
|
storage_state: StorageState,
|
||||||
config: JsonRpcConfig,
|
config: JsonRpcConfig,
|
||||||
bank_forks: Arc<RwLock<BankForks>>,
|
bank_forks: Arc<RwLock<BankForks>>,
|
||||||
|
ledger_path: &Path,
|
||||||
exit: &Arc<AtomicBool>,
|
exit: &Arc<AtomicBool>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
info!("rpc bound to {:?}", rpc_addr);
|
info!("rpc bound to {:?}", rpc_addr);
|
||||||
|
@ -41,6 +102,7 @@ impl JsonRpcService {
|
||||||
|
|
||||||
let cluster_info = cluster_info.clone();
|
let cluster_info = cluster_info.clone();
|
||||||
let exit_ = exit.clone();
|
let exit_ = exit.clone();
|
||||||
|
let ledger_path = ledger_path.to_path_buf();
|
||||||
|
|
||||||
let thread_hdl = Builder::new()
|
let thread_hdl = Builder::new()
|
||||||
.name("solana-jsonrpc".to_string())
|
.name("solana-jsonrpc".to_string())
|
||||||
|
@ -57,11 +119,13 @@ impl JsonRpcService {
|
||||||
.cors(DomainsValidation::AllowOnly(vec![
|
.cors(DomainsValidation::AllowOnly(vec![
|
||||||
AccessControlAllowOrigin::Any,
|
AccessControlAllowOrigin::Any,
|
||||||
]))
|
]))
|
||||||
|
.request_middleware(RpcRequestMiddleware::new(ledger_path))
|
||||||
.start_http(&rpc_addr);
|
.start_http(&rpc_addr);
|
||||||
if let Err(e) = server {
|
if let Err(e) = server {
|
||||||
warn!("JSON RPC service unavailable error: {:?}. \nAlso, check that port {} is not already in use by another application", e, rpc_addr.port());
|
warn!("JSON RPC service unavailable error: {:?}. \nAlso, check that port {} is not already in use by another application", e, rpc_addr.port());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while !exit_.load(Ordering::Relaxed) {
|
while !exit_.load(Ordering::Relaxed) {
|
||||||
sleep(Duration::from_millis(100));
|
sleep(Duration::from_millis(100));
|
||||||
}
|
}
|
||||||
|
@ -116,6 +180,7 @@ mod tests {
|
||||||
StorageState::default(),
|
StorageState::default(),
|
||||||
JsonRpcConfig::default(),
|
JsonRpcConfig::default(),
|
||||||
bank_forks,
|
bank_forks,
|
||||||
|
&PathBuf::from("farf"),
|
||||||
&exit,
|
&exit,
|
||||||
);
|
);
|
||||||
let thread = rpc_service.thread_hdl.thread();
|
let thread = rpc_service.thread_hdl.thread();
|
||||||
|
|
|
@ -176,6 +176,7 @@ impl Validator {
|
||||||
storage_state.clone(),
|
storage_state.clone(),
|
||||||
config.rpc_config.clone(),
|
config.rpc_config.clone(),
|
||||||
bank_forks.clone(),
|
bank_forks.clone(),
|
||||||
|
ledger_path,
|
||||||
&exit,
|
&exit,
|
||||||
))
|
))
|
||||||
};
|
};
|
||||||
|
|
|
@ -35,13 +35,6 @@ while [[ -n $1 ]]; do
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ ! -d "$SOLANA_RSYNC_CONFIG_DIR"/ledger ]]; then
|
|
||||||
echo "$SOLANA_RSYNC_CONFIG_DIR/ledger does not exist"
|
|
||||||
echo
|
|
||||||
echo "Please run: $here/setup.sh"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -z $CI ]]; then # Skip in CI
|
if [[ -z $CI ]]; then # Skip in CI
|
||||||
# shellcheck source=scripts/tune-system.sh
|
# shellcheck source=scripts/tune-system.sh
|
||||||
source "$here"/../scripts/tune-system.sh
|
source "$here"/../scripts/tune-system.sh
|
||||||
|
@ -50,23 +43,25 @@ fi
|
||||||
setup_secondary_mount
|
setup_secondary_mount
|
||||||
|
|
||||||
# These keypairs are created by ./setup.sh and included in the genesis block
|
# These keypairs are created by ./setup.sh and included in the genesis block
|
||||||
identity_keypair=$SOLANA_CONFIG_DIR/bootstrap-leader-keypair.json
|
identity_keypair=$SOLANA_CONFIG_DIR/bootstrap-leader/identity-keypair.json
|
||||||
vote_keypair="$SOLANA_CONFIG_DIR"/bootstrap-leader-vote-keypair.json
|
vote_keypair="$SOLANA_CONFIG_DIR"/bootstrap-leader/vote-keypair.json
|
||||||
storage_keypair=$SOLANA_CONFIG_DIR/bootstrap-leader-storage-keypair.json
|
storage_keypair=$SOLANA_CONFIG_DIR/bootstrap-leader/storage-keypair.json
|
||||||
|
|
||||||
ledger_config_dir="$SOLANA_CONFIG_DIR"/bootstrap-leader-ledger
|
ledger_dir="$SOLANA_CONFIG_DIR"/bootstrap-leader/ledger
|
||||||
[[ -d "$ledger_config_dir" ]] || (
|
[[ -d "$ledger_dir" ]] || {
|
||||||
set -x
|
echo "$ledger_dir does not exist"
|
||||||
cp -a "$SOLANA_RSYNC_CONFIG_DIR"/ledger/ "$ledger_config_dir"
|
echo
|
||||||
)
|
echo "Please run: $here/setup.sh"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
args+=(
|
args+=(
|
||||||
--accounts "$SOLANA_CONFIG_DIR"/bootstrap-leader-accounts
|
--accounts "$SOLANA_CONFIG_DIR"/bootstrap-leader/accounts
|
||||||
--enable-rpc-exit
|
--enable-rpc-exit
|
||||||
--identity "$identity_keypair"
|
--identity "$identity_keypair"
|
||||||
--ledger "$ledger_config_dir"
|
--ledger "$ledger_dir"
|
||||||
--rpc-port 8899
|
--rpc-port 8899
|
||||||
--snapshot-path "$SOLANA_CONFIG_DIR"/bootstrap-leader-snapshots
|
--snapshot-path "$SOLANA_CONFIG_DIR"/bootstrap-leader/snapshots
|
||||||
--storage-keypair "$storage_keypair"
|
--storage-keypair "$storage_keypair"
|
||||||
--voting-keypair "$vote_keypair"
|
--voting-keypair "$vote_keypair"
|
||||||
--rpc-drone-address 127.0.0.1:9900
|
--rpc-drone-address 127.0.0.1:9900
|
||||||
|
|
|
@ -9,11 +9,11 @@ source "$here"/common.sh
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
for i in "$SOLANA_RSYNC_CONFIG_DIR" "$SOLANA_CONFIG_DIR"; do
|
(
|
||||||
echo "Cleaning $i"
|
set -x
|
||||||
rm -rvf "${i:?}/" # <-- $i might be a symlink, rm the other side of it first
|
rm -rf "${SOLANA_CONFIG_DIR:?}/" # <-- $i might be a symlink, rm the other side of it first
|
||||||
rm -rvf "$i"
|
rm -rf "$SOLANA_CONFIG_DIR"
|
||||||
mkdir -p "$i"
|
mkdir -p "$SOLANA_CONFIG_DIR"
|
||||||
done
|
)
|
||||||
|
|
||||||
setup_secondary_mount
|
setup_secondary_mount
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
|
|
||||||
SOLANA_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. || exit 1; pwd)"
|
SOLANA_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. || exit 1; pwd)"
|
||||||
|
|
||||||
rsync=rsync
|
|
||||||
|
|
||||||
if [[ $(uname) != Linux ]]; then
|
if [[ $(uname) != Linux ]]; then
|
||||||
# Protect against unsupported configurations to prevent non-obvious errors
|
# Protect against unsupported configurations to prevent non-obvious errors
|
||||||
# later. Arguably these should be fatal errors but for now prefer tolerance.
|
# later. Arguably these should be fatal errors but for now prefer tolerance.
|
||||||
|
@ -65,19 +63,15 @@ export RUST_BACKTRACE=1
|
||||||
# shellcheck source=scripts/configure-metrics.sh
|
# shellcheck source=scripts/configure-metrics.sh
|
||||||
source "$SOLANA_ROOT"/scripts/configure-metrics.sh
|
source "$SOLANA_ROOT"/scripts/configure-metrics.sh
|
||||||
|
|
||||||
# The directory on the cluster entrypoint that is rsynced by other full nodes
|
SOLANA_CONFIG_DIR=$SOLANA_ROOT/config
|
||||||
SOLANA_RSYNC_CONFIG_DIR=$SOLANA_ROOT/config
|
|
||||||
|
|
||||||
# Configuration that remains local
|
|
||||||
SOLANA_CONFIG_DIR=$SOLANA_ROOT/config-local
|
|
||||||
|
|
||||||
SECONDARY_DISK_MOUNT_POINT=/mnt/extra-disk
|
SECONDARY_DISK_MOUNT_POINT=/mnt/extra-disk
|
||||||
setup_secondary_mount() {
|
setup_secondary_mount() {
|
||||||
# If there is a secondary disk, symlink the config-local dir there
|
# If there is a secondary disk, symlink the config/ dir there
|
||||||
if [[ -d $SECONDARY_DISK_MOUNT_POINT ]]; then
|
if [[ -d $SECONDARY_DISK_MOUNT_POINT ]]; then
|
||||||
mkdir -p $SECONDARY_DISK_MOUNT_POINT/config-local
|
mkdir -p $SECONDARY_DISK_MOUNT_POINT/config
|
||||||
rm -rf "$SOLANA_CONFIG_DIR"
|
rm -rf "$SOLANA_CONFIG_DIR"
|
||||||
ln -sfT $SECONDARY_DISK_MOUNT_POINT/config-local "$SOLANA_CONFIG_DIR"
|
ln -sfT $SECONDARY_DISK_MOUNT_POINT/config "$SOLANA_CONFIG_DIR"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,479 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
#
|
|
||||||
# Start a validator
|
|
||||||
#
|
|
||||||
here=$(dirname "$0")
|
|
||||||
# shellcheck source=multinode-demo/common.sh
|
|
||||||
source "$here"/common.sh
|
|
||||||
|
|
||||||
fullnode_usage() {
|
|
||||||
if [[ -n $1 ]]; then
|
|
||||||
echo "$*"
|
|
||||||
echo
|
|
||||||
fi
|
|
||||||
cat <<EOF
|
|
||||||
|
|
||||||
Fullnode Usage:
|
|
||||||
usage: $0 [--config-dir PATH] [--blockstream PATH] [--init-complete-file FILE] [--label LABEL] [--stake LAMPORTS] [--no-voting] [--rpc-port port] [rsync network path to bootstrap leader configuration] [cluster entry point]
|
|
||||||
|
|
||||||
Start a validator
|
|
||||||
|
|
||||||
--config-dir PATH - store configuration and data files under this PATH
|
|
||||||
--blockstream PATH - open blockstream at this unix domain socket location
|
|
||||||
--init-complete-file FILE - create this file, if it doesn't already exist, once node initialization is complete
|
|
||||||
--label LABEL - Append the given label to the configuration files, useful when running
|
|
||||||
multiple fullnodes in the same workspace
|
|
||||||
--stake LAMPORTS - Number of lamports to stake
|
|
||||||
--node-lamports LAMPORTS - Number of lamports this node has been funded from the genesis block
|
|
||||||
--no-voting - start node without vote signer
|
|
||||||
--rpc-port port - custom RPC port for this node
|
|
||||||
--no-restart - do not restart the node if it exits
|
|
||||||
--no-airdrop - The genesis block has an account for the node. Airdrops are not required.
|
|
||||||
|
|
||||||
EOF
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
find_entrypoint() {
|
|
||||||
declare entrypoint entrypoint_address
|
|
||||||
declare shift=0
|
|
||||||
|
|
||||||
if [[ -z $1 ]]; then
|
|
||||||
entrypoint="$SOLANA_ROOT" # Default to local tree for rsync
|
|
||||||
entrypoint_address=127.0.0.1:8001 # Default to local entrypoint
|
|
||||||
elif [[ -z $2 ]]; then
|
|
||||||
entrypoint=$1
|
|
||||||
entrypoint_address=$entrypoint:8001
|
|
||||||
shift=1
|
|
||||||
else
|
|
||||||
entrypoint=$1
|
|
||||||
entrypoint_address=$2
|
|
||||||
shift=2
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "$entrypoint" "$entrypoint_address" "$shift"
|
|
||||||
}
|
|
||||||
|
|
||||||
rsync_url() { # adds the 'rsync://` prefix to URLs that need it
|
|
||||||
declare url="$1"
|
|
||||||
|
|
||||||
if [[ $url =~ ^.*:.*$ ]]; then
|
|
||||||
# assume remote-shell transport when colon is present, use $url unmodified
|
|
||||||
echo "$url"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -d $url ]]; then
|
|
||||||
# assume local directory if $url is a valid directory, use $url unmodified
|
|
||||||
echo "$url"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Default to rsync:// URL
|
|
||||||
echo "rsync://$url"
|
|
||||||
}
|
|
||||||
|
|
||||||
setup_validator_accounts() {
|
|
||||||
declare entrypoint_ip=$1
|
|
||||||
declare node_lamports=$2
|
|
||||||
declare stake_lamports=$3
|
|
||||||
|
|
||||||
if [[ -f $configured_flag ]]; then
|
|
||||||
echo "Vote and stake accounts have already been configured"
|
|
||||||
else
|
|
||||||
if ((airdrops_enabled)); then
|
|
||||||
echo "Fund the node with enough tokens to fund its Vote, Staking, and Storage accounts"
|
|
||||||
(
|
|
||||||
declare fees=100 # TODO: No hardcoded transaction fees, fetch the current cluster fees
|
|
||||||
set -x
|
|
||||||
$solana_wallet --keypair "$identity_keypair_path" --url "http://$entrypoint_ip:8899" \
|
|
||||||
airdrop $((node_lamports+stake_lamports+fees))
|
|
||||||
) || return $?
|
|
||||||
else
|
|
||||||
echo "current account balance is "
|
|
||||||
$solana_wallet --keypair "$identity_keypair_path" --url "http://$entrypoint_ip:8899" balance || return $?
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Fund the vote account from the node's identity pubkey"
|
|
||||||
(
|
|
||||||
set -x
|
|
||||||
$solana_wallet --keypair "$identity_keypair_path" --url "http://$entrypoint_ip:8899" \
|
|
||||||
create-vote-account "$vote_pubkey" "$identity_pubkey" 1 --commission 127
|
|
||||||
) || return $?
|
|
||||||
|
|
||||||
echo "Delegate the stake account to the node's vote account"
|
|
||||||
(
|
|
||||||
set -x
|
|
||||||
$solana_wallet --keypair "$identity_keypair_path" --url "http://$entrypoint_ip:8899" \
|
|
||||||
delegate-stake "$stake_keypair_path" "$vote_pubkey" "$stake_lamports"
|
|
||||||
) || return $?
|
|
||||||
|
|
||||||
echo "Create validator storage account"
|
|
||||||
(
|
|
||||||
set -x
|
|
||||||
$solana_wallet --keypair "$identity_keypair_path" --url "http://$entrypoint_ip:8899" \
|
|
||||||
create-validator-storage-account "$identity_pubkey" "$storage_pubkey"
|
|
||||||
) || return $?
|
|
||||||
|
|
||||||
touch "$configured_flag"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Identity account balance:"
|
|
||||||
(
|
|
||||||
set -x
|
|
||||||
$solana_wallet --keypair "$identity_keypair_path" --url "http://$entrypoint_ip:8899" balance
|
|
||||||
$solana_wallet --keypair "$identity_keypair_path" --url "http://$entrypoint_ip:8899" \
|
|
||||||
show-vote-account "$vote_pubkey"
|
|
||||||
$solana_wallet --keypair "$identity_keypair_path" --url "http://$entrypoint_ip:8899" \
|
|
||||||
show-stake-account "$stake_pubkey"
|
|
||||||
$solana_wallet --keypair "$identity_keypair_path" --url "http://$entrypoint_ip:8899" \
|
|
||||||
show-storage-account "$storage_pubkey"
|
|
||||||
)
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
args=()
|
|
||||||
node_lamports=424242 # number of lamports to assign the node for transaction fees
|
|
||||||
stake_lamports=42 # number of lamports to assign as stake
|
|
||||||
poll_for_new_genesis_block=0
|
|
||||||
label=
|
|
||||||
identity_keypair_path=
|
|
||||||
no_restart=0
|
|
||||||
airdrops_enabled=1
|
|
||||||
generate_snapshots=0
|
|
||||||
boot_from_snapshot=1
|
|
||||||
reset_ledger=0
|
|
||||||
config_dir=
|
|
||||||
|
|
||||||
positional_args=()
|
|
||||||
while [[ -n $1 ]]; do
|
|
||||||
if [[ ${1:0:1} = - ]]; then
|
|
||||||
if [[ $1 = --label ]]; then
|
|
||||||
label="-$2"
|
|
||||||
shift 2
|
|
||||||
elif [[ $1 = --no-restart ]]; then
|
|
||||||
no_restart=1
|
|
||||||
shift
|
|
||||||
elif [[ $1 = --generate-snapshots ]]; then
|
|
||||||
generate_snapshots=1
|
|
||||||
shift
|
|
||||||
elif [[ $1 = --no-snapshot ]]; then
|
|
||||||
boot_from_snapshot=0
|
|
||||||
shift
|
|
||||||
elif [[ $1 = --poll-for-new-genesis-block ]]; then
|
|
||||||
poll_for_new_genesis_block=1
|
|
||||||
shift
|
|
||||||
elif [[ $1 = --blockstream ]]; then
|
|
||||||
stake_lamports=0
|
|
||||||
args+=("$1" "$2")
|
|
||||||
shift 2
|
|
||||||
elif [[ $1 = --identity ]]; then
|
|
||||||
identity_keypair_path=$2
|
|
||||||
args+=("$1" "$2")
|
|
||||||
shift 2
|
|
||||||
elif [[ $1 = --voting-keypair ]]; then
|
|
||||||
voting_keypair_path=$2
|
|
||||||
args+=("$1" "$2")
|
|
||||||
shift 2
|
|
||||||
elif [[ $1 = --storage-keypair ]]; then
|
|
||||||
storage_keypair_path=$2
|
|
||||||
args+=("$1" "$2")
|
|
||||||
shift 2
|
|
||||||
elif [[ $1 = --enable-rpc-exit ]]; then
|
|
||||||
args+=("$1")
|
|
||||||
shift
|
|
||||||
elif [[ $1 = --init-complete-file ]]; then
|
|
||||||
args+=("$1" "$2")
|
|
||||||
shift 2
|
|
||||||
elif [[ $1 = --stake ]]; then
|
|
||||||
stake_lamports="$2"
|
|
||||||
shift 2
|
|
||||||
elif [[ $1 = --node-lamports ]]; then
|
|
||||||
node_lamports="$2"
|
|
||||||
shift 2
|
|
||||||
elif [[ $1 = --no-voting ]]; then
|
|
||||||
args+=("$1")
|
|
||||||
shift
|
|
||||||
elif [[ $1 = --skip-ledger-verify ]]; then
|
|
||||||
args+=("$1")
|
|
||||||
shift
|
|
||||||
elif [[ $1 = --no-sigverify ]]; then
|
|
||||||
args+=("$1")
|
|
||||||
shift
|
|
||||||
elif [[ $1 = --limit-ledger-size ]]; then
|
|
||||||
args+=("$1")
|
|
||||||
shift
|
|
||||||
elif [[ $1 = --rpc-port ]]; then
|
|
||||||
args+=("$1" "$2")
|
|
||||||
shift 2
|
|
||||||
elif [[ $1 = --dynamic-port-range ]]; then
|
|
||||||
args+=("$1" "$2")
|
|
||||||
shift 2
|
|
||||||
elif [[ $1 = --gossip-port ]]; then
|
|
||||||
args+=("$1" "$2")
|
|
||||||
shift 2
|
|
||||||
elif [[ $1 = --no-airdrop ]]; then
|
|
||||||
airdrops_enabled=0
|
|
||||||
shift
|
|
||||||
elif [[ $1 = --reset-ledger ]]; then
|
|
||||||
reset_ledger=1
|
|
||||||
shift
|
|
||||||
elif [[ $1 = --config-dir ]]; then
|
|
||||||
config_dir=$2
|
|
||||||
shift 2
|
|
||||||
elif [[ $1 = -h ]]; then
|
|
||||||
fullnode_usage "$@"
|
|
||||||
else
|
|
||||||
echo "Unknown argument: $1"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
positional_args+=("$1")
|
|
||||||
shift
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [[ -n $REQUIRE_CONFIG_DIR ]]; then
|
|
||||||
if [[ -z $config_dir ]]; then
|
|
||||||
fullnode_usage "Error: --config-dir not specified"
|
|
||||||
fi
|
|
||||||
|
|
||||||
SOLANA_RSYNC_CONFIG_DIR="$config_dir"/config
|
|
||||||
SOLANA_CONFIG_DIR="$config_dir"/config-local
|
|
||||||
fi
|
|
||||||
|
|
||||||
setup_secondary_mount
|
|
||||||
|
|
||||||
if [[ ${#positional_args[@]} -gt 2 ]]; then
|
|
||||||
fullnode_usage "$@"
|
|
||||||
fi
|
|
||||||
|
|
||||||
read -r entrypoint entrypoint_address shift < <(find_entrypoint "${positional_args[@]}")
|
|
||||||
shift "$shift"
|
|
||||||
|
|
||||||
mkdir -p "$SOLANA_CONFIG_DIR"
|
|
||||||
|
|
||||||
: "${identity_keypair_path:=$SOLANA_CONFIG_DIR/validator-keypair$label.json}"
|
|
||||||
[[ -r "$identity_keypair_path" ]] || $solana_keygen new -o "$identity_keypair_path"
|
|
||||||
|
|
||||||
: "${voting_keypair_path:=$SOLANA_CONFIG_DIR/validator-vote-keypair$label.json}"
|
|
||||||
[[ -r "$voting_keypair_path" ]] || $solana_keygen new -o "$voting_keypair_path"
|
|
||||||
|
|
||||||
: "${storage_keypair_path:=$SOLANA_CONFIG_DIR/validator-storage-keypair$label.json}"
|
|
||||||
[[ -r "$storage_keypair_path" ]] || $solana_keygen new -o "$storage_keypair_path"
|
|
||||||
|
|
||||||
stake_keypair_path=$SOLANA_CONFIG_DIR/validator-stake-keypair$label.json
|
|
||||||
[[ -r "$stake_keypair_path" ]] || $solana_keygen new -o "$stake_keypair_path"
|
|
||||||
|
|
||||||
ledger_config_dir=$SOLANA_CONFIG_DIR/validator-ledger$label
|
|
||||||
state_dir="$SOLANA_CONFIG_DIR"/validator-state$label
|
|
||||||
configured_flag=$SOLANA_CONFIG_DIR/validator$label.configured
|
|
||||||
|
|
||||||
default_arg --entrypoint "$entrypoint_address"
|
|
||||||
if ((airdrops_enabled)); then
|
|
||||||
default_arg --rpc-drone-address "${entrypoint_address%:*}:9900"
|
|
||||||
fi
|
|
||||||
|
|
||||||
rsync_entrypoint_url=$(rsync_url "$entrypoint")
|
|
||||||
|
|
||||||
identity_pubkey=$($solana_keygen pubkey "$identity_keypair_path")
|
|
||||||
export SOLANA_METRICS_HOST_ID="$identity_pubkey"
|
|
||||||
|
|
||||||
accounts_config_dir="$state_dir"/accounts
|
|
||||||
snapshot_config_dir="$state_dir"/snapshots
|
|
||||||
|
|
||||||
default_arg --identity "$identity_keypair_path"
|
|
||||||
default_arg --voting-keypair "$voting_keypair_path"
|
|
||||||
default_arg --storage-keypair "$storage_keypair_path"
|
|
||||||
default_arg --ledger "$ledger_config_dir"
|
|
||||||
default_arg --accounts "$accounts_config_dir"
|
|
||||||
default_arg --snapshot-path "$snapshot_config_dir"
|
|
||||||
|
|
||||||
if [[ -n $SOLANA_CUDA ]]; then
|
|
||||||
program=$solana_validator_cuda
|
|
||||||
else
|
|
||||||
program=$solana_validator
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -z $CI ]]; then # Skip in CI
|
|
||||||
# shellcheck source=scripts/tune-system.sh
|
|
||||||
source "$here"/../scripts/tune-system.sh
|
|
||||||
fi
|
|
||||||
|
|
||||||
new_genesis_block() {
|
|
||||||
(
|
|
||||||
set -x
|
|
||||||
$rsync -r "${rsync_entrypoint_url:?}"/config/ledger "$SOLANA_RSYNC_CONFIG_DIR"
|
|
||||||
) || (
|
|
||||||
echo "Error: failed to rsync genesis ledger"
|
|
||||||
)
|
|
||||||
|
|
||||||
! diff -q "$SOLANA_RSYNC_CONFIG_DIR"/ledger/genesis.bin "$ledger_config_dir"/genesis.bin >/dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
set -e
|
|
||||||
PS4="$(basename "$0"): "
|
|
||||||
|
|
||||||
pid=
|
|
||||||
kill_fullnode() {
|
|
||||||
# Note: do not echo anything from this function to ensure $pid is actually
|
|
||||||
# killed when stdout/stderr are redirected
|
|
||||||
set +ex
|
|
||||||
if [[ -n $pid ]]; then
|
|
||||||
declare _pid=$pid
|
|
||||||
pid=
|
|
||||||
kill "$_pid" || true
|
|
||||||
wait "$_pid" || true
|
|
||||||
fi
|
|
||||||
exit
|
|
||||||
}
|
|
||||||
trap 'kill_fullnode' INT TERM ERR
|
|
||||||
|
|
||||||
if ((reset_ledger)); then
|
|
||||||
echo "Resetting ledger..."
|
|
||||||
(
|
|
||||||
set -x
|
|
||||||
rm -rf "$state_dir"
|
|
||||||
rm -rf "$ledger_config_dir"
|
|
||||||
)
|
|
||||||
if [[ -d "$SOLANA_RSYNC_CONFIG_DIR"/ledger/ ]]; then
|
|
||||||
cp -a "$SOLANA_RSYNC_CONFIG_DIR"/ledger/ "$ledger_config_dir"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
while true; do
|
|
||||||
if new_genesis_block; then
|
|
||||||
# If the genesis block has changed remove the now stale ledger and start all
|
|
||||||
# over again
|
|
||||||
(
|
|
||||||
set -x
|
|
||||||
rm -rf "$ledger_config_dir" "$state_dir" "$configured_flag"
|
|
||||||
)
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -d "$ledger_config_dir" ]]; then
|
|
||||||
(
|
|
||||||
cd "$SOLANA_RSYNC_CONFIG_DIR"
|
|
||||||
|
|
||||||
echo "Rsyncing genesis ledger from ${rsync_entrypoint_url:?}..."
|
|
||||||
SECONDS=
|
|
||||||
while ! $rsync -Pr "${rsync_entrypoint_url:?}"/config/ledger .; do
|
|
||||||
echo "Genesis ledger rsync failed"
|
|
||||||
sleep 5
|
|
||||||
done
|
|
||||||
echo "Fetched genesis ledger in $SECONDS seconds"
|
|
||||||
|
|
||||||
if ((boot_from_snapshot)); then
|
|
||||||
SECONDS=
|
|
||||||
echo "Rsyncing state snapshot ${rsync_entrypoint_url:?}..."
|
|
||||||
if ! $rsync -P "${rsync_entrypoint_url:?}"/config/state.tgz .; then
|
|
||||||
echo "State snapshot rsync failed"
|
|
||||||
rm -f "$SOLANA_RSYNC_CONFIG_DIR"/state.tgz
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
echo "Fetched snapshot in $SECONDS seconds"
|
|
||||||
|
|
||||||
SECONDS=
|
|
||||||
mkdir -p "$state_dir"
|
|
||||||
(
|
|
||||||
set -x
|
|
||||||
tar -C "$state_dir" -zxf "$SOLANA_RSYNC_CONFIG_DIR"/state.tgz
|
|
||||||
)
|
|
||||||
echo "Extracted snapshot in $SECONDS seconds"
|
|
||||||
fi
|
|
||||||
)
|
|
||||||
(
|
|
||||||
set -x
|
|
||||||
cp -a "$SOLANA_RSYNC_CONFIG_DIR"/ledger/ "$ledger_config_dir"
|
|
||||||
)
|
|
||||||
fi
|
|
||||||
|
|
||||||
vote_pubkey=$($solana_keygen pubkey "$voting_keypair_path")
|
|
||||||
stake_pubkey=$($solana_keygen pubkey "$stake_keypair_path")
|
|
||||||
storage_pubkey=$($solana_keygen pubkey "$storage_keypair_path")
|
|
||||||
|
|
||||||
if ((stake_lamports)); then
|
|
||||||
setup_validator_accounts "${entrypoint_address%:*}" \
|
|
||||||
"$node_lamports" \
|
|
||||||
"$stake_lamports"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cat <<EOF
|
|
||||||
======================[ validator configuration ]======================
|
|
||||||
identity pubkey: $identity_pubkey
|
|
||||||
vote pubkey: $vote_pubkey
|
|
||||||
stake pubkey: $stake_pubkey
|
|
||||||
storage pubkey: $storage_pubkey
|
|
||||||
ledger: $ledger_config_dir
|
|
||||||
accounts: $accounts_config_dir
|
|
||||||
snapshots: $snapshot_config_dir
|
|
||||||
========================================================================
|
|
||||||
EOF
|
|
||||||
|
|
||||||
echo "$PS4$program ${args[*]}"
|
|
||||||
|
|
||||||
$program "${args[@]}" &
|
|
||||||
pid=$!
|
|
||||||
echo "pid: $pid"
|
|
||||||
|
|
||||||
if ((no_restart)); then
|
|
||||||
wait "$pid"
|
|
||||||
exit $?
|
|
||||||
fi
|
|
||||||
|
|
||||||
secs_to_next_genesis_poll=5
|
|
||||||
secs_to_next_snapshot=30
|
|
||||||
while true; do
|
|
||||||
if [[ -z $pid ]] || ! kill -0 "$pid"; then
|
|
||||||
[[ -z $pid ]] || wait "$pid"
|
|
||||||
echo "############## validator exited, restarting ##############"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
|
|
||||||
sleep 1
|
|
||||||
|
|
||||||
if ((generate_snapshots && --secs_to_next_snapshot == 0)); then
|
|
||||||
(
|
|
||||||
SECONDS=
|
|
||||||
new_state_dir="$SOLANA_RSYNC_CONFIG_DIR"/new_state
|
|
||||||
new_state_archive="$SOLANA_RSYNC_CONFIG_DIR"/new_state.tgz
|
|
||||||
(
|
|
||||||
rm -rf "$new_state_dir" "$new_state_archive"
|
|
||||||
mkdir -p "$new_state_dir"
|
|
||||||
# When saving the state, its necessary to have the snapshots be saved first
|
|
||||||
# followed by the accounts folder. This would avoid conditions where incomplete
|
|
||||||
# accounts gets picked while its still in the process of being updated and are
|
|
||||||
# not frozen yet.
|
|
||||||
cp -a "$state_dir"/snapshots "$new_state_dir"
|
|
||||||
cp -a "$state_dir"/accounts "$new_state_dir"
|
|
||||||
cd "$new_state_dir"
|
|
||||||
tar zcfS "$new_state_archive" ./*
|
|
||||||
)
|
|
||||||
ln -f "$new_state_archive" "$SOLANA_RSYNC_CONFIG_DIR"/state.tgz
|
|
||||||
rm -rf "$new_state_dir" "$new_state_archive"
|
|
||||||
ls -hl "$SOLANA_RSYNC_CONFIG_DIR"/state.tgz
|
|
||||||
echo "Snapshot generated in $SECONDS seconds"
|
|
||||||
) || (
|
|
||||||
echo "Error: failed to generate snapshot"
|
|
||||||
)
|
|
||||||
secs_to_next_snapshot=60
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ((poll_for_new_genesis_block && --secs_to_next_genesis_poll == 0)); then
|
|
||||||
echo "Polling for new genesis block..."
|
|
||||||
if new_genesis_block; then
|
|
||||||
echo "############## New genesis detected, restarting ##############"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
secs_to_next_genesis_poll=60
|
|
||||||
fi
|
|
||||||
|
|
||||||
done
|
|
||||||
|
|
||||||
kill_fullnode
|
|
||||||
# give the cluster time to come back up
|
|
||||||
(
|
|
||||||
set -x
|
|
||||||
sleep 60
|
|
||||||
)
|
|
||||||
done
|
|
|
@ -53,7 +53,7 @@ while [[ -n $1 ]]; do
|
||||||
done
|
done
|
||||||
|
|
||||||
: "${identity_keypair:="$SOLANA_ROOT"/farf/replicator-identity-keypair"$label".json}"
|
: "${identity_keypair:="$SOLANA_ROOT"/farf/replicator-identity-keypair"$label".json}"
|
||||||
: "${storage_keypair:="$SOLANA_ROOT"/farf/storage-keypair"$label".json}"
|
: "${storage_keypair:="$SOLANA_ROOT"/farf/replicator-storage-keypair"$label".json}"
|
||||||
ledger="$SOLANA_ROOT"/farf/replicator-ledger"$label"
|
ledger="$SOLANA_ROOT"/farf/replicator-ledger"$label"
|
||||||
|
|
||||||
rpc_url=$("$here"/rpc-url.sh "$entrypoint")
|
rpc_url=$("$here"/rpc-url.sh "$entrypoint")
|
||||||
|
|
|
@ -10,17 +10,19 @@ set -e
|
||||||
|
|
||||||
# Create genesis ledger
|
# Create genesis ledger
|
||||||
$solana_keygen new -o "$SOLANA_CONFIG_DIR"/mint-keypair.json
|
$solana_keygen new -o "$SOLANA_CONFIG_DIR"/mint-keypair.json
|
||||||
$solana_keygen new -o "$SOLANA_CONFIG_DIR"/bootstrap-leader-keypair.json
|
|
||||||
$solana_keygen new -o "$SOLANA_CONFIG_DIR"/bootstrap-leader-vote-keypair.json
|
mkdir "$SOLANA_CONFIG_DIR"/bootstrap-leader
|
||||||
$solana_keygen new -o "$SOLANA_CONFIG_DIR"/bootstrap-leader-stake-keypair.json
|
$solana_keygen new -o "$SOLANA_CONFIG_DIR"/bootstrap-leader/identity-keypair.json
|
||||||
$solana_keygen new -o "$SOLANA_CONFIG_DIR"/bootstrap-leader-storage-keypair.json
|
$solana_keygen new -o "$SOLANA_CONFIG_DIR"/bootstrap-leader/vote-keypair.json
|
||||||
|
$solana_keygen new -o "$SOLANA_CONFIG_DIR"/bootstrap-leader/stake-keypair.json
|
||||||
|
$solana_keygen new -o "$SOLANA_CONFIG_DIR"/bootstrap-leader/storage-keypair.json
|
||||||
|
|
||||||
args=("$@")
|
args=("$@")
|
||||||
default_arg --bootstrap-leader-keypair "$SOLANA_CONFIG_DIR"/bootstrap-leader-keypair.json
|
default_arg --bootstrap-leader-keypair "$SOLANA_CONFIG_DIR"/bootstrap-leader/identity-keypair.json
|
||||||
default_arg --bootstrap-vote-keypair "$SOLANA_CONFIG_DIR"/bootstrap-leader-vote-keypair.json
|
default_arg --bootstrap-vote-keypair "$SOLANA_CONFIG_DIR"/bootstrap-leader/vote-keypair.json
|
||||||
default_arg --bootstrap-stake-keypair "$SOLANA_CONFIG_DIR"/bootstrap-leader-stake-keypair.json
|
default_arg --bootstrap-stake-keypair "$SOLANA_CONFIG_DIR"/bootstrap-leader/stake-keypair.json
|
||||||
default_arg --bootstrap-storage-keypair "$SOLANA_CONFIG_DIR"/bootstrap-leader-storage-keypair.json
|
default_arg --bootstrap-storage-keypair "$SOLANA_CONFIG_DIR"/bootstrap-leader/storage-keypair.json
|
||||||
default_arg --ledger "$SOLANA_RSYNC_CONFIG_DIR"/ledger
|
default_arg --ledger "$SOLANA_CONFIG_DIR"/bootstrap-leader/ledger
|
||||||
default_arg --mint "$SOLANA_CONFIG_DIR"/mint-keypair.json
|
default_arg --mint "$SOLANA_CONFIG_DIR"/mint-keypair.json
|
||||||
default_arg --lamports 100000000000000
|
default_arg --lamports 100000000000000
|
||||||
default_arg --bootstrap-leader-lamports 424242
|
default_arg --bootstrap-leader-lamports 424242
|
||||||
|
@ -29,5 +31,9 @@ default_arg --target-signatures-per-slot 42
|
||||||
default_arg --hashes-per-tick auto
|
default_arg --hashes-per-tick auto
|
||||||
$solana_genesis "${args[@]}"
|
$solana_genesis "${args[@]}"
|
||||||
|
|
||||||
test -d "$SOLANA_RSYNC_CONFIG_DIR"/ledger
|
test -d "$SOLANA_CONFIG_DIR"/bootstrap-leader/ledger
|
||||||
cp -a "$SOLANA_RSYNC_CONFIG_DIR"/ledger "$SOLANA_CONFIG_DIR"/bootstrap-leader-ledger
|
(
|
||||||
|
cd "$SOLANA_CONFIG_DIR"/bootstrap-leader/ledger
|
||||||
|
set -x
|
||||||
|
tar zcvfS genesis.tgz genesis.bin rocksdb
|
||||||
|
)
|
||||||
|
|
|
@ -1,4 +1,419 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Start a validator
|
||||||
|
#
|
||||||
here=$(dirname "$0")
|
here=$(dirname "$0")
|
||||||
exec "$here"/fullnode.sh "$@"
|
# shellcheck source=multinode-demo/common.sh
|
||||||
|
source "$here"/common.sh
|
||||||
|
|
||||||
|
fullnode_usage() {
|
||||||
|
if [[ -n $1 ]]; then
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
cat <<EOF
|
||||||
|
|
||||||
|
Fullnode Usage:
|
||||||
|
usage: $0 [--config-dir PATH] [--blockstream PATH] [--init-complete-file FILE] [--label LABEL] [--stake LAMPORTS] [--no-voting] [--rpc-port port] [cluster entry point hostname]
|
||||||
|
|
||||||
|
Start a validator
|
||||||
|
|
||||||
|
--config-dir PATH - store configuration and data files under this PATH
|
||||||
|
--blockstream PATH - open blockstream at this unix domain socket location
|
||||||
|
--init-complete-file FILE - create this file, if it doesn't already exist, once node initialization is complete
|
||||||
|
--label LABEL - Append the given label to the configuration files, useful when running
|
||||||
|
multiple fullnodes in the same workspace
|
||||||
|
--stake LAMPORTS - Number of lamports to stake
|
||||||
|
--node-lamports LAMPORTS - Number of lamports this node has been funded from the genesis block
|
||||||
|
--no-voting - start node without vote signer
|
||||||
|
--rpc-port port - custom RPC port for this node
|
||||||
|
--no-restart - do not restart the node if it exits
|
||||||
|
--no-airdrop - The genesis block has an account for the node. Airdrops are not required.
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
setup_validator_accounts() {
|
||||||
|
declare node_lamports=$1
|
||||||
|
declare stake_lamports=$2
|
||||||
|
|
||||||
|
if [[ -f $configured_flag ]]; then
|
||||||
|
echo "Vote and stake accounts have already been configured"
|
||||||
|
else
|
||||||
|
if ((airdrops_enabled)); then
|
||||||
|
echo "Fund the node with enough tokens to fund its Vote, Staking, and Storage accounts"
|
||||||
|
(
|
||||||
|
declare fees=100 # TODO: No hardcoded transaction fees, fetch the current cluster fees
|
||||||
|
set -x
|
||||||
|
$solana_wallet --keypair "$identity_keypair_path" --url "$rpc_url" \
|
||||||
|
airdrop $((node_lamports+stake_lamports+fees))
|
||||||
|
) || return $?
|
||||||
|
else
|
||||||
|
echo "current account balance is "
|
||||||
|
$solana_wallet --keypair "$identity_keypair_path" --url "$rpc_url" balance || return $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Fund the vote account from the node's identity pubkey"
|
||||||
|
(
|
||||||
|
set -x
|
||||||
|
$solana_wallet --keypair "$identity_keypair_path" --url "$rpc_url" \
|
||||||
|
create-vote-account "$vote_pubkey" "$identity_pubkey" 1 --commission 127
|
||||||
|
) || return $?
|
||||||
|
|
||||||
|
echo "Delegate the stake account to the node's vote account"
|
||||||
|
(
|
||||||
|
set -x
|
||||||
|
$solana_wallet --keypair "$identity_keypair_path" --url "$rpc_url" \
|
||||||
|
delegate-stake "$stake_keypair_path" "$vote_pubkey" "$stake_lamports"
|
||||||
|
) || return $?
|
||||||
|
|
||||||
|
echo "Create validator storage account"
|
||||||
|
(
|
||||||
|
set -x
|
||||||
|
$solana_wallet --keypair "$identity_keypair_path" --url "$rpc_url" \
|
||||||
|
create-validator-storage-account "$identity_pubkey" "$storage_pubkey"
|
||||||
|
) || return $?
|
||||||
|
|
||||||
|
touch "$configured_flag"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Identity account balance:"
|
||||||
|
(
|
||||||
|
set -x
|
||||||
|
$solana_wallet --keypair "$identity_keypair_path" --url "$rpc_url" balance
|
||||||
|
$solana_wallet --keypair "$identity_keypair_path" --url "$rpc_url" \
|
||||||
|
show-vote-account "$vote_pubkey"
|
||||||
|
$solana_wallet --keypair "$identity_keypair_path" --url "$rpc_url" \
|
||||||
|
show-stake-account "$stake_pubkey"
|
||||||
|
$solana_wallet --keypair "$identity_keypair_path" --url "$rpc_url" \
|
||||||
|
show-storage-account "$storage_pubkey"
|
||||||
|
)
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
args=()
|
||||||
|
node_lamports=424242 # number of lamports to assign the node for transaction fees
|
||||||
|
stake_lamports=42 # number of lamports to assign as stake
|
||||||
|
poll_for_new_genesis_block=0
|
||||||
|
label=
|
||||||
|
identity_keypair_path=
|
||||||
|
no_restart=0
|
||||||
|
airdrops_enabled=1
|
||||||
|
boot_from_snapshot=1
|
||||||
|
reset_ledger=0
|
||||||
|
config_dir=
|
||||||
|
|
||||||
|
positional_args=()
|
||||||
|
while [[ -n $1 ]]; do
|
||||||
|
if [[ ${1:0:1} = - ]]; then
|
||||||
|
if [[ $1 = --label ]]; then
|
||||||
|
label="-$2"
|
||||||
|
shift 2
|
||||||
|
elif [[ $1 = --no-restart ]]; then
|
||||||
|
no_restart=1
|
||||||
|
shift
|
||||||
|
elif [[ $1 = --no-snapshot ]]; then
|
||||||
|
boot_from_snapshot=0
|
||||||
|
shift
|
||||||
|
elif [[ $1 = --poll-for-new-genesis-block ]]; then
|
||||||
|
poll_for_new_genesis_block=1
|
||||||
|
shift
|
||||||
|
elif [[ $1 = --blockstream ]]; then
|
||||||
|
stake_lamports=0
|
||||||
|
args+=("$1" "$2")
|
||||||
|
shift 2
|
||||||
|
elif [[ $1 = --identity ]]; then
|
||||||
|
identity_keypair_path=$2
|
||||||
|
args+=("$1" "$2")
|
||||||
|
shift 2
|
||||||
|
elif [[ $1 = --voting-keypair ]]; then
|
||||||
|
voting_keypair_path=$2
|
||||||
|
args+=("$1" "$2")
|
||||||
|
shift 2
|
||||||
|
elif [[ $1 = --storage-keypair ]]; then
|
||||||
|
storage_keypair_path=$2
|
||||||
|
args+=("$1" "$2")
|
||||||
|
shift 2
|
||||||
|
elif [[ $1 = --enable-rpc-exit ]]; then
|
||||||
|
args+=("$1")
|
||||||
|
shift
|
||||||
|
elif [[ $1 = --init-complete-file ]]; then
|
||||||
|
args+=("$1" "$2")
|
||||||
|
shift 2
|
||||||
|
elif [[ $1 = --stake ]]; then
|
||||||
|
stake_lamports="$2"
|
||||||
|
shift 2
|
||||||
|
elif [[ $1 = --node-lamports ]]; then
|
||||||
|
node_lamports="$2"
|
||||||
|
shift 2
|
||||||
|
elif [[ $1 = --no-voting ]]; then
|
||||||
|
args+=("$1")
|
||||||
|
shift
|
||||||
|
elif [[ $1 = --skip-ledger-verify ]]; then
|
||||||
|
args+=("$1")
|
||||||
|
shift
|
||||||
|
elif [[ $1 = --no-sigverify ]]; then
|
||||||
|
args+=("$1")
|
||||||
|
shift
|
||||||
|
elif [[ $1 = --limit-ledger-size ]]; then
|
||||||
|
args+=("$1")
|
||||||
|
shift
|
||||||
|
elif [[ $1 = --rpc-port ]]; then
|
||||||
|
args+=("$1" "$2")
|
||||||
|
shift 2
|
||||||
|
elif [[ $1 = --dynamic-port-range ]]; then
|
||||||
|
args+=("$1" "$2")
|
||||||
|
shift 2
|
||||||
|
elif [[ $1 = --gossip-port ]]; then
|
||||||
|
args+=("$1" "$2")
|
||||||
|
shift 2
|
||||||
|
elif [[ $1 = --no-airdrop ]]; then
|
||||||
|
airdrops_enabled=0
|
||||||
|
shift
|
||||||
|
elif [[ $1 = --reset-ledger ]]; then
|
||||||
|
reset_ledger=1
|
||||||
|
shift
|
||||||
|
elif [[ $1 = --config-dir ]]; then
|
||||||
|
config_dir=$2
|
||||||
|
shift 2
|
||||||
|
elif [[ $1 = -h ]]; then
|
||||||
|
fullnode_usage "$@"
|
||||||
|
else
|
||||||
|
echo "Unknown argument: $1"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
positional_args+=("$1")
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ ${#positional_args[@]} -gt 1 ]]; then
|
||||||
|
fullnode_usage "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n $REQUIRE_CONFIG_DIR ]]; then
|
||||||
|
if [[ -z $config_dir ]]; then
|
||||||
|
fullnode_usage "Error: --config-dir not specified"
|
||||||
|
fi
|
||||||
|
SOLANA_CONFIG_DIR="$config_dir"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "$config_dir" ]]; then
|
||||||
|
config_dir="$SOLANA_CONFIG_DIR/validator$label"
|
||||||
|
fi
|
||||||
|
mkdir -p "$config_dir"
|
||||||
|
|
||||||
|
setup_secondary_mount
|
||||||
|
|
||||||
|
entrypoint_hostname=${positional_args[0]}
|
||||||
|
if [[ -z $entrypoint_hostname ]]; then
|
||||||
|
entrypoint_hostname=127.0.0.1
|
||||||
|
fi
|
||||||
|
gossip_entrypoint="$entrypoint_hostname":8001
|
||||||
|
rpc_url=$("$here"/rpc-url.sh "$gossip_entrypoint")
|
||||||
|
drone_address="$entrypoint_hostname":9900
|
||||||
|
|
||||||
|
: "${identity_keypair_path:=$config_dir/identity-keypair.json}"
|
||||||
|
[[ -r "$identity_keypair_path" ]] || $solana_keygen new -o "$identity_keypair_path"
|
||||||
|
|
||||||
|
: "${voting_keypair_path:=$config_dir/vote-keypair.json}"
|
||||||
|
[[ -r "$voting_keypair_path" ]] || $solana_keygen new -o "$voting_keypair_path"
|
||||||
|
|
||||||
|
: "${storage_keypair_path:=$config_dir/storage-keypair.json}"
|
||||||
|
[[ -r "$storage_keypair_path" ]] || $solana_keygen new -o "$storage_keypair_path"
|
||||||
|
|
||||||
|
stake_keypair_path=$config_dir/stake-keypair.json
|
||||||
|
[[ -r "$stake_keypair_path" ]] || $solana_keygen new -o "$stake_keypair_path"
|
||||||
|
|
||||||
|
ledger_config_dir=$config_dir/ledger
|
||||||
|
state_dir="$config_dir"/state
|
||||||
|
configured_flag=$config_dir/.configured
|
||||||
|
|
||||||
|
default_arg --entrypoint "$gossip_entrypoint"
|
||||||
|
if ((airdrops_enabled)); then
|
||||||
|
default_arg --rpc-drone-address "$drone_address"
|
||||||
|
fi
|
||||||
|
|
||||||
|
identity_pubkey=$($solana_keygen pubkey "$identity_keypair_path")
|
||||||
|
export SOLANA_METRICS_HOST_ID="$identity_pubkey"
|
||||||
|
|
||||||
|
accounts_config_dir="$state_dir"/accounts
|
||||||
|
snapshot_config_dir="$state_dir"/snapshots
|
||||||
|
|
||||||
|
default_arg --identity "$identity_keypair_path"
|
||||||
|
default_arg --voting-keypair "$voting_keypair_path"
|
||||||
|
default_arg --storage-keypair "$storage_keypair_path"
|
||||||
|
default_arg --ledger "$ledger_config_dir"
|
||||||
|
default_arg --accounts "$accounts_config_dir"
|
||||||
|
default_arg --snapshot-path "$snapshot_config_dir"
|
||||||
|
|
||||||
|
if [[ -n $SOLANA_CUDA ]]; then
|
||||||
|
program=$solana_validator_cuda
|
||||||
|
else
|
||||||
|
program=$solana_validator
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z $CI ]]; then # Skip in CI
|
||||||
|
# shellcheck source=scripts/tune-system.sh
|
||||||
|
source "$here"/../scripts/tune-system.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
new_genesis_block() {
|
||||||
|
if [[ ! -d "$ledger_config_dir" ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f "$ledger_config_dir"/new-genesis.tgz
|
||||||
|
(
|
||||||
|
set -x
|
||||||
|
curl -f "$rpc_url"/genesis.tgz -o "$ledger_config_dir"/new-genesis.tgz
|
||||||
|
) || {
|
||||||
|
echo "Error: failed to fetch new genesis ledger"
|
||||||
|
}
|
||||||
|
! diff -q "$ledger_config_dir"/new-genesis.tgz "$ledger_config_dir"/genesis.tgz >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
set -e
|
||||||
|
PS4="$(basename "$0"): "
|
||||||
|
|
||||||
|
pid=
|
||||||
|
kill_node() {
|
||||||
|
# Note: do not echo anything from this function to ensure $pid is actually
|
||||||
|
# killed when stdout/stderr are redirected
|
||||||
|
set +ex
|
||||||
|
if [[ -n $pid ]]; then
|
||||||
|
declare _pid=$pid
|
||||||
|
pid=
|
||||||
|
kill "$_pid" || true
|
||||||
|
wait "$_pid" || true
|
||||||
|
fi
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
kill_node_and_exit() {
|
||||||
|
kill_node
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
trap 'kill_node_and_exit' INT TERM ERR
|
||||||
|
|
||||||
|
if ((reset_ledger)); then
|
||||||
|
echo "Resetting ledger..."
|
||||||
|
(
|
||||||
|
set -x
|
||||||
|
rm -rf "$state_dir"
|
||||||
|
rm -rf "$ledger_config_dir"
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
if new_genesis_block; then
|
||||||
|
# If the genesis block has changed remove the now stale ledger and start all
|
||||||
|
# over again
|
||||||
|
(
|
||||||
|
set -x
|
||||||
|
rm -rf "$ledger_config_dir" "$state_dir" "$configured_flag"
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -f "$ledger_config_dir"/.ok ]]; then
|
||||||
|
echo "Fetching ledger from $rpc_url/genesis.tgz..."
|
||||||
|
SECONDS=
|
||||||
|
mkdir -p "$ledger_config_dir"
|
||||||
|
while ! curl -f "$rpc_url"/genesis.tgz -o "$ledger_config_dir"/genesis.tgz; do
|
||||||
|
echo "Genesis ledger fetch failed"
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
echo "Fetched genesis ledger in $SECONDS seconds"
|
||||||
|
|
||||||
|
(
|
||||||
|
set -x
|
||||||
|
cd "$ledger_config_dir"
|
||||||
|
tar -zxf genesis.tgz
|
||||||
|
touch .ok
|
||||||
|
)
|
||||||
|
|
||||||
|
(
|
||||||
|
if ((boot_from_snapshot)); then
|
||||||
|
SECONDS=
|
||||||
|
|
||||||
|
echo "Fetching state snapshot $rpc_url/snapshot.tgz..."
|
||||||
|
mkdir -p "$state_dir"
|
||||||
|
if ! curl -f "$rpc_url"/snapshot.tgz -o "$state_dir"/snapshot.tgz; then
|
||||||
|
echo "State snapshot fetch failed"
|
||||||
|
rm -f "$state_dir"/snapshot.tgz
|
||||||
|
exit 0 # None fatal
|
||||||
|
fi
|
||||||
|
echo "Fetched snapshot in $SECONDS seconds"
|
||||||
|
|
||||||
|
SECONDS=
|
||||||
|
(
|
||||||
|
set -x
|
||||||
|
cd "$state_dir"
|
||||||
|
tar -zxf snapshot.tgz
|
||||||
|
rm snapshot.tgz
|
||||||
|
)
|
||||||
|
echo "Extracted snapshot in $SECONDS seconds"
|
||||||
|
fi
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
|
vote_pubkey=$($solana_keygen pubkey "$voting_keypair_path")
|
||||||
|
stake_pubkey=$($solana_keygen pubkey "$stake_keypair_path")
|
||||||
|
storage_pubkey=$($solana_keygen pubkey "$storage_keypair_path")
|
||||||
|
|
||||||
|
if ((stake_lamports)); then
|
||||||
|
setup_validator_accounts "$node_lamports" "$stake_lamports"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
======================[ validator configuration ]======================
|
||||||
|
identity pubkey: $identity_pubkey
|
||||||
|
vote pubkey: $vote_pubkey
|
||||||
|
stake pubkey: $stake_pubkey
|
||||||
|
storage pubkey: $storage_pubkey
|
||||||
|
ledger: $ledger_config_dir
|
||||||
|
accounts: $accounts_config_dir
|
||||||
|
snapshots: $snapshot_config_dir
|
||||||
|
========================================================================
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo "$PS4$program ${args[*]}"
|
||||||
|
|
||||||
|
$program "${args[@]}" &
|
||||||
|
pid=$!
|
||||||
|
echo "pid: $pid"
|
||||||
|
|
||||||
|
if ((no_restart)); then
|
||||||
|
wait "$pid"
|
||||||
|
exit $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
secs_to_next_genesis_poll=5
|
||||||
|
while true; do
|
||||||
|
if [[ -z $pid ]] || ! kill -0 "$pid"; then
|
||||||
|
[[ -z $pid ]] || wait "$pid"
|
||||||
|
echo "############## validator exited, restarting ##############"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
if ((poll_for_new_genesis_block && --secs_to_next_genesis_poll == 0)); then
|
||||||
|
echo "Polling for new genesis block..."
|
||||||
|
if new_genesis_block; then
|
||||||
|
echo "############## New genesis detected, restarting ##############"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
secs_to_next_genesis_poll=5
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
kill_node
|
||||||
|
# give the cluster time to come back up
|
||||||
|
(
|
||||||
|
set -x
|
||||||
|
sleep 60
|
||||||
|
)
|
||||||
|
done
|
||||||
|
|
|
@ -128,8 +128,8 @@ Manage testnet instances
|
||||||
DNS name (useful only when the -a and -P options
|
DNS name (useful only when the -a and -P options
|
||||||
are also provided)
|
are also provided)
|
||||||
--fullnode-additional-disk-size-gb [number]
|
--fullnode-additional-disk-size-gb [number]
|
||||||
- Add an additional [number] GB SSD to all fullnodes to store the config-local directory.
|
- Add an additional [number] GB SSD to all fullnodes to store the config directory.
|
||||||
If not set, config-local will be written to the boot disk by default.
|
If not set, config will be written to the boot disk by default.
|
||||||
Only supported on GCE.
|
Only supported on GCE.
|
||||||
config-specific options:
|
config-specific options:
|
||||||
-P - Use public network IP addresses (default: $publicNetwork)
|
-P - Use public network IP addresses (default: $publicNetwork)
|
||||||
|
|
|
@ -35,5 +35,5 @@ PATH="$HOME"/.cargo/bin:"$PATH"
|
||||||
|
|
||||||
set -x
|
set -x
|
||||||
scripts/solana-install-deploy.sh \
|
scripts/solana-install-deploy.sh \
|
||||||
--keypair config-local/mint-keypair.json \
|
--keypair config/mint-keypair.json \
|
||||||
localhost "$releaseChannel" "$updatePlatform"
|
localhost "$releaseChannel" "$updatePlatform"
|
||||||
|
|
|
@ -83,12 +83,6 @@ local|tar|skip)
|
||||||
PATH="$HOME"/.cargo/bin:"$PATH"
|
PATH="$HOME"/.cargo/bin:"$PATH"
|
||||||
export USE_INSTALL=1
|
export USE_INSTALL=1
|
||||||
|
|
||||||
# Setup `/var/snap/solana/current` symlink so rsyncing the genesis
|
|
||||||
# ledger works (reference: `net/scripts/install-rsync.sh`)
|
|
||||||
sudo rm -rf /var/snap/solana/current
|
|
||||||
sudo mkdir -p /var/snap/solana
|
|
||||||
sudo ln -sT /home/solana/solana /var/snap/solana/current
|
|
||||||
|
|
||||||
./fetch-perf-libs.sh
|
./fetch-perf-libs.sh
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
source ./target/perf-libs/env.sh
|
source ./target/perf-libs/env.sh
|
||||||
|
@ -233,7 +227,7 @@ local|tar|skip)
|
||||||
# with it on the blockstreamer node. Typically the blockstreamer node has
|
# with it on the blockstreamer node. Typically the blockstreamer node has
|
||||||
# a static IP/DNS name for hosting the blockexplorer web app, and is
|
# a static IP/DNS name for hosting the blockexplorer web app, and is
|
||||||
# a location that somebody would expect to be able to airdrop from
|
# a location that somebody would expect to be able to airdrop from
|
||||||
scp "$entrypointIp":~/solana/config-local/mint-keypair.json config-local/
|
scp "$entrypointIp":~/solana/config/mint-keypair.json config/
|
||||||
if [[ $airdropsEnabled = true ]]; then
|
if [[ $airdropsEnabled = true ]]; then
|
||||||
./multinode-demo/drone.sh > drone.log 2>&1 &
|
./multinode-demo/drone.sh > drone.log 2>&1 &
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -82,8 +82,8 @@ local|tar|skip)
|
||||||
solana_keygen=solana-keygen
|
solana_keygen=solana-keygen
|
||||||
solana_ledger_tool=solana-ledger-tool
|
solana_ledger_tool=solana-ledger-tool
|
||||||
|
|
||||||
ledger=config-local/bootstrap-leader-ledger
|
ledger=config/bootstrap-leader/ledger
|
||||||
client_id=config-local/client-id.json
|
client_id=config/client-id.json
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unknown deployment method: $deployMethod"
|
echo "Unknown deployment method: $deployMethod"
|
||||||
|
|
|
@ -57,25 +57,6 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"PrefixListIds": [],
|
|
||||||
"FromPort": 873,
|
|
||||||
"IpRanges": [
|
|
||||||
{
|
|
||||||
"Description": "rsync",
|
|
||||||
"CidrIp": "0.0.0.0/0"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"ToPort": 873,
|
|
||||||
"IpProtocol": "tcp",
|
|
||||||
"UserIdGroupPairs": [],
|
|
||||||
"Ipv6Ranges": [
|
|
||||||
{
|
|
||||||
"CidrIpv6": "::/0",
|
|
||||||
"Description": "rsync"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"PrefixListIds": [],
|
"PrefixListIds": [],
|
||||||
"FromPort": 3001,
|
"FromPort": 3001,
|
||||||
|
|
|
@ -8,13 +8,3 @@ set -ex
|
||||||
[[ $USER = root ]] || exit 1
|
[[ $USER = root ]] || exit 1
|
||||||
|
|
||||||
apt-get --assume-yes install rsync
|
apt-get --assume-yes install rsync
|
||||||
cat > /etc/rsyncd.conf <<-EOF
|
|
||||||
[config]
|
|
||||||
path = /var/snap/solana/current/config
|
|
||||||
hosts allow = *
|
|
||||||
read only = true
|
|
||||||
EOF
|
|
||||||
|
|
||||||
systemctl enable rsync
|
|
||||||
systemctl start rsync
|
|
||||||
|
|
||||||
|
|
2
run.sh
2
run.sh
|
@ -37,7 +37,7 @@ done
|
||||||
|
|
||||||
export RUST_LOG=${RUST_LOG:-solana=info} # if RUST_LOG is unset, default to info
|
export RUST_LOG=${RUST_LOG:-solana=info} # if RUST_LOG is unset, default to info
|
||||||
export RUST_BACKTRACE=1
|
export RUST_BACKTRACE=1
|
||||||
dataDir=$PWD/config-local/"$(basename "$0" .sh)"
|
dataDir=$PWD/config/"$(basename "$0" .sh)"
|
||||||
ledgerDir=$PWD/config/ledger
|
ledgerDir=$PWD/config/ledger
|
||||||
|
|
||||||
set -x
|
set -x
|
||||||
|
|
Loading…
Reference in New Issue