chore: clean up #2

Open
williamluke wants to merge 18 commits from lum/kitabu into master
15 changed files with 1344 additions and 1168 deletions
Showing only changes of commit d6114f43f2 - Show all commits

View File

@ -1,7 +1,7 @@
# Example Usage # Example Usage
# bash <(curl -s https://pip.grassrootseconomics.net/cic-staff-installer.sh) -h # bash <(curl -s https://git.grassecon.net/grassrootseconomics/cic-staff-installer/raw/branch/lum/kitabu/install.sh) -h
# This is currently living on at pip because root is using a self signed cert # This is currently living on at pip because root is using a self signed cert
# When changes are made to this file you must run bash ./rsync-install-script.sh to sync it to the server # When changes are made to this file you must run bash ./rsync/rsync-install-script.sh to sync it to the server
branch='master' branch='master'
verbose='false' verbose='false'
@ -11,7 +11,7 @@ print_usage() {
printf "CIC Staff Installer printf "CIC Staff Installer
Options: Options:
-b <branch> Name of the branch you want use to install -b <branch> Name of the branch you want use to install
-e <evm> Name of the EVM you want to install (kitabu, bloxberg) -e <evm> Name of the EVM you want to install (kitabu, bloxberg; default is none)
-v Verbose -v Verbose
-h Print this help message -h Print this help message
" "
@ -29,7 +29,13 @@ while getopts 'e:hb:v' flag; do
esac esac
done done
export INSTALL_EVM=${evm} export INSTALL_EVM=${evm}
if [ ! -z $INSTALL_EVM ]; then
. setup_evm.sh
fi
temp_dir=`mktemp -d` temp_dir=`mktemp -d`
git clone -b $branch https://git.grassecon.net/grassrootseconomics/cic-staff-installer.git $temp_dir git clone -b $branch https://git.grassecon.net/grassrootseconomics/cic-staff-installer.git $temp_dir
cd $temp_dir cd $temp_dir
export BASH_DEBUG_LEVEL=4 # all=1 trace=2 debug=3 info=4 warn=5 error=6
export BASH_DEBUG=1
bash setup.sh bash setup.sh

2
rsync-scripts.sh Normal file
View File

@ -0,0 +1,2 @@
bash ./rsync/rsync-install-script.sh
bash ./rsync/rsync-uninstall-script.sh

View File

@ -0,0 +1,9 @@
host='root.grassrootseconomics.net'
file_to_sync='./uninstall.sh'
distination_dir='/usr/local/share/python/packages'
distination_file_name='cic-staff-uninstaller.sh'
user='root'
echo Syncing $file_to_sync to $distination_dir as $user on $host
rsync -avz --progress $file_to_sync $user@$host:$distination_dir/$distination_file_name

307
setup.sh
View File

@ -2,12 +2,168 @@
want_cic_cache_version=0.3.0a2 want_cic_cache_version=0.3.0a2
want_cicada_version=0.0.6rc1 want_cicada_version=0.0.6rc1
#INSTALL_EVM=bloxberg
. aux/bdbg/bdbg.sh setup_debug(){
. aux/bdbg/bdbg.sh
_level=${BASH_DEBUG_LEVEL:-2}
_debug=${BASH_DEBUG:-0}
debug_flag=
if [ ! -z "$_debug"] && [ "$_level" -eq 1 ]; then
debug_flag="$debug_flag"
elif [ ! -z "$_debug"] && [ "$_level" -gt 1 ]; then
debug_flag="-v"
fi
}
_level=2 setup_cic_gpg(){
_debug=1 mkdir -vp $HOME/.local/share/cic/.gnupg
chmod 700 $HOME/.local/share/cic/.gnupg
for f in ./keys/*.asc; do
gpg --homedir $HOME/.local/share/cic/.gnupg --import $f
done
gpg --homedir $HOME/.local/share/cic/.gnupg --import-ownertrust ./keys/trust
}
get_default_enviroment(){
dbg $dbg_debug "load default environment"
config_directives=(CIC_REGISTRY_ADDRESS CIC_TRUST_ADDRESS META_URL TX_CACHE_URL CHAIN_SPEC)
for c in ${config_directives[@]}; do
v=${!c}
if [ -z "$v" ]; then
d=`mktemp -d`
curl -X GET --cacert $CIC_ROOT_CA_FILE $CIC_ROOT_URL/$c -o $d/$c
gpg --homedir $HOME/.local/share/cic/.gnupg --verify $d/$c
v=`gpg --homedir $HOME/.local/share/cic/.gnupg -d $d/$c` # Decrypt
echo $v >> $t
dbg $dbg_debug "fetched environment variable $v"
else
dbg $dbg_debug "using predefined environment variable for $c = $v"
fi
done
}
init_env(){
dbg $dbg_debug "identify root values"
t=`mktemp`
set -e # Exit immediately if a command exits with a non-zero status
get_default_enviroment
set -a
. $t
set +a
# DATABASE_NAME set here works as long as only one database is involved...
export DATABASE_PREFIX=$HOME/.local/share/cic/cache/${DATABASE_PREFIX:-staffclient}
export DATABASE_ENGINE=sqlite
export DATABASE_DRIVER=pysqlite
export DATABASE_DEBUG=0
export DATABASE_POOL_SIZE=0
export DATABASE_USER=postgres
export DATABASE_PASSWORD=`dd if=/dev/urandom bs=32 count=1 2> /dev/null | hexdump -v -n 32 -e '1/1 "%02x"'`
if [ -d "$HOME/.config/cic/staff-client/.gnupg" ]; then
echo "Staff Client GPG keyring already exists"
else
dbg $dbg_debug "set up keys"
if [ -z "$AUTH_KEY" ]; then
. setup_key.sh
else
t=`mktemp`
gpg --export -a $AUTH_KEY > $t
echo -n $AUTH_KEY > $HOME/.config/cic/staff-client/key_fingerprint
dbg $dbg_info "using key $AUTH_KEY"
fi
fi
export AUTH_KEY=`cat $HOME/.config/cic/staff-client/key_fingerprint`
export AUTH_KEYRING_PATH=$HOME/.config/cic/staff-client/.gnupg
export AUTH_DB_PATH=$HOME/.local/share/cic/clicada
touch "$HOME/.config/cic/staff-client/.envinit"
}
check_cache_version(){
v=`pip show cic-cache | awk '/^Version/ {print $2;}'`
if [ "$?" -ne 0 ]; then
dbg $dbg_warn "cic-cache is not installed. will update"
update=1
elif [ "$v" != "$want_cic_cache_version" ]; then
dbg $dbg_warn "cic-cache version $v installed but need $want_cic_cache_version, will update"
update=1
else
dbg $dbg_info "cic-cache version $v found"
fi
}
check_cicada_version(){
v=`pip show clicada | awk '/^Version/ {print $2;}'`
if [ "$?" -ne 0 ]; then
dbg $dbg_warn "clicada is not installed, will update"
update=1
elif [ "$v" != "$want_cicada_version" ]; then
dbg $dbg_warn "clicada version $v installed but need $want_cicada_version, will update"
update=1
else
dbg $dbg_info "clicada version $v found"
fi
}
update_requirements(){
if [ $update -gt 0 ]; then
dbg $dbg_debug "installing application files"
pip3 install --user --index-url $PIP_INDEX_URL --extra-index-url $PIP_EXTRA_INDEX_URL $PIP_EXTRA_ARGS $debug_flag -r requirements.txt
update_path $HOME/.local/bin
fi
}
install_cache_configuration(){
if [ -f $HOME/.config/cic/cache/config.ini ]; then
dbg $dbg_debug "migrating existing configuration"
cic_cache_config_flag="-c $HOME/.config/cic/cache"
fi
cic-cache-trackerd --dumpconfig ini $cic_cache_config_flag $debug_flag > $t
mkdir -vp $HOME/.config/cic/cache
mv -v $t $HOME/.config/cic/cache/config.ini
}
install_clicada_configuration(){
if [ -d $HOME/.config/cic/clicada/config.ini ]; then
dbg $dbg_debug "migrating existing clicada configuration"
clicada_config_flag="-c $HOME/.config/cic/clicada"
fi
clicada --dumpconfig ini $clicada_config_flag > $t
mkdir -vp $HOME/.config/cic/clicada
mv -v $t $HOME/.config/cic/clicada/config.ini
}
export_cache_tracker_config(){
t=`mktemp`
cic-cache-trackerd --dumpconfig env $cic_cache_config_flag $debug_flag > $t
set -a # Forces a variable to be exported even if it wasn't before
. $t
set +a
}
execute_cache_database_migrations(){
dbg $dbg_debug "execute database migrations"
mkdir -vp $HOME/.local/share/cic/cache
# This has the default log level set to debug
migrate_cic_cache.py -c $HOME/.config/cic/cache/
}
export_clicada_config(){
t=`mktemp`
clicada --dumpconfig env $clicada_config_flag $debug_flag > $t
set -a
. $t
set +a
}
setup_debug
PIP_EXTRA_ARGS=$PIP_EXTRA_ARGS PIP_EXTRA_ARGS=$PIP_EXTRA_ARGS
PIP_EXTRA_INDEX_URL=${PIP_EXTRA_INDEX_URL:-https://pip.grassrootseconomics.net} PIP_EXTRA_INDEX_URL=${PIP_EXTRA_INDEX_URL:-https://pip.grassrootseconomics.net}
@ -27,148 +183,27 @@ fi
mkdir -vp $HOME/.local/bin mkdir -vp $HOME/.local/bin
dbg $dbg_debug "importing keys" dbg $dbg_debug "importing keys"
setup_cic_gpg
mkdir -vp $HOME/.local/share/cic/.gnupg
chmod 700 $HOME/.local/share/cic/.gnupg
for f in ./keys/*.asc; do
gpg --homedir $HOME/.local/share/cic/.gnupg --import $f
done
gpg --homedir $HOME/.local/share/cic/.gnupg --import-ownertrust ./keys/trust
t=`mktemp`
dbg $dbg_debug "identify root values"
set -e
# check if we have existing setup # check if we have existing setup
if [ ! -e "$HOME/.config/cic/staff-client/.envinit" ]; then if [ ! -e "$HOME/.config/cic/staff-client/.envinit" ]; then
dbg $dbg_debug "load default environment" init_env
config_directives=(CIC_REGISTRY_ADDRESS CIC_TRUST_ADDRESS META_URL TX_CACHE_URL CHAIN_SPEC)
for c in ${config_directives[@]}; do
v=${!c}
if [ -z "$v" ]; then
d=`mktemp -d`
curl -X GET --cacert $CIC_ROOT_CA_FILE $CIC_ROOT_URL/$c -o $d/$c
gpg --homedir $HOME/.local/share/cic/.gnupg --verify $d/$c
v=`gpg --homedir $HOME/.local/share/cic/.gnupg -d $d/$c`
echo $v >> $t
dbg $dbg_debug "fetched environment variable $v"
else
dbg $dbg_debug "using predefined environment variable for $c = $v"
fi
done
set -a
. $t
set +a
# DATABASE_NAME set here works as long as only one database is involved...
export DATABASE_PREFIX=$HOME/.local/share/cic/cache/${DATABASE_PREFIX:-staffclient}
export DATABASE_ENGINE=sqlite
export DATABASE_DRIVER=pysqlite
export DATABASE_DEBUG=0
export DATABASE_POOL_SIZE=0
export DATABASE_USER=postgres
export DATABASE_PASSWORD=`dd if=/dev/urandom bs=32 count=1 2> /dev/null | hexdump -v -n 32 -e '1/1 "%02x"'`
dbg $dbg_debug "set up keys"
if [ -z "$AUTH_KEY" ]; then
. setup_key.sh
else
t=`mktemp`
gpg --export -a $AUTH_KEY > $t
echo -n $AUTH_KEY > $HOME/.config/cic/staff-client/key_fingerprint
dbg $dbg_info "using key $AUTH_KEY"
fi
export AUTH_KEY=`cat $HOME/.config/cic/staff-client/key_fingerprint`
export AUTH_KEYRING_PATH=$HOME/.config/cic/staff-client/.gnupg
export AUTH_DB_PATH=$HOME/.local/share/cic/clicada
touch "$HOME/.config/cic/staff-client/.envinit"
fi fi
set +e set +e
dbg $dbg_debug "checking installed versions" dbg $dbg_debug "checking installed versions"
update=0 update=0
v=`pip show cic-cache | awk '/^Version/ {print $2;}'` check_cache_version
if [ "$?" -ne 0 ]; then check_cicada_version
dbg $dbg_warn "cic-cache is not installed. will update"
update=1
elif [ "$v" != "$want_cic_cache_version" ]; then
dbg $dbg_warn "cli-cache version $v installed but need $want_cic_cache_version, will update"
update=1
else
dbg $dbg_info "cli-cache version $v found"
fi
v=`pip show clicada | awk '/^Version/ {print $2;}'`
if [ "$?" -ne 0 ]; then
dbg $dbg_warn "clicada is not installed, will update"
update=1
elif [ "$v" != "$want_cicada_version" ]; then
dbg $dbg_warn "clicada version $v installed but need $want_cicada_version, will update"
update=1
else
dbg $dbg_info "clicada version $v found"
fi
set -e set -e
update_requirements
if [ $update -gt 0 ]; then
dbg $dbg_debug "installing application files"
debug_flag=
if [ "$_level" -eq 1 ]; then
debug_flag="-v"
fi
pip install --index-url $PIP_INDEX_URL --extra-index-url $PIP_EXTRA_INDEX_URL $PIP_EXTRA_ARGS $debug_flag -r requirements.txt
update_path $HOME/.local/bin
fi
dbg $dbg_debug "installing configurations" dbg $dbg_debug "installing configurations"
t=`mktemp` t=`mktemp`
if [ -f $HOME/.config/cic/cache/config.ini ]; then install_cache_configuration
dbg $dbg_debug "migrating existing configuration" install_clicada_configuration
cic_cache_config_flag="-c $HOME/.config/cic/cache" export_cache_tracker_config
fi execute_cache_database_migrations
cic-cache-trackerd --dumpconfig ini $cic_cache_config_flag -vv > $t export_clicada_config
mkdir -vp $HOME/.config/cic/cache
mv -v $t $HOME/.config/cic/cache/config.ini
if [ -d $HOME/.config/cic/clicada/config.ini ]; then
dbg $dbg_debug "migrating existing clicada configuration"
clicada_config_flag="-c $HOME/.config/cic/clicada"
fi
clicada --dumpconfig ini $clicada_config_flag > $t
mkdir -vp $HOME/.config/cic/clicada
mv -v $t $HOME/.config/cic/clicada/config.ini
t=`mktemp`
cic-cache-trackerd --dumpconfig env $cic_cache_config_flag -vv > $t
set -a
. $t
set +a
dbg $dbg_debug "execute database migrations"
mkdir -vp $HOME/.local/share/cic/cache
migrate_cic_cache.py -c $HOME/.config/cic/cache/
t=`mktemp`
clicada --dumpconfig env $clicada_config_flag -vv > $t
set -a
. $t
set +a
. setup_systemd.sh . setup_systemd.sh
if [ ! -z $INSTALL_EVM ]; then
. setup_evm.sh
fi

View File

@ -1,23 +1,23 @@
. aux/bdbg/bdbg.sh load_env(){
. setup_path.sh GIT_OPENETHEREUM=${GIT_OPENETHEREUM:-https://github.com/openethereum/openethereum}
# set -o xtrace
GIT_OPENETHEREUM=${GIT_OPENETHEREUM:-https://github.com/openethereum/openethereum}
default_openethereum_chain="kitabu" # bloxberg | kitabu
export OPENETHEREUM_CHAIN=${INSTALL_EVM:-$default_openethereum_chain}
OPENETHEREUM_PATH=${OPENETHEREUM_PATH:-$HOME/.local/bin/parity} default_openethereum_chain="kitabu" # bloxberg | kitabu
openethereum_dir=`realpath $(dirname $OPENETHEREUM_PATH)` export OPENETHEREUM_CHAIN=${INSTALL_EVM:-$default_openethereum_chain}
default_openethereum_run=$HOME/.local/share/io.parity.ethereum/$OPENETHEREUM_CHAIN OPENETHEREUM_PATH=${OPENETHEREUM_PATH:-$HOME/.local/bin/openethereum}
default_openethereum_config=$HOME/.config/io.parity.ethereum/$OPENETHEREUM_CHAIN openethereum_dir=`realpath $(dirname $OPENETHEREUM_PATH)`
export OPENETHEREUM_RUN=${OPENETHEREUM_RUN:-$default_openethereum_run} default_openethereum_config=$HOME/.config/io.parity.ethereum/$OPENETHEREUM_CHAIN
export OPENETHEREUM_CONFIG=${OPENETHEREUM_CONFIG:-$default_openethereum_config}
default_openethereum_type="binary" # source | binary export OPENETHEREUM_CONFIG=${OPENETHEREUM_CONFIG:-$default_openethereum_config}
export OPENETHEREUM_TYPE=${OPENETHEREUM_TYPE:-$default_openethereum_type} default_openethereum_type="binary" # source | binary
export OPENETHEREUM_TYPE=${OPENETHEREUM_TYPE:-$default_openethereum_type}
}
download_openethereum() { download_openethereum() {
dbg $dbg_debug "downloading openethereum node"
openethereum_version="3.3.3" openethereum_version="3.3.3"
if [ ! -f "$PWD/openethereum-linux-v$openethereum_version.zip" ]; then if [ ! -f "$PWD/openethereum-linux-v$openethereum_version.zip" ]; then
wget https://github.com/openethereum/openethereum/releases/download/v$openethereum_version/openethereum-linux-v$openethereum_version.zip wget https://github.com/openethereum/openethereum/releases/download/v$openethereum_version/openethereum-linux-v$openethereum_version.zip
@ -25,11 +25,11 @@ download_openethereum() {
unzip openethereum-linux-v$openethereum_version.zip unzip openethereum-linux-v$openethereum_version.zip
rm openethereum-linux-v$openethereum_version.zip rm openethereum-linux-v$openethereum_version.zip
./openethereum --version ./openethereum --version
mv ./openethereum $openethereum_dir/parity mv ./openethereum $openethereum_dir/openethereum
export OPENETHEREUM_PATH=$openethereum_dir/parity export OPENETHEREUM_PATH=$openethereum_dir/openethereum
} }
build_openethereum() { build_openethereum() {
dbg $dbg_debug "downloading bloxberg node" dbg $dbg_debug "building bloxberg node"
t=`mktemp -d` t=`mktemp -d`
pushd $t pushd $t
install_env=1 install_env=1
@ -38,38 +38,78 @@ build_openethereum() {
git checkout 2662d1925ec794f3ad7c5759b2412ff5128d259b git checkout 2662d1925ec794f3ad7c5759b2412ff5128d259b
rustup install 1.47.0 rustup install 1.47.0
cargo build --release --features final cargo build --release --features final
cp -v $t/target/release/parity $openethereum_dir cp -v $t/target/release/parity $openethereum_dir/openethereum
export OPENETHEREUM_PATH=$openethereum_dir/parity export OPENETHEREUM_PATH=$openethereum_dir/openethereum
} }
. aux/bdbg/bdbg.sh
. setup_path.sh
# set -o xtrace
load_env
install_env= install_env=
if [ ! -f $OPENETHEREUM_PATH ]; then if [ ! -f $OPENETHEREUM_PATH ]; then
# Download and Build parity from git $GIT_OPENETHEREUM # Download and Build parity from git $GIT_OPENETHEREUM
if [ "$OPENETHEREUM_TYPE" = "source" ]; then if [ "$OPENETHEREUM_TYPE" = "source" ]; then
build_openethereum build_openethereum
else else
download_openethereum download_openethereum
fi fi
else else
dbg $dbg_info "found bloxberg node executable in $OPENETHEREUM_PATH" dbg $dbg_info "found evm node executable in $OPENETHEREUM_PATH"
fi fi
#OPENETHEREUM_RUN=~/.local/share/io.parity.ethereum/$OPENETHEREUM_CHAIN #OPENETHEREUM_CONFIG=$HOME/.config/io.parity.ethereum/$OPENETHEREUM_CHAIN
if [ ! -d $OPENETHEREUM_RUN ]; then if [ ! -d $OPENETHEREUM_CONFIG ]; then
mkdir -vp $OPENETHEREUM_RUN/bootnode install_dir=$(pwd)
mkdir -vp $OPENETHEREUM_CONFIG mkdir -vp $OPENETHEREUM_CONFIG
touch $OPENETHEREUM_CONFIG/bootnode.pwd cd $OPENETHEREUM_CONFIG
dd status=xfer if=/dev/urandom bs=32 count=1 2> /dev/null | hexdump -v -n 32 -e '1/1 "%02x"' > $OPENETHEREUM_CONFIG/bootnode.pwd touch ./bootnode.pwd
chmod -v 400 $OPENETHEREUM_CONFIG/bootnode.pwd read -p "enter a passphrase for your keyfile: " PASSPHRASE
VANITY_STRING=${VANITY_STRING:-"Kitabu Sarafu Karibu Sana"}
echo -n "$VANITY_STRING" > ./.vanity
truncate ./.vanity -s 32 && \
hexdump -v -n 32 -e '1/1 "%02x"' ./.vanity > ./.extra
WALLET_PASSPHRASE=$PASSPHRASE eth-keyfile -0 > ./keyfile_validator.json
WALLET_PASSPHRASE=$PASSPHRASE eth-sign-msg -0 -f ./keyfile_validator.json `cat ./.extra` > ./.sig
WALLET_PASSPHRASE=$PASSPHRASE eth-keyfile -0 -d ./keyfile_validator.json >> ./.extra
cat ./.sig >> ./.extra
echo $PASSPHRASE > ./bootnode.pwd
chmod -v 400 ./bootnode.pwd
mkdir -vp $OPENETHEREUM_CONFIG/data/keys/kitabu_sarafu
cp -v ./keyfile_validator.json $OPENETHEREUM_CONFIG/data/keys/kitabu_sarafu/
echo Changing back to $install_dir
cd $install_dir
# config.json
export DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER=${DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER:-"0xEb3907eCad74a0013c259D5874AE7f22DcBcC95C"}
export DEV_ETH_GENESIS_START_GAS=${DEV_ETH_GENESIS_START_GAS:-"0x204fce5e3e25026110000000"}
export DEV_ETH_ACCOUNT_VALIDATOR="0x$(eth-keyfile -d $OPENETHEREUM_CONFIG/keyfile_validator.json)"
# export DEV_ETH_ACCOUNT_VALIDATOR="0xFA14198a6dc184D758F3B7308a2a85F361123e85"
# export DEV_ETH_GENESIS_EXTRA_DATA="0x$(cat $OPENETHEREUM_CHAIN/.extra)"
cp -v var/$OPENETHEREUM_CHAIN/$OPENETHEREUM_CHAIN.json > $OPENETHEREUM_CONFIG/$OPENETHEREUM_CHAIN.json
# Bootnode.toml
export SIGNER_ADDRESS=$DEV_ETH_ACCOUNT_VALIDATOR
./aux/bash-templater/templater.sh var/$OPENETHEREUM_CHAIN/bootnode.toml > $OPENETHEREUM_CONFIG/bootnode.toml ./aux/bash-templater/templater.sh var/$OPENETHEREUM_CHAIN/bootnode.toml > $OPENETHEREUM_CONFIG/bootnode.toml
cp -v var/$OPENETHEREUM_CHAIN/$OPENETHEREUM_CHAIN.json $OPENETHEREUM_CONFIG/
if [ -f var/$OPENETHEREUM_CHAIN/bootnodes.txt ] ; then if [ -f var/$OPENETHEREUM_CHAIN/bootnodes.txt ] ; then
cp -v var/$OPENETHEREUM_CHAIN/bootnodes.txt $OPENETHEREUM_CONFIG/ cp -v var/$OPENETHEREUM_CHAIN/bootnodes.txt $OPENETHEREUM_CONFIG/
fi fi
# Systemd
./aux/bash-templater/templater.sh systemd/node.service > $HOME/.config/systemd/user/$OPENETHEREUM_CHAIN.service ./aux/bash-templater/templater.sh systemd/node.service > $HOME/.config/systemd/user/$OPENETHEREUM_CHAIN.service
./aux/bash-templater/templater.sh systemd/env/01-$OPENETHEREUM_CHAIN.conf > $HOME/.config/environment.d/01-$OPENETHEREUM_CHAIN.conf ./aux/bash-templater/templater.sh systemd/env/01-$OPENETHEREUM_CHAIN.conf > $HOME/.config/environment.d/01-$OPENETHEREUM_CHAIN.conf
systemctl --user daemon-reload systemctl --user daemon-reload
systemctl --user enable $OPENETHEREUM_CHAIN
systemctl --user start $OPENETHEREUM_CHAIN
else else
echo Found $OPENETHEREUM_RUN directory! Skipping echo Found $OPENETHEREUM_CONFIG directory! Skipping
fi fi

View File

@ -65,7 +65,7 @@ chmod 0700 -v $HOME/.config/cic/staff-client/.gnupg
gpg --homedir $t --pinentry-mode loopback --passphrase-file $password_file --export-secret-keys | gpg --pinentry-mode loopback --passphrase-file $password_file --homedir $HOME/.config/cic/staff-client/.gnupg --import gpg --homedir $t --pinentry-mode loopback --passphrase-file $password_file --export-secret-keys | gpg --pinentry-mode loopback --passphrase-file $password_file --homedir $HOME/.config/cic/staff-client/.gnupg --import
gpg --homedir $HOME/.config/cic/staff-client/.gnupg --export -a > $HOME/.config/cic/staff-client/user.asc gpg --homedir $HOME/.config/cic/staff-client/.gnupg --export -a > $HOME/.config/cic/staff-client/user.asc
gpg --list-packets $HOME/.config/cic/staff-client/user.asc | awk '/issuer fpr/ { print $9; }' | cut -b -40 > $HOME/.config/cic/staff-client/key_fingerprint gpg --list-packets $HOME/.config/cic/staff-client/user.asc | awk '/issuer fpr/ { print $9; exit}' | cut -b -40 > $HOME/.config/cic/staff-client/key_fingerprint
gpg --homedir $HOME/.config/cic/staff-client/.gnupg --pinentry-mode loopback --passphrase-file $password_file --quick-add-key `cat $HOME/.config/cic/staff-client/key_fingerprint` default encrypt 0 gpg --homedir $HOME/.config/cic/staff-client/.gnupg --pinentry-mode loopback --passphrase-file $password_file --quick-add-key `cat $HOME/.config/cic/staff-client/key_fingerprint` default encrypt 0

View File

@ -3,8 +3,8 @@ mkdir -vp $HOME/.config/environment.d
. aux/bdbg/bdbg.sh . aux/bdbg/bdbg.sh
_level=2 _level=${BASH_DEBUG_LEVEL:-2}
_debug=1 _debug=${BASH_DEBUG:-0}
cp -v systemd/cic-cache-server.service $HOME/.config/systemd/user/ cp -v systemd/cic-cache-server.service $HOME/.config/systemd/user/
@ -27,3 +27,5 @@ cp -v systemd/bin/cic_cache_server_start.sh $HOME/.local/bin/
chmod -v 750 $HOME/.local/bin/cic_cache_server_start.sh chmod -v 750 $HOME/.local/bin/cic_cache_server_start.sh
systemctl --user daemon-reload systemctl --user daemon-reload
systemctl --user start cic-cache-tracker
systemctl --user start cic-cache-server

View File

@ -3,7 +3,7 @@ Description="{{OPENETHEREUM_CHAIN}} openethereum node"
After=network.target After=network.target
[Service] [Service]
ExecStart=/bin/bash -c ${OPENETHEREUM_PATH} --config ${OPENETHEREUM_CONFIG}/bootnode.toml ExecStart={{OPENETHEREUM_PATH}} --config {{OPENETHEREUM_CONFIG}}/bootnode.toml
[Install] [Install]
WantedBy=network.target WantedBy=network.target

View File

@ -1,5 +1,9 @@
red=`tput setaf 1` red=`tput setaf 1`
reset=`tput sgr0` reset=`tput sgr0`
systemctl --user stop kitabu
systemctl --user stop bloxberg
systemctl --user disable kitabu
systemctl --user disable bloxberg
echo -n " echo -n "
${red}WARNING:${reset} The following will be DELETED if present: ${red}WARNING:${reset} The following will be DELETED if present:
Directories: Directories:
@ -7,6 +11,7 @@ ${red}WARNING:${reset} The following will be DELETED if present:
$HOME/.config/io.parity.ethereum $HOME/.config/io.parity.ethereum
Files: Files:
$HOME/.local/bin/openethereum $HOME/.local/bin/openethereum
$HOME/.local/share/openethereum
$HOME/.local/bin/parity $HOME/.local/bin/parity
$HOME/.config/systemd/user/kitabu.service $HOME/.config/systemd/user/kitabu.service
$HOME/.config/systemd/user/bloxberg.service $HOME/.config/systemd/user/bloxberg.service
@ -14,19 +19,20 @@ ${red}WARNING:${reset} The following will be DELETED if present:
$HOME/.config/environment.d/01-kitabu.conf $HOME/.config/environment.d/01-kitabu.conf
Would you still like to continue? (y/n):" Would you still like to continue? (y/n):"
read confirmed read confirmed
if [ "$confirmed" == "y" ]; then if [ "$confirmed" == "y" ]; then
echo "Deleting..." echo "Deleting..."
rm -rf $HOME/.local/share/io.parity.ethereum rm -rf $HOME/.local/share/io.parity.ethereum
rm -rf $HOME/.config/io.parity.ethereum rm -rf $HOME/.config/io.parity.ethereum
rm $HOME/.local/bin/openethereum rm $HOME/.local/bin/openethereum
rm $HOME/.local/bin/parity rm $HOME/.local/bin/parity
rm -rf $HOME/.local/share/openethereum
rm $HOME/.config/systemd/user/kitabu.service rm $HOME/.config/systemd/user/kitabu.service
rm $HOME/.config/systemd/user/bloxberg.service rm $HOME/.config/systemd/user/bloxberg.service
rm $HOME/.config/environment.d/01-bloxberg.conf rm $HOME/.config/environment.d/01-bloxberg.conf
rm $HOME/.config/environment.d/01-kitabu.conf rm $HOME/.config/environment.d/01-kitabu.conf
echo "Done" echo "Done"
else else
echo "Aborting" echo "Aborting"
fi fi
exit 0 exit 0

View File

@ -1,15 +1,75 @@
# Usefull when an install fails half way through # Example Usage
# bash <(curl -s https://git.grassecon.net/grassrootseconomics/cic-staff-installer/raw/branch/lum/kitabu/uninstall.sh)
# This is currently living on at pip because root is using a self signed cert
# When changes are made to this file you must run bash ./rsync/rsync-install-script.sh to sync it to the server
red=`tput setaf 1` red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0` reset=`tput sgr0`
echo -n "${red}WARNING:${reset} This will delete all your keys and settings. Continue? (y/n):" bold=$(tput bold)
read confirmed normal=$(tput sgr0)
if [ "$confirmed" == "y" ]; then
echo "Deleting all keys and settings..." echo -n "
rm -rf $HOME/.local/share/cic/ ${red}WARNING:${reset} The following will be DELETED if present:
rm -rf $HOME/.config/cic Directories:
echo "Done" $HOME/.local/share/cic/cache
else $HOME/.local/share/cic/clicada
$HOME/.config/cic/clicada
$HOME/.config/cic/cache
Files:
$HOME/.config/cic/staff-client/.envinit
$HOME/.config/systemd/user/cic-cache-tracker.service
$HOME/.config/systemd/user/cic-cache-server.service
$HOME/.config/environment.d/01-cic-cache-server.conf
$HOME/.config/environment.d/01-cic-cache-tracker.conf
$HOME/.local/bin/cic_cache_server_start.sh
$HOME/.local/bin/migrate_cic_cache.py
Would you still like to continue? (y/n):"
read confirmed
if [ "$confirmed" == "y" ]; then
echo "Stopping Services.."
systemctl --user stop cic-cache-tracker
systemctl --user stop cic-cache-server
systemctl --user disable cic-cache-tracker
systemctl --user disable cic-cache-server
pip3 uninstall clicada cic cic-cache
echo "Deleting..."
rm -rf $HOME/.local/share/cic/cache
rm -rf $HOME/.local/share/cic/clicada
rm -rf $HOME/.config/cic/clicada
rm -rf $HOME/.config/cic/cache
rm $HOME/.config/cic/staff-client/.envinit
rm $HOME/.config/systemd/user/cic-cache-tracker.service
rm $HOME/.config/systemd/user/cic-cache-server.service
rm $HOME/.config/environment.d/01-cic-cache-server.conf
rm $HOME/.config/environment.d/01-cic-cache-tracker.conf
rm $HOME/.local/bin/cic_cache_server_start.sh
rm $HOME/.local/bin/migrate_cic_cache.py
echo "${green}Done${reset}"
else
echo "Aborting" echo "Aborting"
fi fi
echo -n "${bold}${red}WARNING:${reset} The following will be ${bold}${red}DELETED${reset} if present:
Directories:
$HOME/.local/share/cic/.gnupg
$HOME/.config/cic/staff-client/.gnupg
Files:
$HOME/.config/cic/staff-client/user.asc
$HOME/.config/cic/staff-client/key_fingerprint
${bold}${red} Would you like to delete the CIC Keyrings? (y/n):
"
read confirmed
if [ "$confirmed" == "y" ]; then
echo "Deleting all keychains..."
rm -rf $HOME/.local/share/cic/.gnupg
rm -rf $HOME/.config/cic/staff-client/.gnupg
echo "${green}Done${reset}"
else
echo "Aborting"
fi
exit 0 exit 0

View File

@ -1,20 +1,30 @@
[parity] [parity]
chain = "kitabu.json" chain = "{{OPENETHEREUM_CONFIG}}/{{OPENETHEREUM_CHAIN}}.json"
base_path = "data" base_path = "{{OPENETHEREUM_CONFIG}}/data"
[network] [network]
port = 30303 port = 30303
#reserved_peers = "{{CONFIG_DIR}}/bootnodes.txt"
# reserved_only = true # reserved_only = true
max_peers = 10 max_peers = 10
snapshot_peers = 25 snapshot_peers = 25
#nat = "extip:100.102.26.121" #nat = "extip:100.102.26.121"
nat = "extip:159.223.92.107" nat = "extip:159.223.92.107" # !TODO ask louis
reserved_peers = "{{OPENETHEREUM_CONFIG}}/bootnodes.txt"
[rpc] [rpc]
port = 8545 port = 8545
apis = ["web3", "eth", "net", "personal", "parity", "parity_set", "traces", "rpc", "parity_accounts"] apis = [
"web3",
"eth",
"net",
"personal",
"parity",
"parity_set",
"traces",
"rpc",
"parity_accounts",
]
interface = "all" interface = "all"
cors = ["*"] cors = ["*"]
@ -25,11 +35,11 @@ interface = "all"
origins = ["all"] origins = ["all"]
[account] [account]
password = ["kitabu.pwd"] password = ["{{OPENETHEREUM_CONFIG}}/bootnode.pwd"]
[mining] [mining]
#CHANGE ENGINE SIGNER TO VALIDATOR ADDRESS #CHANGE ENGINE SIGNER TO VALIDATOR ADDRESS
engine_signer = "0x4081020ac03e06391b6045ad14553e75edec9e67" engine_signer = "{{SIGNER_ADDRESS}}"
reseal_on_txs = "none" reseal_on_txs = "none"
force_sealing = true force_sealing = true
min_gas_price = 1 min_gas_price = 1

1
var/kitabu/bootnodes.txt Normal file
View File

@ -0,0 +1 @@
enode://1afcca0aa282672539aa16c4319b659476fa2c05bf0756408108bf149c5c31c59e71a7f5ac98c1335a59653f25c93c54afacbb101e48d361f55c6cf224c6966e@159.223.42.214:30303

View File

@ -4,10 +4,12 @@
"engine": { "engine": {
"clique": { "clique": {
"params": { "params": {
"period": 2, "period": 3,
"epoch": 30000, "epoch": 30000,
"validators": [ "validators": [
"0x4081020ac03e06391b6045ad14553e75edec9e67" "0x77Bea3320Fa46aFF3C7c128B83F5E436596Ba73D",
"0xcC66240bAdA17eb4C6313FB3FF83e19dfB20C973",
"0xFA14198a6dc184D758F3B7308a2a85F361123e85"
] ]
} }
} }
@ -47,8 +49,8 @@
"genesis": { "genesis": {
"author": "0x0000000000000000000000000000000000000000", "author": "0x0000000000000000000000000000000000000000",
"difficulty": "0x1", "difficulty": "0x1",
"extraData": "0x536172616675204b61726962752053616e6100000000000000000000000000005C5aB0D602EEF41f82B6fc087A24e61383589C398c6f7b75d90c3b32bdc9b4fcfbb4ad43c853446a2c0c9d3a9590a3349c8e45ce50446bd276cbb99c1f38132cd7e520d6be0ccba78acc59ab50a82f711ff7cb9d00", "extraData": "0x4b697461627520536172616675204b61726962752053616e610000000000000077Bea3320Fa46aFF3C7c128B83F5E436596Ba73D8bb96896b28488cd7ee91949752970d2b6a89a41c775a616732c57edc7619c0a774b72f1b1df32930c1620aa834b202a86e300f7a8d885a635b778a32904703000",
"gasLimit": "0xb00000", "gasLimit": "0x7d0000",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"seal": { "seal": {
"ethereum": { "ethereum": {
@ -927,8 +929,11 @@
"0x00000000000000000000000000000000000000ff": { "0x00000000000000000000000000000000000000ff": {
"balance": "0x1" "balance": "0x1"
}, },
"0x4081020ac03e06391b6045ad14553e75edec9e67": { "0x77Bea3320Fa46aFF3C7c128B83F5E436596Ba73D": {
"balance": "0x152d02c7e14af6800000" "balance": "0x204fce5e3e25026110000000"
},
"0xcC66240bAdA17eb4C6313FB3FF83e19dfB20C973": {
"balance": "0x204fce5e3e25026110000000"
} }
} }
} }