Commit ec45b020 authored by TonyFord's avatar TonyFord
Browse files

deployment improvements

parent 7a330221
services/electrumfairchainsx/scripts/ssl.conf
stages:
- build
- init
- start
- new_ssl
- status
- create_wallet
- restore_wallet
- load_wallet
- close_wallet
- walletinfo
......@@ -20,59 +22,37 @@ build:
variables:
- $CMD =~ /build/
before_script:
- export RUNNER_UID=`id -u`
- export RUNNER_GID=`id -g`
- chmod +x ./setenv && . setenv
script:
- docker-compose down
- docker-compose build faircoin
- docker-compose build electrumfairchainsx
- deploy/build
init:
stage: init
start:
stage: start
tags:
- FairCoin.Co
only:
refs:
- master
variables:
- $CMD =~ /init/
- $CMD =~ /start/
before_script:
- export RUNNER_UID=`id -u`
- export RUNNER_GID=`id -g`
- chmod +x ./setenv && . setenv
script:
- docker-compose stop
- docker-compose up -d --remove-orphans faircoin
- docker-compose exec -T faircoin rm -f /home/faircoin/.faircoin2/faircoin.conf
- docker-compose exec -T faircoin cp /home/faircoin/_init/.faircoin2/faircoin.conf /home/faircoin/.faircoin2/
- docker-compose exec -T faircoin rm -f /home/faircoin/.faircoin2/fairchains.conf
- docker-compose exec -T faircoin cp /home/faircoin/_init/.faircoin2/fairchains.conf /home/faircoin/.faircoin2/
- docker-compose exec -T faircoin rm -f /home/faircoin/.faircoin2/FairCoinChain.electrumx.json
- docker-compose exec -T faircoin cp /home/faircoin/_init/.faircoin2/FairCoinChain.electrumx.json /home/faircoin/.faircoin2/
- docker-compose exec -T faircoin rm -f /home/faircoin/.faircoin2/FairCoinChain.json
- docker-compose exec -T faircoin cp /home/faircoin/_init/.faircoin2/FairCoinChain.json /home/faircoin/.faircoin2/
- docker-compose exec -T faircoin rm -f /home/faircoin/.electrumfair/config
- docker-compose exec -T faircoin cp /home/faircoin/_init/.electrumfair/config /home/faircoin/.electrumfair/
after_script:
- docker-compose down
- deploy/start
start:
stage: start
new_ssl-electrumfairchainsx:
stage: new_ssl
tags:
- FairCoin.Co
only:
refs:
- master
variables:
- $CMD =~ /init|start/
- $CMD =~ /new_ssl|^install/
before_script:
- export RUNNER_UID=`id -u`
- export RUNNER_GID=`id -g`
- chmod +x ./setenv && . setenv
script:
- docker-compose exec -T faircoin ./stop_faircoin_services.sh && sleep 10
- docker-compose stop
- docker-compose up -d --remove-orphans
- docker-compose exec -T faircoin ./start_faircoin_services.sh
- export LH_PORT=${LH_PORT_jsonrpc} && curl https://git.fairkom.net/faircoin.co/admin/-/raw/master/nginx_proxy | sed -e s/DOMAIN/${CI_PROJECT_NAME}/g -e s/LH_PORT/${LH_PORT}/g > ${CI_PROJECT_NAME}
- deploy/new_ssl
create_wallet:
stage: create_wallet
......@@ -84,12 +64,23 @@ create_wallet:
variables:
- $CMD =~ /^create wallet$/
before_script:
- export RUNNER_UID=`id -u`
- export RUNNER_GID=`id -g`
- docker-compose exec -T faircoin mkdir -p .electrumfair/wallets
- chmod +x ./setenv && . setenv
script:
- console/create_wallet
restore_wallet:
stage: restore_wallet
tags:
- FairCoin.Co
only:
refs:
- master
variables:
- $CMD =~ /^restore wallet$/
before_script:
- chmod +x ./setenv && . setenv
script:
- docker-compose exec -T faircoin ./electrumfair/run_electrumfair create --passphrase ${PASSPHRASE} --password ${PASSWORD} --wallet .electrumfair/wallets/${WALLET:-default_wallet}
- docker-compose exec -T faircoin ls -l .electrumfair/wallets
- console/restore_wallet
load_wallet:
stage: load_wallet
......@@ -101,11 +92,9 @@ load_wallet:
variables:
- $CMD =~ /^load wallet$/
before_script:
- export RUNNER_UID=`id -u`
- export RUNNER_GID=`id -g`
- chmod +x ./setenv && . setenv
script:
- docker-compose exec -T faircoin ./load_wallet.expect ${WALLET:-default_wallet} ${PASSWORD}
- docker-compose exec -T faircoin ./electrumfair/run_electrumfair getbalance --wallet .electrumfair/wallets/${WALLET:-default_wallet}
- console/load_wallet
close_wallet:
stage: close_wallet
......@@ -117,11 +106,9 @@ close_wallet:
variables:
- $CMD =~ /^close wallet$/
before_script:
- export RUNNER_UID=`id -u`
- export RUNNER_GID=`id -g`
- chmod +x ./setenv && . setenv
script:
- docker-compose exec -T faircoin ./electrumfair/run_electrumfair getbalance --wallet .electrumfair/wallets/${WALLET:-default_wallet}
- docker-compose exec -T faircoin ./electrumfair/run_electrumfair daemon close_wallet --wallet .electrumfair/wallets/${WALLET:-default_wallet}
- console/close_wallet
walletinfo:
stage: walletinfo
......@@ -133,10 +120,9 @@ walletinfo:
variables:
- $CMD =~ /^walletinfo$|^load wallet$|^close wallet$/
before_script:
- export RUNNER_UID=`id -u`
- export RUNNER_GID=`id -g`
- chmod +x ./setenv && . setenv
script:
- docker-compose exec -T faircoin ./electrumfair/run_electrumfair daemon status
- console/walletinfo
stop:
stage: stop
......@@ -147,8 +133,10 @@ stop:
- master
variables:
- $CMD =~ /^stop$/
before_script:
- chmod +x ./setenv && . setenv
script:
- docker-compose stop
- deploy/stop
uninstall:
stage: uninstall
......@@ -159,10 +147,10 @@ uninstall:
- master
variables:
- $CMD =~ /^uninstall$/
before_script:
- chmod +x ./setenv && . setenv
script:
- docker-compose exec -T faircoin ./stop_faircoin_services.sh && sleep 10
- docker-compose stop
- docker-compose down
- deploy/uninstall
remove:
stage: remove
......@@ -173,6 +161,21 @@ remove:
- master
variables:
- $CMD =~ /^remove$/
before_script:
- chmod +x ./setenv && . setenv
script:
- deploy/remove
status-electrumfairchainsx:
stage: status
tags:
- FairCoin.Co
only:
refs:
- master
variables:
- $CMD =~ /status/
before_script:
- chmod +x ./setenv && . setenv
script:
- docker-compose stop
- docker-compose down -v --rmi all --remove-orphans
- console/status
......@@ -34,6 +34,7 @@ remove
Wallet commands:
~~~
create wallet # create new electrumfair wallet
restore wallet # restore electrumfair wallet from seed or key
load wallet # load wallet ( make it hot )
close wallet # close wallet ( make it cold )
walletinfo # get electrumfair wallet info
......@@ -51,20 +52,28 @@ LH_PORT_jsonrpc # php -S 0.0.0.0:${LH_PORT}
Pipeline variables:
~~~
CMD = create wallet
WALLET = <new wallet name> # optional specify the wallets name
WALLET = <new wallet name> # [optional] specify the wallets name
PASSPHRASE = <new wallet passphrase> # passphrase make your seed more secure
PASSWORD = <new wallet password> # password encrypts all wallets data on your drive
~~~
~~~
CMD = restore wallet
SEED = <your seed or key> # seed, masterpubkey, masterprivkey, pubkey, privkey
WALLET = <new wallet name> # [optional] specify the wallets name
PASSPHRASE = <new wallet passphrase> # passphrase make your seed more secure
PASSWORD = <new wallet password> # password encrypts all wallets data on your drive
~~~
~~~
CMD = load wallet
WALLET = <wallet name> # optional specify the wallets name
WALLET = <wallet name> # [optional] specify the wallets name
PASSWORD = <wallet password> # password encrypts all wallets data on your drive
~~~
~~~
CMD = close wallet
WALLET = <wallet name> # optional specify the wallets name
WALLET = <wallet name> # [optional] specify the wallets name
PASSWORD = <wallet password> # password encrypts all wallets data on your drive
~~~
......
#!/bin/bash
docker-compose exec -T faircoin ./electrumfair/run_electrumfair getbalance --wallet .electrumfair/wallets/${WALLET:-default_wallet}
docker-compose exec -T faircoin ./electrumfair/run_electrumfair daemon close_wallet --wallet .electrumfair/wallets/${WALLET:-default_wallet}
#!/bin/bash
if [ "${PASSWORD}" == '' ]
then
echo "export/set PASSWORD!"
exit
fi
if [ "${PASSPHRASE}" == '' ]
then
echo "export/set PASSPHRASE!"
exit
fi
docker-compose exec -T faircoin mkdir -p .electrumfair/wallets
docker-compose exec -T faircoin ./electrumfair/run_electrumfair create --passphrase ${PASSPHRASE} --password ${PASSWORD} --wallet .electrumfair/wallets/${WALLET:-default_wallet}
docker-compose exec -T faircoin ls -l .electrumfair/wallets
#!/bin/bash
docker-compose exec electrumfairchainsx bash
#!/bin/bash
docker-compose exec electrumfairchainsx bash
#!/bin/bash
docker-compose exec faircoin bash
#!/bin/bash
echo ""
echo -e "console/electrumx\t\t( run container shell )"
echo -e "console/electrumfairchainsx \t( run container shell )"
echo -e "console/faircoin \t\t( run container shell )"
echo -e "console/php-server \t\t( run container shell )"
echo -e "console/help"
echo -e "console/ps \t\t\t( list containers )"
echo -e "console/status \t\t\t( network / processes / ... status overview )"
echo ""
echo -e "console/create_wallet \t\t( create new electrumfair wallet )"
echo -e "console/restore_wallet \t\t( restore electrumfair wallet by seed )"
echo -e "console/load_wallet \t\t( make electrumfair wallet hot )"
echo -e "console/close_wallet \t\t( make electrumfair wallet cold )"
echo -e "console/walletinfo \t\t( get electrumfair walletinfo )"
echo ""
#!/bin/bash
if [ "${PASSWORD}" == '' ]
then
echo "export/set PASSWORD!"
exit
fi
docker-compose exec -T faircoin ./load_wallet.expect ${WALLET:-default_wallet} ${PASSWORD}
docker-compose exec -T faircoin ./electrumfair/run_electrumfair getbalance --wallet .electrumfair/wallets/${WALLET:-default_wallet}
#!/bin/bash
docker-compose exec php-server bash
#!/bin/bash
docker-compose ps
#!/bin/bash
if [ "${PASSWORD}" == '' ]
then
echo "export/set PASSWORD!"
exit
fi
if [ "${PASSPHRASE}" == '' ]
then
echo "export/set PASSPHRASE!"
exit
fi
if [ "${SEED}" == '' ]
then
echo "export/set SEED!"
exit
fi
docker-compose exec -T faircoin mkdir -p .electrumfair/wallets
docker-compose exec -T faircoin ./electrumfair/run_electrumfair restore --passphrase ${PASSPHRASE} --password ${PASSWORD} --wallet .electrumfair/wallets/${WALLET:-default_wallet} ${SEED}
docker-compose exec -T faircoin ls -l .electrumfair/wallets
#!/bin/bash
echo ""
echo "NETWORK"
echo "======================================================================="
echo "container:faircoin"
echo ""
docker-compose exec -T faircoin netstat -tulpen
echo ""
echo "_______________________________________________________________________"
echo "container:electrumfairchainsx"
echo ""
docker-compose exec -T electrumfairchainsx netstat -tulpen
echo ""
echo "_______________________________________________________________________"
echo "container:php-server"
echo ""
docker-compose exec -T php-server netstat -tulpen
echo ""
echo ""
echo ""
echo "PROCESSES"
echo "======================================================================="
echo "container:faircoin"
echo ""
docker-compose exec -T faircoin ps aux
echo ""
echo "_______________________________________________________________________"
echo "container:electrumfairchainsx"
echo ""
docker-compose exec -T electrumfairchainsx ps aux
echo ""
echo "_______________________________________________________________________"
echo "container:php-server"
echo ""
docker-compose exec -T php-server ps aux
echo ""
echo ""
echo ""
echo "FAIRCOIND"
echo "======================================================================="
echo "container:faircoin"
echo ""
docker-compose exec -T faircoin ./faircoin-cli getinfo
#!/bin/bash
docker-compose exec -T faircoin ./electrumfair/run_electrumfair daemon status
#!/bin/bash
docker-compose stop --timeout 30
docker-compose down
chmod +x ./services/faircoin/entrypoint.sh
docker-compose build
#!/bin/bash
echo ""
echo -e "deploy/build \t\t( build container images )"
echo -e "deploy/start \t\t( start container )"
echo -e "deploy/new_ssl \t\t( create new ssl cert for electrumx server )"
echo -e "deploy/stop \t\t( stop container )"
echo -e "deploy/install \t( run steps build + start + new_ssl )"
echo -e "deploy/uninstall \t( stop and remove container, named volumes will NOT removed )"
echo -e "deploy/remove \t\t( stop and remove container and images, named volumes WILL REMOVED )"
echo ""
#!/bin/bash
deploy/build
deploy/start
deploy/new_ssl
#!/bin/bash
chmod +x services/electrumfairchainsx/scripts/create_ssl.sh
# refresh ssl.conf from env file ( see volume in docker-compose.yml )
docker-compose stop electrumfairchainsx
docker-compose up -d electrumfairchainsx
# create electrumx ssl cert files
docker-compose exec -T electrumfairchainsx /home/faircoin/scripts/create_ssl.sh
# restart server
docker-compose stop electrumfairchainsx
docker-compose start electrumfairchainsx
#!/bin/bash
docker-compose stop --timeout 30
docker-compose down -v --rmi all --remove-orphans
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment