changes cherry picked from dev to stable (#169)
* lamassu-update to update crontab * lamassu update and install script to point to #stable branch * lamassu update and install script to point to #stable branch * removing outdated & unused script * crontab update fix + npm rebuild path fix
This commit is contained in:
parent
59cb5da61c
commit
9b7972017d
6 changed files with 15 additions and 304 deletions
|
|
@ -1,19 +0,0 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const HKDF = require('node-hkdf-sync')
|
||||
const wallet = require('lamassu-geth')
|
||||
const pify = require('pify')
|
||||
const fs = pify(require('fs'))
|
||||
|
||||
const options = require('../lib/options')
|
||||
|
||||
function computeSeed (masterSeed) {
|
||||
const hkdf = new HKDF('sha256', 'lamassu-server-salt', masterSeed)
|
||||
return hkdf.derive('wallet-seed', 32)
|
||||
}
|
||||
|
||||
fs.readFile(options.seedPath, 'utf8')
|
||||
.then(hex => {
|
||||
const masterSeed = Buffer.from(hex.trim(), 'hex')
|
||||
console.log(wallet.defaultAddress({seed: computeSeed(masterSeed)}))
|
||||
})
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
if [ "$(whoami)" != "root" ]; then
|
||||
echo -e "This script has to be run as \033[1mroot\033[0m user"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
export LOG_FILE=/tmp/install.log
|
||||
|
||||
ufw allow 8333/tcp >> $LOG_FILE 2>&1
|
||||
|
||||
CONFIG_DIR=$HOME/.bitcoin
|
||||
CONFIG=$CONFIG_DIR/bitcoin.conf
|
||||
mkdir -p $CONFIG_DIR
|
||||
PASS=$(openssl rand -hex 32)
|
||||
|
||||
cat > $CONFIG <<EOF
|
||||
server=1
|
||||
connections=40
|
||||
rpcuser=lamassu
|
||||
rpcpassword=$PASS
|
||||
keypool=10000
|
||||
prune=4000
|
||||
daemon=0
|
||||
EOF
|
||||
|
||||
pm2 start bitcoind >> $LOG_FILE 2>&1
|
||||
pm2 save >> $LOG_FILE 2>&1
|
||||
|
||||
echo "Success."
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
if [ "$(whoami)" != "root" ]; then
|
||||
echo -e "This script has to be run as \033[1mroot\033[0m user"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
echo "Activating geth (Ethereum server wallet)..."
|
||||
|
||||
export LOG_FILE=/tmp/install.log
|
||||
|
||||
SEEDS_DIR=$HOME/seeds
|
||||
SEED_FILE=$SEEDS_DIR/seed.txt
|
||||
SEED=$(cat $SEED_FILE)
|
||||
PASS_FILE=$SEEDS_DIR/geth.txt
|
||||
hkdf geth-pw $SEED > $PASS_FILE
|
||||
ACCOUNT_STR=$(geth --password $PASS_FILE account new)
|
||||
ACCOUNT=$(echo $ACCOUNT_STR | grep -o '{.*}' | tr -d '{}')
|
||||
|
||||
ufw allow 30303/tcp >> $LOG_FILE 2>&1 # Ethereum
|
||||
|
||||
SCRIPTS_DIR=$HOME/scripts
|
||||
mkdir -p $SCRIPTS_DIR
|
||||
GETH_SCRIPT=$SCRIPTS_DIR/geth.sh
|
||||
|
||||
# NOTE: We need to combine stderr with stdout because geth prints info to stderr
|
||||
echo "geth --fast --rpc --unlock $ACCOUNT --password $PASS_FILE 2>&1" > $GETH_SCRIPT
|
||||
|
||||
chmod 755 $GETH_SCRIPT
|
||||
pm2 start $GETH_SCRIPT >> $LOG_FILE 2>&1
|
||||
pm2 save >> $LOG_FILE 2>&1
|
||||
|
||||
echo "Success. Your main account is 0x$ACCOUNT."
|
||||
|
|
@ -35,10 +35,10 @@ n lts >> ${LOG_FILE} 2>&1
|
|||
decho "version installed $(node -v)"
|
||||
|
||||
decho "updating lamassu-server"
|
||||
npm -g install lamassu/lamassu-server#v5 --unsafe-perm >> ${LOG_FILE} 2>&1
|
||||
npm -g install lamassu/lamassu-server#stable --unsafe-perm >> ${LOG_FILE} 2>&1
|
||||
|
||||
decho "rebuilding npm deps"
|
||||
cd /usr/local/lib/node_modules/lamassu-server/ >> ${LOG_FILE} 2>&1
|
||||
cd $(npm root -g)/lamassu-server/ >> ${LOG_FILE} 2>&1
|
||||
npm rebuild >> ${LOG_FILE} 2>&1
|
||||
|
||||
decho "running migration"
|
||||
|
|
@ -54,4 +54,10 @@ decho "updating lamassu-server"
|
|||
supervisorctl update lamassu-server >> ${LOG_FILE} 2>&1
|
||||
supervisorctl update lamassu-admin-server >> ${LOG_FILE} 2>&1
|
||||
|
||||
echo "Update complete!"
|
||||
decho "updating backups conf"
|
||||
BACKUP_CMD=${NPM_BIN}/lamassu-backup-pg
|
||||
BACKUP_CRON="@daily $BACKUP_CMD > /dev/null"
|
||||
( (crontab -l 2>/dev/null || echo -n "") | grep -v '@daily.*lamassu-backup-pg'; echo $BACKUP_CRON ) | crontab - >> $LOG_FILE 2>&1
|
||||
$BACKUP_CMD >> $LOG_FILE 2>&1
|
||||
|
||||
decho "Update complete!"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue