Skip to content

bql20000/offline_cntools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OFFLINE CNTOOLS

Helper scripts with docker support to enable hybrid mode of CNTools, ensure that private keys will never stay on hot node.

Setup - RUN IN TERMINAL

  1. Copy config example files and edit correctly
cp .env.example .env
cp samples/config.example samples/config

2a. Run cnode docker container

docker-compose run --name cnode cnode

2b. To get into container if it's already running

docker exec -it cnode bash
  1. Copy private key to ssh to core node
docker cp <path to private key> cnode:/home/guild/.ssh/id_rsa

Example:

docker cp ~/.ssh/google_compute_engine cnode:/home/guild/.ssh/id_rsa

Setup - RUN IN DOCKER CONTAINER

  1. Install needed packages
sudo apt-get update &&
sudo apt-get install -y rsync grsync openssh-client vim dialog bsdmainutils
  1. Make sure to have necessary permissions for custom files
sudo chown guild ~/.ssh/*
sudo chown -R guild $CNODE_HOME
sudo chmod +x $CNODE_HOME/scripts/*
sudo chmod +x ~/scripts/*
  1. Redirect to cnode home
cd $CNODE_HOME
  1. (Optional, testnet only) Since the image some how cannot regconise correct network, we need to download files from servers
sudo rm -r files/
~/scripts/get_config_files.sh

Usage - SCRIPT EXPLAIN

Scripts run on host

  1. Notes
  • Please execute scripts at repo root directory. (not inside scripts/ folder)
  1. Backup priv/ folder using CNTools
  • Execute backup function in Container's CNTools
  • Make sure CONTAINER_NAME is set correctly
  • Execute scripts/backup_priv_cntools.sh <backup file name> to copy the file to backups/cntools
  1. Backup priv/folder mannually
  • Execute scripts/backup_priv_mannual.sh to copy the file to backups/mannual
  1. Store backups to Cloud Storage (GCP)
  • Beforehands, make sure to install gsutil and configured correctly. Also, set the BACKUP_BUCKET name correctly.
scripts/sync_backup_to_gcp.sh
  1. Restore mannual backup

Set the BACKUP_FILE and BACKUP_BUCKET correctly, then

scripts/restore_priv_mannual.sh
  1. Restore CNTools backup

To be added ...

Scripts run inside container

  1. Send/Receive tmp files to/from remote server (core node).
  • Notes: Transfer file at /tmp/cnode/cntools between local/remote
  • Send to remote:
~/scripts/send_tmp_file.sh <tmp file name>
  • Get file from remote:
~/scripts/get_tmp_file.sh <tmp file name>
  1. Send rotated files to remote:

First use CNTools to rotate necessary files. Then,

~/scripts/send_rotated_files.sh

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages