-
Notifications
You must be signed in to change notification settings - Fork 547
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- update dump - use dockers
- Loading branch information
Showing
8 changed files
with
3,637 additions
and
1,487 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,67 @@ | ||
#!/bin/bash | ||
|
||
TEST_DIR=/workdir/src/app/replayer/test | ||
PGPASSWORD=arbitraryduck | ||
TEST_DIR=/workdir/src/app/replayer/ | ||
|
||
set -eo pipefail | ||
set -eox pipefail | ||
|
||
echo "Updating apt, installing packages" | ||
apt-get update | ||
|
||
# Don't prompt for answers during apt-get install | ||
export DEBIAN_FRONTEND=noninteractive | ||
|
||
# time zone = US Pacific | ||
/bin/echo -e "12\n10" | apt-get install -y tzdata | ||
apt-get install -y git postgresql apt-transport-https ca-certificates curl | ||
apt-get install -y git apt-transport-https ca-certificates curl wget | ||
|
||
git config --global --add safe.directory /workdir | ||
git config --global --add safe.directory $BUILDKITE_BUILD_CHECKOUT_PATH | ||
|
||
source buildkite/scripts/export-git-env-vars.sh | ||
|
||
echo "deb [trusted=yes] http://packages.o1test.net bullseye ${MINA_DEB_RELEASE}" | tee /etc/apt/sources.list.d/mina.list | ||
apt-get update | ||
DB=archive | ||
DOCKER_IMAGE=12.4-alpine | ||
CONTAINER_FILE=docker.container | ||
|
||
PG_PORT=5433 | ||
PG_PASSWORD=somepassword | ||
DOCKER_IMAGE=12.4-alpine | ||
CONTAINER_FILE=docker.container | ||
|
||
function cleanup () { | ||
CONTAINER=`cat $CONTAINER_FILE` | ||
|
||
if [[ ! -z $CONTAINER ]] ; then | ||
echo "Killing, removing docker container" | ||
for action in kill rm; do | ||
docker container $action $CONTAINER | ||
done | ||
fi | ||
|
||
rm -f $CONTAINER_FILE | ||
} | ||
|
||
docker network create replayer || true | ||
|
||
echo "Installing archive node package: mina-archive=${MINA_DEB_VERSION}" | ||
apt-get install --allow-downgrades -y mina-archive=${MINA_DEB_VERSION} | ||
# -v mounts dir with Unix socket on host | ||
echo "Starting docker with Postgresql" | ||
docker run \ | ||
--network replayer \ | ||
--volume $BUILDKITE_BUILD_CHECKOUT_PATH:/workdir \ | ||
--name replayer-postgres -d -p $PG_PORT:5432 \ | ||
-e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=$PG_PASSWORD -e POSTGRES_DB=$DB postgres:$DOCKER_IMAGE > $CONTAINER_FILE | ||
|
||
echo "Generating locale for Postgresql" | ||
locale-gen en_US.UTF-8 | ||
trap "cleanup; exit 1" SIGINT | ||
|
||
echo "Starting Postgresql service" | ||
service postgresql start | ||
# wait for Postgresql to become available | ||
sleep 5 | ||
|
||
echo "Populating archive database" | ||
cd ~postgres | ||
su postgres -c psql < $TEST_DIR/archive_db.sql | ||
echo "ALTER USER postgres PASSWORD '$PGPASSWORD';" | su postgres -c psql | ||
cd /workdir | ||
|
||
echo "Running replayer" | ||
mina-replayer --archive-uri postgres://postgres:$PGPASSWORD@localhost:5432/archive \ | ||
--input-file $TEST_DIR/input.json --output-file /dev/null | ||
|
||
NETWORK_GATEWAY=$(docker network inspect -f "{{(index .IPAM.Config 0).Gateway}}" replayer) | ||
|
||
PG_CONN="postgres://postgres:$PG_PASSWORD@$NETWORK_GATEWAY:$PG_PORT/$DB" | ||
|
||
|
||
docker exec replayer-postgres psql $PG_CONN -f $TEST_DIR/test/archive_db.sql | ||
|
||
docker run --network replayer --volume $BUILDKITE_BUILD_CHECKOUT_PATH:/workdir gcr.io/o1labs-192920/mina-archive:$MINA_DOCKER_TAG /workdir/scripts/replayer-test.sh -d $TEST_DIR -a mina-replayer -p $PG_CONN | ||
|
||
cleanup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<XLarge|Large|Medium|Small|Integration> | ||
<XLarge|Large|Medium|Small|Integration|QA> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.