mirror of
https://github.com/aljazceru/cyphernode.git
synced 2026-01-05 05:55:43 +01:00
Create default wallets
This commit is contained in:
2
build.sh
2
build.sh
@@ -11,7 +11,7 @@ NOTIFIER_VERSION="v0.6.0-dev-local"
|
||||
PROXYCRON_VERSION="v0.6.0-dev-local"
|
||||
OTSCLIENT_VERSION="v0.6.0-dev-local"
|
||||
PYCOIN_VERSION="v0.6.0-dev-local"
|
||||
BITCOIN_VERSION="v0.20.1"
|
||||
BITCOIN_VERSION="v0.21.0"
|
||||
LIGHTNING_VERSION="v0.9.1"
|
||||
|
||||
trace()
|
||||
|
||||
@@ -104,6 +104,6 @@ module.exports = {
|
||||
return 'VAR0=VALUE0\nVAR1=VALUE1'
|
||||
},
|
||||
templates: function( props ) {
|
||||
return ['bitcoin.conf', 'bitcoin-client.conf']
|
||||
return ['bitcoin.conf', 'bitcoin-client.conf', 'entrypoint.sh', 'createWallets.sh'];
|
||||
}
|
||||
};
|
||||
@@ -6,7 +6,7 @@ export DEFAULT_CERT_HOSTNAME=disk0book.local
|
||||
export PROXYCRON_VERSION=v0.6.0-dev
|
||||
export PYCOIN_VERSION=v0.6.0-dev
|
||||
export SETUP_VERSION=v0.6.0-dev
|
||||
export BITCOIN_VERSION=v0.20.1
|
||||
export BITCOIN_VERSION=v0.21.0
|
||||
export LIGHTNING_VERSION=v0.9.1
|
||||
export DEFAULT_DATADIR_BASE=$HOME
|
||||
export GATEKEEPER_VERSION=v0.6.0-dev
|
||||
|
||||
34
cyphernodeconf_docker/templates/bitcoin/createWallets.sh
Executable file
34
cyphernodeconf_docker/templates/bitcoin/createWallets.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
|
||||
BITCOIN_CLI='bitcoin-cli'
|
||||
|
||||
<% if( net === 'regtest' ) { %>
|
||||
BITCOIN_CLI="$BITCOIN_CLI -regtest"
|
||||
<% } %>
|
||||
|
||||
while [ true ];
|
||||
do
|
||||
sleep 5;
|
||||
echo "CYPHERNODE: bitcoind is starting"
|
||||
${BITCOIN_CLI} echo && touch /container_monitor/bitcoin_ready && break || rm -f /container_monitor/bitcoin_ready
|
||||
done
|
||||
|
||||
echo "CYPHERNODE: bitcoind is ready"
|
||||
|
||||
# Check for the basic wallets. If not present, create.
|
||||
BASIC_WALLETS='"watching01.dat" "xpubwatching01.dat" "spending01.dat"'
|
||||
|
||||
CURRENT_WALLETS=`$BITCOIN_CLI listwallets`
|
||||
|
||||
for wallet in $BASIC_WALLETS
|
||||
do
|
||||
echo "CYPHERNODE: Checking wallet [$wallet]"
|
||||
echo "$CURRENT_WALLETS" | grep -F $wallet > /dev/null 2>&1
|
||||
|
||||
if [ "$?" -ne "0" ]; then
|
||||
walletNameNoQuote=`echo $wallet | tr -d '"'`
|
||||
$BITCOIN_CLI createwallet ${walletNameNoQuote} && echo "CYPHERNODE: new wallet created : [$walletNameNoQuote]"
|
||||
else
|
||||
echo "CYPHERNODE: Wallet [$wallet] found"
|
||||
fi
|
||||
done
|
||||
7
cyphernodeconf_docker/templates/bitcoin/entrypoint.sh
Executable file
7
cyphernodeconf_docker/templates/bitcoin/entrypoint.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
rm -f /container_monitor/bitcoin_ready
|
||||
|
||||
/.bitcoin/createWallets.sh &
|
||||
|
||||
exec bitcoind
|
||||
@@ -73,17 +73,15 @@ services:
|
||||
|
||||
bitcoin:
|
||||
image: cyphernode/bitcoin:<%= bitcoin_version %>
|
||||
<% if ( features.indexOf('tor') !== -1 && torifyables && torifyables.indexOf('tor_bitcoin') !== -1 ) { %>
|
||||
command: $USER sh -c 'rm -f /container_monitor/bitcoin_ready ; while [ ! -f "/container_monitor/tor_ready" ]; do echo "tor not ready" ; sleep 10 ; done ; echo "tor ready" ; bitcoind'
|
||||
<% } else { %>
|
||||
command: $USER sh -c 'rm -f /container_monitor/bitcoin_ready ; bitcoind'
|
||||
<% } %>
|
||||
command: $USER /.bitcoin/entrypoint.sh
|
||||
<% if( bitcoin_expose ) { %>
|
||||
ports:
|
||||
- "<%= (net === 'regtest') ? '18444:18444' : ((net === 'testnet') ? '18333:18333' : '8333:8333') %>"
|
||||
<% } %>
|
||||
volumes:
|
||||
- "<%= bitcoin_datapath %>:/.bitcoin"
|
||||
- "<%= bitcoin_datapath %>/entrypoint.sh:/.bitcoin/entrypoint.sh:ro"
|
||||
- "<%= bitcoin_datapath %>/createWallets.sh:/.bitcoin/createWallets.sh:ro"
|
||||
- container_monitor:/container_monitor
|
||||
healthcheck:
|
||||
test: chown $USER /container_monitor && su-exec $USER sh -c 'bitcoin-cli echo && touch /container_monitor/bitcoin_ready || rm -f /container_monitor/bitcoin_ready'
|
||||
|
||||
@@ -16,6 +16,6 @@ echo "tor ready at IP ${TORIP}"
|
||||
lightningd --proxy=$TORIP:9050
|
||||
<% } else { %>
|
||||
|
||||
lightningd
|
||||
exec lightningd
|
||||
|
||||
<% } %>
|
||||
|
||||
17
dist/setup.sh
vendored
17
dist/setup.sh
vendored
@@ -506,6 +506,20 @@ install_docker() {
|
||||
copy_file $cyphernodeconf_filepath/bitcoin/bitcoin-client.conf $BITCOIN_DATAPATH/bitcoin-client.conf 1 $SUDO_REQUIRED
|
||||
fi
|
||||
fi
|
||||
|
||||
copy_file $cyphernodeconf_filepath/bitcoin/entrypoint.sh $BITCOIN_DATAPATH/entrypoint.sh 1 $SUDO_REQUIRED
|
||||
copy_file $cyphernodeconf_filepath/bitcoin/createWallets.sh $BITCOIN_DATAPATH/createWallets.sh 1 $SUDO_REQUIRED
|
||||
|
||||
if [[ ! -x $BITCOIN_DATAPATH/entrypoint.sh ]]; then
|
||||
step " [32mmake[0m entrypoint.sh executable"
|
||||
sudo_if_required chmod +x $BITCOIN_DATAPATH/entrypoint.sh
|
||||
next
|
||||
fi
|
||||
if [[ ! -x $BITCOIN_DATAPATH/createWallets.sh ]]; then
|
||||
step " [32mmake[0m createWallets.sh executable"
|
||||
sudo_if_required chmod +x $BITCOIN_DATAPATH/createWallets.sh
|
||||
next
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $FEATURE_LIGHTNING == true ]]; then
|
||||
@@ -529,7 +543,6 @@ install_docker() {
|
||||
sudo_if_required chmod +x $LIGHTNING_DATAPATH/bitcoin/entrypoint.sh
|
||||
next
|
||||
fi
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -838,7 +851,7 @@ PROXYCRON_VERSION="v0.6.0-dev"
|
||||
OTSCLIENT_VERSION="v0.6.0-dev"
|
||||
PYCOIN_VERSION="v0.6.0-dev"
|
||||
CYPHERAPPS_VERSION="dev"
|
||||
BITCOIN_VERSION="v0.20.1"
|
||||
BITCOIN_VERSION="v0.21.0"
|
||||
LIGHTNING_VERSION="v0.9.1"
|
||||
TRAEFIK_VERSION="v1.7.9-alpine"
|
||||
MOSQUITTO_VERSION="1.6"
|
||||
|
||||
Reference in New Issue
Block a user