Helper scripts with docker support to enable hybrid mode of CNTools, ensure that private keys will never stay on hot node.
- 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
- 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
- Install needed packages
sudo apt-get update &&
sudo apt-get install -y rsync grsync openssh-client vim dialog bsdmainutils
- 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/*
- Redirect to cnode home
cd $CNODE_HOME
- (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
- Notes
- Please execute scripts at repo root directory. (not inside
scripts/
folder)
- 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 tobackups/cntools
- Backup
priv/
folder mannually
- Execute
scripts/backup_priv_mannual.sh
to copy the file tobackups/mannual
- 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
- Restore mannual backup
Set the BACKUP_FILE
and BACKUP_BUCKET
correctly, then
scripts/restore_priv_mannual.sh
- Restore CNTools backup
To be added ...
- 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>
- Send rotated files to remote:
First use CNTools to rotate necessary files. Then,
~/scripts/send_rotated_files.sh