chore: cleanup

This commit is contained in:
William Luke 2022-02-14 16:31:24 +03:00
parent 5c0ae5a430
commit d6114f43f2
15 changed files with 1344 additions and 1168 deletions

View File

@ -1,7 +1,7 @@
# 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
# 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'
verbose='false'
@ -11,7 +11,7 @@ print_usage() {
printf "CIC Staff Installer
Options:
-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
-h Print this help message
"
@ -29,7 +29,13 @@ while getopts 'e:hb:v' flag; do
esac
done
export INSTALL_EVM=${evm}
if [ ! -z $INSTALL_EVM ]; then
. setup_evm.sh
fi
temp_dir=`mktemp -d`
git clone -b $branch https://git.grassecon.net/grassrootseconomics/cic-staff-installer.git $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

View File

@ -1,2 +1,2 @@
0826EDA1702D1E87C6E2875121D2E7BB88C2A746:6:
215D7EB6661AD0424219FA3AB4F81B106B081C23:6:
215D7EB6661AD0424219FA3AB4F81B106B081C23:6:

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

311
setup.sh
View File

@ -2,12 +2,168 @@
want_cic_cache_version=0.3.0a2
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
_debug=1
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
}
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_INDEX_URL=${PIP_EXTRA_INDEX_URL:-https://pip.grassrootseconomics.net}
@ -17,8 +173,8 @@ CIC_ROOT_URL=${CIC_ROOT_URL:-https://root.grassrootseconomics.net/env/dev}
CIC_ROOT_CA_FILE=${CIC_ROOT_CA_FILE:-keys/ge.ca}
if [ "$UID" -eq 0 ]; then
dbg $dbg_error "This cannot be run as root"
exit 1
dbg $dbg_error "This cannot be run as root"
exit 1
fi
. setup_check.sh
@ -27,148 +183,27 @@ fi
mkdir -vp $HOME/.local/bin
dbg $dbg_debug "importing keys"
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
setup_cic_gpg
# check if we have existing setup
if [ ! -e "$HOME/.config/cic/staff-client/.envinit" ]; then
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`
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"
init_env
fi
set +e
dbg $dbg_debug "checking installed versions"
update=0
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 "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
check_cache_version
check_cicada_version
set -e
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
update_requirements
dbg $dbg_debug "installing configurations"
t=`mktemp`
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 -vv > $t
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
install_cache_configuration
install_clicada_configuration
export_cache_tracker_config
execute_cache_database_migrations
export_clicada_config
. setup_systemd.sh
if [ ! -z $INSTALL_EVM ]; then
. setup_evm.sh
fi

View File

@ -1,80 +1,120 @@
load_env(){
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/openethereum}
openethereum_dir=`realpath $(dirname $OPENETHEREUM_PATH)`
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_TYPE=${OPENETHEREUM_TYPE:-$default_openethereum_type}
}
download_openethereum() {
dbg $dbg_debug "downloading openethereum node"
openethereum_version="3.3.3"
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
fi
unzip openethereum-linux-v$openethereum_version.zip
rm openethereum-linux-v$openethereum_version.zip
./openethereum --version
mv ./openethereum $openethereum_dir/openethereum
export OPENETHEREUM_PATH=$openethereum_dir/openethereum
}
build_openethereum() {
dbg $dbg_debug "building bloxberg node"
t=`mktemp -d`
pushd $t
install_env=1
git clone $GIT_OPENETHEREUM
cd openethereum
git checkout 2662d1925ec794f3ad7c5759b2412ff5128d259b
rustup install 1.47.0
cargo build --release --features final
cp -v $t/target/release/parity $openethereum_dir/openethereum
export OPENETHEREUM_PATH=$openethereum_dir/openethereum
}
. aux/bdbg/bdbg.sh
. setup_path.sh
# set -o xtrace
GIT_OPENETHEREUM=${GIT_OPENETHEREUM:-https://github.com/openethereum/openethereum}
load_env
default_openethereum_chain="kitabu" # bloxberg | kitabu
export OPENETHEREUM_CHAIN=${INSTALL_EVM:-$default_openethereum_chain}
OPENETHEREUM_PATH=${OPENETHEREUM_PATH:-$HOME/.local/bin/parity}
openethereum_dir=`realpath $(dirname $OPENETHEREUM_PATH)`
default_openethereum_run=$HOME/.local/share/io.parity.ethereum/$OPENETHEREUM_CHAIN
default_openethereum_config=$HOME/.config/io.parity.ethereum/$OPENETHEREUM_CHAIN
export OPENETHEREUM_RUN=${OPENETHEREUM_RUN:-$default_openethereum_run}
export OPENETHEREUM_CONFIG=${OPENETHEREUM_CONFIG:-$default_openethereum_config}
default_openethereum_type="binary" # source | binary
export OPENETHEREUM_TYPE=${OPENETHEREUM_TYPE:-$default_openethereum_type}
download_openethereum() {
openethereum_version="3.3.3"
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
fi
unzip openethereum-linux-v$openethereum_version.zip
rm openethereum-linux-v$openethereum_version.zip
./openethereum --version
mv ./openethereum $openethereum_dir/parity
export OPENETHEREUM_PATH=$openethereum_dir/parity
}
build_openethereum() {
dbg $dbg_debug "downloading bloxberg node"
t=`mktemp -d`
pushd $t
install_env=1
git clone $GIT_OPENETHEREUM
cd openethereum
git checkout 2662d1925ec794f3ad7c5759b2412ff5128d259b
rustup install 1.47.0
cargo build --release --features final
cp -v $t/target/release/parity $openethereum_dir
export OPENETHEREUM_PATH=$openethereum_dir/parity
}
install_env=
if [ ! -f $OPENETHEREUM_PATH ]; then
# Download and Build parity from git $GIT_OPENETHEREUM
if [ "$OPENETHEREUM_TYPE" = "source" ]; then
build_openethereum
else
download_openethereum
fi
# Download and Build parity from git $GIT_OPENETHEREUM
if [ "$OPENETHEREUM_TYPE" = "source" ]; then
build_openethereum
else
download_openethereum
fi
else
dbg $dbg_info "found bloxberg node executable in $OPENETHEREUM_PATH"
dbg $dbg_info "found evm node executable in $OPENETHEREUM_PATH"
fi
#OPENETHEREUM_RUN=~/.local/share/io.parity.ethereum/$OPENETHEREUM_CHAIN
if [ ! -d $OPENETHEREUM_RUN ]; then
mkdir -vp $OPENETHEREUM_RUN/bootnode
mkdir -vp $OPENETHEREUM_CONFIG
touch $OPENETHEREUM_CONFIG/bootnode.pwd
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
chmod -v 400 $OPENETHEREUM_CONFIG/bootnode.pwd
./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
cp -v var/$OPENETHEREUM_CHAIN/bootnodes.txt $OPENETHEREUM_CONFIG/
fi
./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
systemctl --user daemon-reload
#OPENETHEREUM_CONFIG=$HOME/.config/io.parity.ethereum/$OPENETHEREUM_CHAIN
if [ ! -d $OPENETHEREUM_CONFIG ]; then
install_dir=$(pwd)
mkdir -vp $OPENETHEREUM_CONFIG
cd $OPENETHEREUM_CONFIG
touch ./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
if [ -f var/$OPENETHEREUM_CHAIN/bootnodes.txt ] ; then
cp -v var/$OPENETHEREUM_CHAIN/bootnodes.txt $OPENETHEREUM_CONFIG/
fi
# Systemd
./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
systemctl --user daemon-reload
systemctl --user enable $OPENETHEREUM_CHAIN
systemctl --user start $OPENETHEREUM_CHAIN
else
echo Found $OPENETHEREUM_RUN directory! Skipping
echo Found $OPENETHEREUM_CONFIG directory! Skipping
fi
update_path $openethereum_dir
if [ ! -z "$install_env" ]; then
popd
popd
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 $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

View File

@ -3,8 +3,8 @@ mkdir -vp $HOME/.config/environment.d
. aux/bdbg/bdbg.sh
_level=2
_debug=1
_level=${BASH_DEBUG_LEVEL:-2}
_debug=${BASH_DEBUG:-0}
cp -v systemd/cic-cache-server.service $HOME/.config/systemd/user/
@ -15,10 +15,10 @@ dbg $dbg_info "using python bin path $PYTHON_BIN_PATH for systemd executables"
PYTHON_BIN_PATH=$PYTHON_BIN_PATH ./aux/bash-templater/templater.sh systemd/cic-cache-tracker.service > $HOME/.config/systemd/user/cic-cache-tracker.service
for f in systemd/env/*.conf; do
b=`basename $f`
p=$HOME/.config/environment.d/$b
dbg $dbg_debug "writing rendered environment file $p"
./aux/bash-templater/templater.sh $f > $p
b=`basename $f`
p=$HOME/.config/environment.d/$b
dbg $dbg_debug "writing rendered environment file $p"
./aux/bash-templater/templater.sh $f > $p
done
#cp -v systemd/env/*.conf $HOME/.config/environment.d/
@ -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
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
[Service]
ExecStart=/bin/bash -c ${OPENETHEREUM_PATH} --config ${OPENETHEREUM_CONFIG}/bootnode.toml
ExecStart={{OPENETHEREUM_PATH}} --config {{OPENETHEREUM_CONFIG}}/bootnode.toml
[Install]
WantedBy=network.target

View File

@ -1,12 +1,17 @@
red=`tput setaf 1`
reset=`tput sgr0`
systemctl --user stop kitabu
systemctl --user stop bloxberg
systemctl --user disable kitabu
systemctl --user disable bloxberg
echo -n "
${red}WARNING:${reset} The following will be DELETED if present:
Directories:
$HOME/.local/share/io.parity.ethereum
$HOME/.config/io.parity.ethereum
$HOME/.config/io.parity.ethereum
Files:
$HOME/.local/bin/openethereum
$HOME/.local/share/openethereum
$HOME/.local/bin/parity
$HOME/.config/systemd/user/kitabu.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
Would you still like to continue? (y/n):"
read confirmed
if [ "$confirmed" == "y" ]; then
read confirmed
if [ "$confirmed" == "y" ]; then
echo "Deleting..."
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/parity
rm -rf $HOME/.local/share/openethereum
rm $HOME/.config/systemd/user/kitabu.service
rm $HOME/.config/systemd/user/bloxberg.service
rm $HOME/.config/environment.d/01-bloxberg.conf
rm $HOME/.config/environment.d/01-kitabu.conf
echo "Done"
else
else
echo "Aborting"
fi
fi
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`
green=`tput setaf 2`
reset=`tput sgr0`
echo -n "${red}WARNING:${reset} This will delete all your keys and settings. Continue? (y/n):"
read confirmed
if [ "$confirmed" == "y" ]; then
echo "Deleting all keys and settings..."
rm -rf $HOME/.local/share/cic/
rm -rf $HOME/.config/cic
echo "Done"
else
bold=$(tput bold)
normal=$(tput sgr0)
echo -n "
${red}WARNING:${reset} The following will be DELETED if present:
Directories:
$HOME/.local/share/cic/cache
$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"
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

View File

@ -1,20 +1,30 @@
[parity]
chain = "kitabu.json"
base_path = "data"
chain = "{{OPENETHEREUM_CONFIG}}/{{OPENETHEREUM_CHAIN}}.json"
base_path = "{{OPENETHEREUM_CONFIG}}/data"
[network]
port = 30303
#reserved_peers = "{{CONFIG_DIR}}/bootnodes.txt"
# reserved_only = true
max_peers = 10
snapshot_peers = 25
#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]
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"
cors = ["*"]
@ -25,11 +35,11 @@ interface = "all"
origins = ["all"]
[account]
password = ["kitabu.pwd"]
password = ["{{OPENETHEREUM_CONFIG}}/bootnode.pwd"]
[mining]
#CHANGE ENGINE SIGNER TO VALIDATOR ADDRESS
engine_signer = "0x4081020ac03e06391b6045ad14553e75edec9e67"
engine_signer = "{{SIGNER_ADDRESS}}"
reseal_on_txs = "none"
force_sealing = true
min_gas_price = 1

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

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

File diff suppressed because it is too large Load Diff