Skip to content
Snippets Groups Projects
Commit b41d22d7 authored by Robert Martin-Legene's avatar Robert Martin-Legene
Browse files

Red de pruebas mas integrada en git

parent cca9dc7d
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,11 @@
*/status
cache
*/*cache
network*/node
network*/bootnode
network*/contracts/*
network/node
network/bootnode
network/contracts/*
network/*.pid
test2network*/node
test2network*/bootnode
test2network*/contracts/*
test2network/*.pid
......@@ -49,16 +49,15 @@ function nodejsinstall
function web3install
{
(
cd ~bfa
test -r package.json ||
info Initialising nodejs. &&
sudo --set-home -u bfa npm init -y
)
test -r ~bfa/package.json ||
info Initialising nodejs. &&
sudo --set-home -u bfa npm init -y
# nodejs package(s) that we need.
echo 'require("web3")' | sudo --set-home -u bfa nodejs 2>/dev/null && return
info Installing nodejs module: web3 "(will show many warnings)"
sudo --set-home -u bfa npm install web3
info Installing nodejs module: require
sudo --set-home -u bfa npm install require
}
function golanginstall
......@@ -146,36 +145,43 @@ function usersetup
info Adding required user \"bfa\"
adduser --disabled-password --gecos 'Blockchain Federal Argentina' bfa
fi
cd ~bfa
# If we're running inside a docker, this may already exist but
# probably owned by root. Let's make sure things are proper.
chown -R bfa:bfa ~bfa
# cloning if not done already
if [ ! -d ~bfa/bfa ]
chown -R bfa:bfa .
#
}
function userconfig
{
if [ ! -e "${BFAHOME}/bin/env" ]
then
cp -p ${BFAHOME}/$envfile ${BFAHOME}/bin/env
fi
if [ $( expand < .bashrc | grep -E "source ${BFAHOME}/bin/env" | wc -l ) -eq 0 ]
then
info "Adding to automatically source ${BFAHOME}/bin/env via .bashrc"
echo "source ${BFAHOME}/bin/env" >> .bashrc
fi
# cloning if not done already, or just update (pull)
if [ ! -d "$BFAHOME" ]
then
# initial cloning
cd ~bfa
git clone https://gitlab.bfa.ar/blockchain/nucleo.git bfa
git clone https://gitlab.bfa.ar/blockchain/nucleo.git $BFAHOME
cd "$BFAHOME"
else
# updating
cd ~bfa/bfa
cd "$BFAHOME"
git pull
fi
#
cd ~bfa
if [ $( expand < .bashrc | grep -E 'source .*bfa/bin/env' | wc -l ) -eq 0 ]
then
info Adding to automatically source \~bfa/bfa/bin/env via .bashrc
echo 'source ~/bfa/bin/env' >> .bashrc
fi
mkdir -p ~bfa/bfa/network
PATH=${PATH}:${BFAHOME}/bin
}
function cronit
{
if [ $( ( crontab -u bfa -l 2>/dev/null || true ) | grep -E 'bfa/bin/cron.sh$' | wc -l ) -eq 0 ]
if [ $( ( crontab -u bfa -l 2>/dev/null || true ) | grep -E "$BFAHOME/bin/cron.sh" | wc -l ) -eq 0 ]
then
info Install crontab to start automatically upon reboot
(( crontab -u bfa -l 2>/dev/null || true ) ; echo '@reboot bfa/bin/cron.sh' ) | crontab -u bfa -
(( crontab -u bfa -l 2>/dev/null || true ) ; echo "@reboot $BFAHOME/bin/cron.sh" ) | crontab -u bfa -
fi
}
......@@ -184,7 +190,45 @@ function welcome
info "(re)log in as user bfa"
}
function setupquestions
{
read -p "Donde quiere instalar (sera BFAHOME) [$( echo ~bfa/bfa )]? : " -t 60 BFAHOME
if [ "$BFAHOME" = "" ]
then
BFAHOME=$( echo ~bfa/bfa )
fi
unset envfile
if [ ! -e "${BFAHOME}/bin/env" ]
then
REPLY=
while [ "$REPLY" != "1" -a "$REPLY" != "2" ]
do
echo "Quiere conectarse a la red BFA de produccion o prueba?"
echo "1. Produccion"
echo "2. Prueba (test2)"
read -p "Red: " -t 60 -n 1
done
# Default to production
if [ "$REPLY" = "" ]
then
REPLY=1
fi
case "$REPLY" in
1)
envfile=network/env
;;
2)
envfile=test2network/env
;;
*)
false
;;
esac
fi
}
usersetup
setupquestions
# Ubuntu necesita mas repos
grep -q Ubuntu /etc/issue && apt-add-repository multiverse
#
......@@ -192,7 +236,7 @@ apt update
# development tools
aptinstall dirmngr apt-transport-https curl git curl build-essential sudo
aptinstall jq libjson-perl libwww-perl libclass-accessor-perl
usersetup
userconfig
nodejsinstall
web3install
golanginstall
......
......@@ -193,8 +193,8 @@ test -d "${BFANETWORKDIR}" || fatal "\$BFANETWORKDIR (\"${BFANETWORKDIR}\"
test -n "$BFANODEDIR" || BFANODEDIR="${BFANETWORKDIR}/node"
if [ ! -d "${BFANODEDIR}" -o ! -d "${BFANODEDIR}/geth/chaindata" ]
then
echo "Node is not initialised. Initialising with BFA genesis."
geth --cache 0 --datadir "${BFANODEDIR}" init "${BFAHOME}/src/genesis.json"
echo "Node is not initialised. Initialising with genesis."
geth --cache 0 --datadir "${BFANODEDIR}" init "${BFANETWORK}/genesis.json"
fi
#
# netport
......
File moved
File moved
0xbee0966bdc4568726ab3d3131b02e6255e29285d nic1
export BFAHOME=${HOME}/bfa
export BFANETWORKID=55555000000
export BFANETWORKDIR="${BFAHOME}/test2network"
PATH=${PATH}:${BFAHOME}/bin:${HOME}/bin
{
"config": {
"chainId": 99118822,
"homesteadBlock": 0, "eip150Block": 0, "eip155Block": 0, "eip158Block": 0, "byzantiumBlock": 4,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"clique": { "period": 5, "epoch": 30000 }
},
"nonce": "0x0000000000000000",
"timestamp": "0x5ce54321",
"extraData": "0x6266612e6172207465737432206e657400000000000000000000000000000000bee0966bdc4568726ab3d3131b02e6255e29285d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"gasLimit": "0xffeeddcc", "difficulty": "0x1", "number": "0x0", "gasUsed": "0x0",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"alloc": {
"bee0966bdc4568726ab3d3131b02e6255e29285d": { "balance": "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" }
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment