Compare commits

...

2 Commits

Author SHA1 Message Date
nolash
64d7e032a0
Turn off bloxberg install by default 2021-11-11 08:29:55 +01:00
nolash
341194291a
Add systemd initialization 2021-11-11 08:29:03 +01:00
10 changed files with 94 additions and 13 deletions

View File

@ -2,7 +2,8 @@
want_cic_cache_version=0.2.1a10
want_cicada_version=0.0.1a7
want_evm=bloxberg
#want_evm=bloxberg
want_evm=
. aux/bdbg/bdbg.sh
@ -32,6 +33,7 @@ done
t=`mktemp`
dbg $dbg_debug "identify root values"
set -e
# check if we have existing setup
if [ ! -f "$HOME/.config/cic/staff-client/key_fingerprint" ]; then
dbg $dbg_debug "load default environment"
@ -81,7 +83,12 @@ if [ ! -f "$HOME/.config/cic/staff-client/key_fingerprint" ]; then
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/staff-client/.gnupg
export
fi
set +e
dbg $dbg_debug "checking installed versions"
@ -149,14 +156,16 @@ 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"
@ -167,3 +176,11 @@ python ../cic-internal-integration/apps/cic-cache/scripts/migrate.py -c $HOME/.c
if [ ! -z $want_evm ]; then
. setup_${want_evm}.sh
fi
t=`mktemp`
clicada --dumpconfig env $clicada_config_flag -vv > $t
set -a
. $t
set +a
. setup_systemd.sh

View File

@ -7,7 +7,7 @@ function checkk {
fi
}
exec=(clang git rustup gcc cmake pip python3 psql postgres)
exec=(systemctl clang git rustup gcc cmake pip python3 psql postgres)
for e in ${exec[@]}; do
dbg $dbg_trace "Checking for dependency $e"

View File

@ -33,17 +33,45 @@ echo "If you lose this passphrase you WILL lose access to your key PERMANENTLY."
echo "Keep it secret."
echo -e "Keep it safe.\e[0m"
stty -echo
password_match=
while [ -z $password_match ]; do
echo
echo -n "password: "
read password
echo
echo -n "password again: "
read password_again
echo
if [ "$password" == "$password_again" ]; then
password_match=1
else
echo "passwords do not match, try again"
fi
done
stty echo
password_file=`mktemp`
touch $password_file
chmod -v 600 $password_file
echo -n $password > $password_file
t=`mktemp -d`
gpg --homedir $t --quick-gen-key "$pgp_name (CIC staff client signing key) <$pgp_email>" secp256k1 sign 0
gpg --homedir $t --pinentry-mode loopback --passphrase-file $password_file --quick-gen-key "$pgp_name (CIC staff client signing key) <$pgp_email>" secp256k1 sign 0
echo -e "\e[0;93mNow let's see if you've forgotten your passphrase already"
echo -e "Please enter it again at the given prompts to import the newly created key into your environment\e[0m"
#echo -e "\e[0;93mNow let's see if you've forgotten your passphrase already"
#echo -e "Please enter it again at the given prompts to import the newly created key into your environment\e[0m"
mkdir -vp $HOME/.config/cic/staff-client/.gnupg
chmod 0700 -v $HOME/.config/cic/staff-client/.gnupg
gpg --homedir $t --export-secret-keys | gpg --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 --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 --homedir $t --pinentry-mode loopback --passphrase-file $password_file --quick-add-key `cat $HOME/.config/cic/staff-client/key_fingerprint` default encrypt 0
shred -v $password_file

View File

@ -10,7 +10,7 @@ function update_path {
fi
done
if [ -z "$matchpath" ]; then
dbg dbg_info "Adding executable path $pathdir to \$PATH"
dbg $dbg_info "Adding executable path $pathdir to \$PATH"
export PATH=$PATH:$pathdir
echo "export PATH=\$PATH:$pathdir" >> $HOME/.bashrc
fi

20
setup_systemd.sh Normal file
View File

@ -0,0 +1,20 @@
mkdir -vp $HOME/.config/systemd/user
mkdir -vp $HOME/.config/environment.d
. aux/bdbg/bdbg.sh
_level=2
_debug=1
cp -v systemd/*.service $HOME/.config/systemd/user/
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
done
#cp -v systemd/env/*.conf $HOME/.config/environment.d/
cp -v systemd/bin/cic_cache_server_start.sh $HOME/.local/bin/
chmod -v 750 $HOME/.local/bin/cic_cache_server_start.sh

View File

@ -2,4 +2,4 @@
t=`mktemp`
f=`python -c "import cic_cache; import os; s = os.path.dirname(cic_cache.__file__); print(os.path.join(s, 'runnable', 'daemons', 'server.py'))"`
uwsgi --wsgi-file $f --http $SERVER_HOST:$SERVER_PORT --pyargv "-c $HOME/.config/cic/cache $@"
uwsgi --plugin python --wsgi-file $f --http $SERVER_HOST:$SERVER_PORT --pyargv "-c $HOME/.config/cic/cache $@"

View File

@ -0,0 +1,10 @@
[Unit]
Description=CIC transaction cache syncer
After=network.target
[Service]
ExecStart=%h/.local/bin/cic_cache_server_start.sh -vv
Restart=always
[Install]
WantedBy=network.target

View File

@ -3,8 +3,8 @@ Description=CIC transaction cache syncer
After=network.target
[Service]
ExecStart="cic-cache-trackerd -c %h/.config/cic/cache"
ExecStart=%h/.local/bin/cic-cache-trackerd -c %h/.config/cic/cache
Restart=always
[Install]
After=network.target
WantedBy=network.target

6
systemd/env/01-cic-cache-server.conf vendored Normal file
View File

@ -0,0 +1,6 @@
RPC_PROVIDER={{RPC_PROVIDER}}
CHAIN_SPEC={{CHAIN_SPEC}}
SERVER_HOST=localhost
SERVER_PORT=8636
TX_CACHE_URL=http://localhost:8636
#META_URL=

View File

@ -1,2 +1,2 @@
RPC_PROVIDER={{RPC_PROVIDER=http://localhost:8545}}
CHAIN_SPEC={{CHAIN_SPEC=evm:byzantium:8995:bloxberg}}
RPC_PROVIDER={{RPC_PROVIDER}}
CHAIN_SPEC={{CHAIN_SPEC}}