From c17b0e9630ce1f157eca8cff7bff3e0852bb3b46 Mon Sep 17 00:00:00 2001 From: jash Date: Mon, 8 Oct 2018 19:51:17 +0200 Subject: [PATCH] added file copying so installation can be run with docker stack or docker-compose --- install/script/install_docker.sh | 47 ++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/install/script/install_docker.sh b/install/script/install_docker.sh index 5268ec2..82e0acb 100644 --- a/install/script/install_docker.sh +++ b/install/script/install_docker.sh @@ -2,7 +2,8 @@ install_docker() { - echo + local sourceDataPath=../data + local topLevel=../.. if [[ $BITCOIN_INTERAL == true || $FEATURE_LIGHTNING == true ]]; then trace "Updating SatoshiPortal repos" @@ -15,13 +16,35 @@ install_docker() { if [[ $BITCOIN_INTERNAL == true ]]; then build_docker_image ../SatoshiPortal/dockers/$arch/bitcoin-core cyphernode/bitcoin + if [ ! -d $BITCOIN_DATAPATH ]; then + trace "Creating $BITCOIN_DATAPATH" + mkdir -p $BITCOIN_DATAPATH + fi + + if [[ -f $BITCOIN_DATAPATH/bitcoin.conf ]]; then + trace "Creating backup of $BITCOIN_DATAPATH/bitcoin.conf" + cp $BITCOIN_DATAPATH/bitcoin.conf $BITCOIN_DATAPATH/bitcoin.conf-$(date +"%y-%m-%d-%T") + fi + + trace "Copying bitcoin core node config" + cp $sourceDataPath/bitcoin/bitcoin.conf $BITCOIN_DATAPATH fi if [[ $FEATURE_LIGHTNING == true ]]; then if [[ $LIGHTNING_IMPLEMENTATION == "c-lightning" ]]; then build_docker_image ../SatoshiPortal/dockers/$arch/LN/c-lightning cyphernode/clightning - elif [[ $LIGHTNING_IMPLEMENTATION == "lnd" ]]; then - trace "lnd is not supported right now" + if [ ! -d $LIGHTNING_DATAPATH ]; then + trace "Creating $LIGHTNING_DATAPATH" + mkdir -p $LIGHTNING_DATAPATH + fi + + if [[ -f $LIGHTNING_DATAPATH/config ]]; then + trace "Creating backup of $LIGHTNING_DATAPATH/config" + cp $LIGHTNING_DATAPATH/config $LIGHTNING_DATAPATH/config-$(date +"%y-%m-%d-%T") + fi + + trace "Copying c-lightning config" + cp $sourceDataPath/lightning/c-lightning/config $LIGHTNING_DATAPATH fi fi @@ -33,9 +56,27 @@ install_docker() { # build cyphernode images trace "Creating cyphernode images" build_docker_image ../../proxy_docker/ cyphernode/proxy + if [ ! -d $PROXY_DATAPATH ]; then + trace "Creating $PROXY_DATAPATH" + mkdir -p $PROXY_DATAPATH + fi build_docker_image ../../cron_docker/ cyphernode/proxycron build_docker_image ../../pycoin_docker/ cyphernode/pycoin trace "Creating cyphernode network" docker network create cyphernodenet > /dev/null 2>&1 + + if [[ -f $topLevel/docker-compose.yaml ]]; then + trace "Creating backup of docker-compose.yaml" + cp $topLevel/docker-compose.yaml $topLevel/docker-compose.yaml-$(date +"%y-%m-%d-%T") + fi + + trace "Copying docker-compose.yaml to top level" + cp $sourceDataPath/installer/docker/docker-compose.yaml $topLevel/docker-compose.yaml + + echo "+------------------------------------------+" + echo "| to start cyphernode run: |" + echo "| docker-compose -f docker-compose.yaml up |" + echo "+------------------------------------------+" + } \ No newline at end of file