add wallet backup to coin install

This commit is contained in:
Josh Harvey 2017-08-06 23:56:06 +03:00
parent a5592b612f
commit 71e354e9ff
5 changed files with 19 additions and 6 deletions

View file

@ -19,5 +19,6 @@ function setup (dataDir) {
function buildConfig () { function buildConfig () {
return `rpcuser=lamassuserver return `rpcuser=lamassuserver
rpcpassword=${common.randomPass()} rpcpassword=${common.randomPass()}
dbcache=500` dbcache=500
keypool=10000`
} }

View file

@ -1,6 +1,7 @@
const fs = require('fs') const fs = require('fs')
const path = require('path') const path = require('path')
const process = require('process') const process = require('process')
const os = require('os')
const makeDir = require('make-dir') const makeDir = require('make-dir')
const inquirer = require('inquirer') const inquirer = require('inquirer')
@ -55,6 +56,12 @@ function processCryptos (codes) {
const selectedCryptos = _.map(code => _.find(['code', code], cryptos), codes) const selectedCryptos = _.map(code => _.find(['code', code], cryptos), codes)
_.forEach(setupCrypto, selectedCryptos) _.forEach(setupCrypto, selectedCryptos)
common.es('sudo service supervisor restart') common.es('sudo service supervisor restart')
const blockchainDir = coinUtils.blockchainDir()
const backupDir = path.resolve(os.homedir(), 'backups')
const rsyncCmd = `echo "@daily rsync -r --prune-empty-dirs --include='*/' --include='wallet.dat' --exclude='*' ${blockchainDir} ${backupDir} > /dev/null" | crontab -`
common.es(rsyncCmd)
logger.info('Installation complete.') logger.info('Installation complete.')
} }

View file

@ -29,5 +29,6 @@ function buildConfig () {
addnode=mainnet.z.cash addnode=mainnet.z.cash
rpcuser=lamassuserver rpcuser=lamassuserver
rpcpassword=${common.randomPass()} rpcpassword=${common.randomPass()}
dbcache=500` dbcache=500
keypool=10000`
} }

View file

@ -52,7 +52,7 @@ const CRYPTO_CURRENCIES = [
} }
] ]
module.exports = {buildUrl, cryptoDir, configPath, cryptoCurrencies, getCryptoCurrency} module.exports = {buildUrl, cryptoDir, blockchainDir, configPath, cryptoCurrencies, getCryptoCurrency}
function getCryptoCurrency (cryptoCode) { function getCryptoCurrency (cryptoCode) {
const cryptoCurrency = _.find(['cryptoCode', cryptoCode], CRYPTO_CURRENCIES) const cryptoCurrency = _.find(['cryptoCode', cryptoCode], CRYPTO_CURRENCIES)
@ -75,10 +75,13 @@ function buildUrl (cryptoCode, address) {
} }
} }
function blockchainDir () {
return options.blockchainDir
}
function cryptoDir (cryptoRec) { function cryptoDir (cryptoRec) {
const code = cryptoRec.code const code = cryptoRec.code
const blockchainDir = options.blockchainDir return path.resolve(blockchainDir(), code)
return path.resolve(blockchainDir, code)
} }
function configPath (cryptoRec) { function configPath (cryptoRec) {

View file

@ -68,7 +68,8 @@
"lamassu-mnemonic": "./bin/lamassu-mnemonic", "lamassu-mnemonic": "./bin/lamassu-mnemonic",
"lamassu-cancel": "./bin/lamassu-cancel", "lamassu-cancel": "./bin/lamassu-cancel",
"lamassu-nuke-db": "./bin/lamassu-nuke-db", "lamassu-nuke-db": "./bin/lamassu-nuke-db",
"lamassu-coins": "./bin/lamassu-coins" "lamassu-coins": "./bin/lamassu-coins",
"lamassu-backup-wallet": "./bin/lamassu-backup-wallet"
}, },
"scripts": { "scripts": {
"start": "node bin/lamassu-server", "start": "node bin/lamassu-server",