diff --git a/ol/documentation/node_reset.md b/ol/documentation/node_reset.md new file mode 100644 index 0000000000..907278fd20 --- /dev/null +++ b/ol/documentation/node_reset.md @@ -0,0 +1,96 @@ +# 0L Configuration Jubilee + +## backup your files + +``` +cd ~ +rsync -av --exclude db/ ~/.0L ~/0L_backup_20210607 + +``` + +## Create a new user on host + +Especially important for those running as root. + +Make this a restricted user: do not give the user `sudo`. + +For a user with the name `val`: +``` + +sudo useradd -m val + +``` + +## Switch into new user + +``` +su val +``` + +## Add ~/bin to PATH + +`~/bin` will be where your binaries will live. You need to add this to the "search path" to execute commands easily. + +``` +# add to ./bashrc +PATH=~/bin:$PATH +``` + +Do this: https://unix.stackexchange.com/questions/26047/how-to-correctly-add-a-path-to-path + + +TODO: dboreham, tell us what to do. + + +### Add your ssh pubkey to the new user + +Include your public key in .ssh/authorized_key so you can access the user directly from ssh. + +``` +nano /home/val/.ssh/authorized_keys +``` + +alternatively copy the file from the /root/.ssh/authorized_keys + +``` +cp /root/.ssh/authorized_keys /home/val/.ssh/ + +``` + + +## Fetch latest code + +``` +git clone https://github.com/OLSF/libra.git --branch main --depth 1 --single-branch +``` + +## Build binaries +``` +cd libra +make bins install +``` + +## Create Autopay File + +For your autopay instructions to be preserved, an `autopay_batch.json` file should exist in your intended config folder (e.g. `~/.0L/autopay_batch.json`). + +Here's a blank example: https://github.com/LOL-LLC/donations-record/blob/main/clean.autopay_batch.json + +## Recreate config files + +Follow these instructions to refresh your node's configurations. This way they will be up to date with the configuration format that other validators have. + +Do this first: [Resetting Val Configs](resetting_val_configs.md) + + +## Restart your services as the new user + +Stop your node, miner, monitor and restart + +``` +# in previous user +ol mgmt --stop all + +# in new user +ol start +``` diff --git a/ol/documentation/resetting_val_configs.md b/ol/documentation/resetting_val_configs.md index 055f8f50b4..3a981cdc73 100644 --- a/ol/documentation/resetting_val_configs.md +++ b/ol/documentation/resetting_val_configs.md @@ -12,7 +12,7 @@ Ideally you will start from a fresh new user (not root) on your host. 2. Create all files needed for validator ``` -onboard --val --skip-mining --upstream-peer http://ip-address --from-source +onboard --val --skip-mining --upstream-peer http://ip-address --source-path path/to/libra/source ``` This command will prompt for a few configs, including what directory you will be storing configs for that account. It will also prompt for the IP address of the node. diff --git a/ol/onboard/src/commands/fix_cmd.rs b/ol/onboard/src/commands/fix_cmd.rs index 2a920f0692..f40a03585b 100644 --- a/ol/onboard/src/commands/fix_cmd.rs +++ b/ol/onboard/src/commands/fix_cmd.rs @@ -14,11 +14,15 @@ use ol_keys::wallet; use ol::config::AppCfg; use ol_types::pay_instruction::{InstructionType, PayInstruction, write_batch_file}; -/// `val-wizard` subcommand +/// `fix` subcommand #[derive(Command, Debug, Default, Options)] pub struct FixCmd { #[options(help = "waypoint to set")] waypoint: Option, + #[options(help = "migrate account json")] + account: bool, + #[options(help = "fix operator key")] + operator: bool, } impl Runnable for FixCmd { @@ -31,11 +35,14 @@ impl Runnable for FixCmd { // set the waypoint if let Some(w) = self.waypoint { key::set_waypoint(home_dir, namespace, w); - } - key::set_operator_key(home_dir, namespace); + if self.operator { + key::set_operator_key(home_dir, namespace); + } - migrate_account_json(&cfg); + if self.account { + migrate_account_json(&cfg); + } } } @@ -86,10 +93,12 @@ pub fn migrate_autopay_json_4_3_0(cfg: &AppCfg, instructions: Vec = instructions.into_iter() .map(|mut i| { if i.type_of == InstructionType::PercentOfChange { + i.uid = None; i.type_of = InstructionType::PercentOfBalance; i.type_move = None; i.value_move = None; i.duration_epochs = Some(1); + i.end_epoch = None; } i }) diff --git a/ol/onboard/src/commands/keygen_cmd.rs b/ol/onboard/src/commands/keygen_cmd.rs index 1a0834fd6e..4521445f1e 100644 --- a/ol/onboard/src/commands/keygen_cmd.rs +++ b/ol/onboard/src/commands/keygen_cmd.rs @@ -4,7 +4,7 @@ use abscissa_core::{Command, Options, Runnable}; use ol_keys::wallet; -/// `version` subcommand +/// `keygen` subcommand #[derive(Command, Debug, Default, Options)] pub struct KeygenCmd {} diff --git a/ol/onboard/src/commands/wizard_fn_cmd.rs b/ol/onboard/src/commands/wizard_fn_cmd.rs index 8f7b6c3e98..636cb39090 100644 --- a/ol/onboard/src/commands/wizard_fn_cmd.rs +++ b/ol/onboard/src/commands/wizard_fn_cmd.rs @@ -8,7 +8,7 @@ use libra_types::waypoint::Waypoint; use std::{path::PathBuf}; use super::{files_cmd}; use crate::{application::app_config}; -/// `val-wizard` subcommand +/// `fullnode wizard` subcommand #[derive(Command, Debug, Default, Options)] pub struct FnWizardCmd { #[options(help = "output path files created, defaults to ~/.0L")] diff --git a/ol/onboard/src/commands/wizard_user_cmd.rs b/ol/onboard/src/commands/wizard_user_cmd.rs index a17a4af119..b8d51f9cd4 100644 --- a/ol/onboard/src/commands/wizard_user_cmd.rs +++ b/ol/onboard/src/commands/wizard_user_cmd.rs @@ -9,7 +9,7 @@ use ol_types::config::AppCfg; use abscissa_core::{Command, Options, Runnable}; use std::{path::PathBuf}; use ol_types::account; -/// `user-wizard` subcommand +/// `user wizard` subcommand #[derive(Command, Debug, Default, Options)] pub struct UserWizardCmd { #[options(help = "path to write account manifest")] diff --git a/ol/onboard/src/commands/wizard_val_cmd.rs b/ol/onboard/src/commands/wizard_val_cmd.rs index beded12f41..79e9042fc4 100644 --- a/ol/onboard/src/commands/wizard_val_cmd.rs +++ b/ol/onboard/src/commands/wizard_val_cmd.rs @@ -20,7 +20,7 @@ use reqwest::Url; use std::process::exit; use std::{fs::File, io::Write, path::PathBuf}; use txs::{commands::autopay_batch_cmd, submit_tx}; -/// `val-wizard` subcommand +/// `validator wizard` subcommand #[derive(Command, Debug, Default, Options)] pub struct ValWizardCmd { #[options( diff --git a/ol/txs/src/commands/autopay_batch_cmd.rs b/ol/txs/src/commands/autopay_batch_cmd.rs index 3120e518ce..5f7ce30a10 100644 --- a/ol/txs/src/commands/autopay_batch_cmd.rs +++ b/ol/txs/src/commands/autopay_batch_cmd.rs @@ -61,12 +61,15 @@ pub fn process_instructions(instructions: Vec) -> Vec