1 Wallet Server notes
Alex Grin edited this page 2021-10-22 10:37:13 -04:00

Snapshot Create/Deploy/Revert

To make a new snapshot:

  1. turn the wallet server being cloned off with docker-compose down
  2. copy the volume sudo cp -r /var/lib/docker/volumes/${USER}_wallet_server/_data/ /home/${USER}/snapshot
  3. update the permissions sudo chown -R ${USER}:${USER} snapshot

Deploying a volume snapshot:

  1. 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 be lbry and HOST would be a server like spv13.lbry.com
  2. ssh into the target server and run ls snapshot to verify it received in the right place, you should see blocks files, claims.db, tx, utxo, etc.
  3. 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 by root:root and it contains _data , which is owned by netdata:netdata
  4. update the permissions on the new snapshot sudo chown -R netdata:netdata snapshot
  5. turn the wallet server off with docker-compose down
  6. back up the existing volume instead of deleting it, sudo mv /var/lib/docker/volumes/${USER}_wallet_server/_data volume_backup
  7. move the prepared snapshot into place sudo mv snapshot /var/lib/docker/volumes/lbry_wallet_server/_data
  8. double check the permissions on the resulting voiume: sudo ls -lah /var/lib/docker/volumes/${USER}_wallet_server/ you should see _data owned by netdata:netdata like before
  9. start the wallet server docker-compose up -d
  10. 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

  1. set the permissions on the backup sudo chown -R netdata:netdata volume_backup
  2. turn the wallet server off with docker-compose down
  3. back up the existing volume instead of deleting it, sudo mv /var/lib/docker/volumes/${USER}_wallet_server/_data volume_backup2
  4. move the prepared snapshot into place sudo mv volume_backup /var/lib/docker/volumes/${USER}_wallet_server/_data
  5. double check the permissions on the resulting voiume: sudo ls -lah /var/lib/docker/volumes/${USER}_wallet_server/ you should see _data owned by netdata:netdata like before
  6. start the wallet server docker-compose up -d
  7. watch the log tail until it starts successfully, indicated by ips showing in the logs as users connect docker-compose logs -f --tail 100

Swap wallet server to use systemd instead of docker for lbrycrd

  1. Stop the containers: docker-compose down
  2. 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
  1. 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
  1. Create the lbrycrd config file nano ~/.lbrycrd/lbrycrd.conf
txindex=1
server=1
daemon=1
rpcuser=lbry
rpcpassword=lbry
  1. 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
  1. Enable and start the lbrycrd service
sudo systemctl enable lbrycrd
sudo systemctl start lbrycrd
  1. 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:lbry@127.0.0.1:9245
  1. Start the wallet server docker-compose up -d