Merge branch 'dev' into feat/lam-1291/stress-testing
* dev: (85 commits) chore: console.log debug leftovers fix: third level navigation links fix: show subheader on refresh fix: machines/:id routing fix: customer route chore: update wallet nodes feat: shorten long addresses in funding page feat: shorten long addresses refactor: support copied text different from presented text chore: udpate react, downshift and routing refactor: use Wizard component on first route fix: autocomplete component rendering feat: skip2fa option on .env fix: drop contraint before dropping index chore: stop using alias imports fix: re-instate urlResolver chore: server code formatting chore: reformat code chore: adding eslint and prettier config chore: typo ...
This commit is contained in:
commit
e10493abc6
1398 changed files with 60329 additions and 157527 deletions
50
packages/server/tests/stress/scripts/create-machines.sh
Normal file
50
packages/server/tests/stress/scripts/create-machines.sh
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
echo "usage: ./build-machines [number_of_machines] /path/to/server/cert/lamassu_op_root_ca.pem /path/to/machine/" && exit 1
|
||||
fi
|
||||
|
||||
SERVER_CERT=$(perl -pe 's/\n/\\n/' < $2)
|
||||
if [ -z "$SERVER_CERT" ]
|
||||
then
|
||||
echo "Lamassu-op-root-ca.pem is empty" && exit 1
|
||||
fi
|
||||
|
||||
# Create stress database
|
||||
sudo -u postgres psql postgres -c "drop database if exists lamassu_stress"
|
||||
sudo -u postgres psql postgres -c "create database lamassu_stress with template lamassu"
|
||||
|
||||
START=1
|
||||
END=$1
|
||||
for (( c=$START; c<=$END; c++ ))
|
||||
do
|
||||
echo "Creating machine $c out of $END..."
|
||||
NUMBER=$c
|
||||
mkdir -p ./machines/$NUMBER/
|
||||
cp "$3"/data/client.sample.pem ./machines/$NUMBER/
|
||||
cp "$3"/data/client.sample.key ./machines/$NUMBER/
|
||||
|
||||
cat > ./machines/$NUMBER/connection_info.json << EOF
|
||||
{"host":"localhost","ca":"$SERVER_CERT"}
|
||||
EOF
|
||||
|
||||
# Get device_id
|
||||
DEVICE_ID=`openssl x509 -outform der -in ./machines/$NUMBER/client.pem | sha256sum | cut -d ' ' -f 1`
|
||||
|
||||
# Update db config
|
||||
NEW_CONFIG=$(node ./utils/save-config.js $NUMBER $DEVICE_ID)
|
||||
sudo -u postgres psql "lamassu_stress" << EOF
|
||||
insert into user_config(type, data, created, valid)
|
||||
values('config', '$NEW_CONFIG', now(), 't')
|
||||
EOF
|
||||
|
||||
# Add device on db
|
||||
sudo -u postgres psql "lamassu_stress" << EOF
|
||||
insert into devices(device_id, cashbox, cassette1, cassette2, paired, display, created, name, last_online, location)
|
||||
values ('$DEVICE_ID', 0, 0, 0, 't', 't', now(), $NUMBER, now(), '{}'::json)
|
||||
EOF
|
||||
done
|
||||
|
||||
echo "Done!"
|
||||
Loading…
Add table
Add a link
Reference in a new issue