-
Notifications
You must be signed in to change notification settings - Fork 483
Wallet Server notes
Alex Grin edited this page Oct 22, 2021
·
1 revision
To make a new snapshot:
- turn the wallet server being cloned off with
docker-compose down
- copy the volume
sudo cp -r /var/lib/docker/volumes/${USER}_wallet_server/_data/ /home/${USER}/snapshot
- update the permissions
sudo chown -R ${USER}:${USER} snapshot
Deploying a volume snapshot:
- from wherever you have the
snapshot
directory, rsync it to the target server:rsync -avP snapshot ${HOST_USER}@${HOST}:/home/${HOST_USER}/snapshot/
, HOST_USER would belbry
and HOST would be a server likespv13.lbry.com
- ssh into the target server and run
ls snapshot
to verify it received in the right place, you should seeblocks
files,claims.db
,tx
,utxo
, etc. - check the permissions on the existing volume with
sudo ls -lah /var/lib/docker/volumes/${USER}_wallet_server/
you should see the directory is owned byroot:root
and it contains_data
, which is owned bynetdata:netdata
- update the permissions on the new snapshot
sudo chown -R netdata:netdata snapshot
- turn the wallet server off with
docker-compose down
- back up the existing volume instead of deleting it,
sudo mv /var/lib/docker/volumes/${USER}_wallet_server/_data volume_backup
- move the prepared snapshot into place
sudo mv snapshot /var/lib/docker/volumes/lbry_wallet_server/_data
- double check the permissions on the resulting voiume:
sudo ls -lah /var/lib/docker/volumes/${USER}_wallet_server/
you should see_data
owned bynetdata:netdata
like before - start the wallet server
docker-compose up -d
- watch the log tail until it starts successfully, indicated by ips showing in the logs as users connect
docker-compose logs -f --tail 100
Restoring a backup volume
- set the permissions on the backup
sudo chown -R netdata:netdata volume_backup
- turn the wallet server off with
docker-compose down
- back up the existing volume instead of deleting it,
sudo mv /var/lib/docker/volumes/${USER}_wallet_server/_data volume_backup2
- move the prepared snapshot into place
sudo mv volume_backup /var/lib/docker/volumes/${USER}_wallet_server/_data
- double check the permissions on the resulting voiume:
sudo ls -lah /var/lib/docker/volumes/${USER}_wallet_server/
you should see_data
owned bynetdata:netdata
like before - start the wallet server
docker-compose up -d
- watch the log tail until it starts successfully, indicated by ips showing in the logs as users connect
docker-compose logs -f --tail 100
- Stop the containers:
docker-compose down
- Copy the lbrycrd volume contents out of docker:
sudo cp -r /var/lib/docker/volumes/lbry_lbrycrd/_data .
sudo chown -R lbry _data
sudo chgrp -R lbry _data
mv _data ~/.lbrycrd
docker volume rm lbry_lbrycrd
- Install lbrycrd to the expected location:
wget https://github.com/lbryio/lbrycrd/releases/download/v0.17.3.2/lbrycrd-linux-1732.zip
unzip -o lbrycrd-linux-1732.zip
sudo mkdir -p /opt/lbry
sudo mv lbrycrdd /opt/lbry
sudo mv lbrycrd-cli /opt/lbry
- Create the lbrycrd config file
nano ~/.lbrycrd/lbrycrd.conf
txindex=1
server=1
daemon=1
rpcuser=lbry
rpcpassword=lbry
- Create the service file
sudo nano /etc/systemd/system/lbrycrd.service
[Unit]
Description="LBRYcrd daemon"
After=network.target
[Service]
Environment="HOME=/home/lbry"
ExecStart=/opt/lbry/lbrycrdd
User=lbry
Group=lbry
Restart=on-failure
KillMode=process
[Install]
WantedBy=multi-user.target
- Enable and start the lbrycrd service
sudo systemctl enable lbrycrd
sudo systemctl start lbrycrd
- Replace
docker-compose.yml
with
version: "3"
volumes:
wallet_server:
services:
wallet_server:
network_mode: host
image: lbry/wallet-server:${WALLET_SERVER_TAG:-latest-release}
restart: always
ports:
- "2112:2112" # prometheus
- "50001:50001" # rpc port
- "50005:50005" # websocket port
volumes:
- "wallet_server:/database"
env_file: [/home/lbry/wallet-server-env]
environment:
- DAEMON_URL=http://lbry:[email protected]:9245
- Start the wallet server
docker-compose up -d