1.6 KiB
1.6 KiB
Setup blockchain backup from a node
-
connect to the node as
root
. -
clone this repository to
root
's home folder:
git clone https://github.com/poanetwork/poa-devops.git
-
make sure
python
(v2.6+ or v3.5+) is installed on the node. -
install
pip
and/or upgrade it to the newest version:
apt-get install python-pip
pip install --upgrade pip
- upgrade
setuptools
to the newest version:
pip install --upgrade setuptools
- install
boto
andboto3
packages:
pip install boto boto3
- install
ansible
:
pip install ansible
- create
group_vars/all
file:
cp group_vars/all.example group_vars/all
and set the following variables:
poa_role
- node's role (one ofbootnode
,validator
,moc
,explorer
,netstat
)access_key
- s3 access keysecret_key
- s3 secret keys3_bucket
- s3 bucket name
you can ignore other variables in this file
- create
hosts
file:
touch hosts
and set it to run backup
on localhost:
[backup]
localhost
- run playbook (still, do this on the node)
ansible-playbook -i hosts -c local site.yml
- if all is well, setup a cronjob to run every hour:
crontab -e
append the following line:
30 * * * * /bin/bash /root/poa-devops/bkp-blockchain-cron.sh
- configure logrotate to archive old log files. Create file
/etc/cron.hourly/poa-devops-logrotate
with the following content:
#!/bin/bash
/usr/sbin/logrotate /root/poa-devops/bkp-blockchain-logrotate.conf
and set permission to run it:
chmod 755 /etc/cron.hourly/poa-devops-logrotate