Sync Chia Datalayer .dat files to an S3 bucket. This is useful to be able to serve your datalayer files over HTTP without exposing any ports to your system that runs Chia.
This is intended to run on a Linux server or any system with a Linux style Bash shell with systemd. Example commands assume a Debian-based distro such as Ubuntu, but the general script should run on any distro.
- Copy this repo to the machine running Chia Datalayer (
git clone https://github.com/TheLastCicada/Chia-Datalayer-S3-Sync.git && cd Chia-Datalayer-S3-Sync
) - Create an AWS bucket
- Give yourself access to write to the bucket. An instance profile is recommended if hosting Chia on EC2
- Install the official AWS CLI tool
- Install ionotify-tools
apt install inotify-tools
- Edit line 27 in datalayer-s3-sync and replace
/home/zachary/.chia/mainnet/data_layer/db/server_files_location_testnet10
with the path to your datalayer .dat files (will be similar except the partzachary
will be your username and thetestnet10
part will the the network you are using, such asmainnet
ortestneta
). Also replaces3://mydatalayer1
with the S3 address of the bucket you created in step 1. - Edit line 28 in datalayer-s3-sync and replace with the path to your datalayer .dat files (should be the same directory as in step 6).
- Move
datalayer-s3-sync
to/usr/local/bin/datalayer-s3-sync
(sudo mv ./datalayer-s3-sync /usr/local/bin/datalayer-s3-sync
)\ - Make
datalayer-s3-sync
executable for all users withsudo chmod +x /usr/local/bin/datalayer-s3-sync
- Edit line 12 and 13 in datalayer-s3-sync.service and change the
User
andGroup
to be the username where Chia runs on your system. - Move
datalayer-s3-sync.service
to/etc/systemd/system/datalayer-s3-sync.service
(sudo mv ./datalayer-s3-sync.service /etc/systemd/system/datalayer-s3-sync.service
) - Reload systemd to recognize the new file with
sudo systemctl daemon-reload
- Start the sync process with
sudo systemctl start datalayer-s3-sync
- Set the sync process to start at boot with
sudo systemctl enable datalayer-s3-sync