Skip to content
Snippets Groups Projects
Verified Commit 6e830f3f authored by Konrad Botor's avatar Konrad Botor
Browse files

Switched Hivemind sync and start to services - ref. #198

parent a5f2f634
No related branches found
No related tags found
2 merge requests!827Merge develop changes to master,!594CI testing should use build instance sh and built image during 5m testing
...@@ -8,6 +8,8 @@ stages: ...@@ -8,6 +8,8 @@ stages:
variables: variables:
# HIVEMIND # HIVEMIND
RUNNER_HIVEMIND_SERVER_HTTP_PORT: 8080 RUNNER_HIVEMIND_SERVER_HTTP_PORT: 8080
RUNNER_HIVEMIND_BENCHMARK_SERVER_HOSTNAME: hivemind-benchmark
RUNNER_HIVEMIND_SMOKETEST_SERVER_HOSTNAME: hivemind-smoketest
# HAF # HAF
HAF_POSTGRES_URL: postgresql://haf_app_admin@haf-instance:5432/haf_block_log HAF_POSTGRES_URL: postgresql://haf_app_admin@haf-instance:5432/haf_block_log
HAF_ADMIN_POSTGRES_URL: postgresql://haf_admin@haf-instance:5432/haf_block_log HAF_ADMIN_POSTGRES_URL: postgresql://haf_admin@haf-instance:5432/haf_block_log
...@@ -68,7 +70,7 @@ workflow: ...@@ -68,7 +70,7 @@ workflow:
.bridge_api_smoketest-script: &bridge_api_smoketest-script .bridge_api_smoketest-script: &bridge_api_smoketest-script
- | - |
./scripts/ci/start-api-smoketest.sh \ ./scripts/ci/start-api-smoketest.sh \
localhost \ $RUNNER_HIVEMIND_SMOKETEST_SERVER_HOSTNAME \
$RUNNER_HIVEMIND_SERVER_HTTP_PORT \ $RUNNER_HIVEMIND_SERVER_HTTP_PORT \
bridge_api_patterns/ \ bridge_api_patterns/ \
api_smoketest_bridge.xml \ api_smoketest_bridge.xml \
...@@ -77,7 +79,7 @@ workflow: ...@@ -77,7 +79,7 @@ workflow:
.bridge_api_smoketest_negative-script: &bridge_api_smoketest_negative-script .bridge_api_smoketest_negative-script: &bridge_api_smoketest_negative-script
- | - |
./scripts/ci/start-api-smoketest.sh \ ./scripts/ci/start-api-smoketest.sh \
localhost \ $RUNNER_HIVEMIND_SMOKETEST_SERVER_HOSTNAME \
$RUNNER_HIVEMIND_SERVER_HTTP_PORT \ $RUNNER_HIVEMIND_SERVER_HTTP_PORT \
bridge_api_negative/ \ bridge_api_negative/ \
api_smoketest_bridge_negative.xml \ api_smoketest_bridge_negative.xml \
...@@ -86,7 +88,7 @@ workflow: ...@@ -86,7 +88,7 @@ workflow:
.condenser_api_smoketest-script: &condenser_api_smoketest-script .condenser_api_smoketest-script: &condenser_api_smoketest-script
- | - |
./scripts/ci/start-api-smoketest.sh \ ./scripts/ci/start-api-smoketest.sh \
localhost \ $RUNNER_HIVEMIND_SMOKETEST_SERVER_HOSTNAME \
$RUNNER_HIVEMIND_SERVER_HTTP_PORT \ $RUNNER_HIVEMIND_SERVER_HTTP_PORT \
condenser_api_patterns/ \ condenser_api_patterns/ \
api_smoketest_condenser_api.xml \ api_smoketest_condenser_api.xml \
...@@ -95,7 +97,7 @@ workflow: ...@@ -95,7 +97,7 @@ workflow:
.condenser_api_smoketest_negative-script: &condenser_api_smoketest_negative-script .condenser_api_smoketest_negative-script: &condenser_api_smoketest_negative-script
- | - |
./scripts/ci/start-api-smoketest.sh \ ./scripts/ci/start-api-smoketest.sh \
localhost \ $RUNNER_HIVEMIND_SMOKETEST_SERVER_HOSTNAME \
$RUNNER_HIVEMIND_SERVER_HTTP_PORT \ $RUNNER_HIVEMIND_SERVER_HTTP_PORT \
condenser_api_negative/ \ condenser_api_negative/ \
api_smoketest_condenser_api_negative.xml \ api_smoketest_condenser_api_negative.xml \
...@@ -104,7 +106,7 @@ workflow: ...@@ -104,7 +106,7 @@ workflow:
.database_api_smoketest-script: &database_api_smoketest-script .database_api_smoketest-script: &database_api_smoketest-script
- | - |
./scripts/ci/start-api-smoketest.sh \ ./scripts/ci/start-api-smoketest.sh \
localhost \ $RUNNER_HIVEMIND_SMOKETEST_SERVER_HOSTNAME \
$RUNNER_HIVEMIND_SERVER_HTTP_PORT \ $RUNNER_HIVEMIND_SERVER_HTTP_PORT \
database_api_patterns/ \ database_api_patterns/ \
api_smoketest_database_api.xml \ api_smoketest_database_api.xml \
...@@ -113,7 +115,7 @@ workflow: ...@@ -113,7 +115,7 @@ workflow:
.database_api_smoketest_negative-script: &database_api_smoketest_negative-script .database_api_smoketest_negative-script: &database_api_smoketest_negative-script
- | - |
./scripts/ci/start-api-smoketest.sh \ ./scripts/ci/start-api-smoketest.sh \
localhost \ $RUNNER_HIVEMIND_SMOKETEST_SERVER_HOSTNAME \
$RUNNER_HIVEMIND_SERVER_HTTP_PORT \ $RUNNER_HIVEMIND_SERVER_HTTP_PORT \
database_api_negative/ \ database_api_negative/ \
api_smoketest_database_api_negative.xml \ api_smoketest_database_api_negative.xml \
...@@ -122,7 +124,7 @@ workflow: ...@@ -122,7 +124,7 @@ workflow:
.follow_api_smoketest-script: &follow_api_smoketest-script .follow_api_smoketest-script: &follow_api_smoketest-script
- | - |
./scripts/ci/start-api-smoketest.sh \ ./scripts/ci/start-api-smoketest.sh \
localhost \ $RUNNER_HIVEMIND_SMOKETEST_SERVER_HOSTNAME \
$RUNNER_HIVEMIND_SERVER_HTTP_PORT \ $RUNNER_HIVEMIND_SERVER_HTTP_PORT \
follow_api_patterns/ \ follow_api_patterns/ \
api_smoketest_follow_api.xml \ api_smoketest_follow_api.xml \
...@@ -131,7 +133,7 @@ workflow: ...@@ -131,7 +133,7 @@ workflow:
.follow_api_smoketest_negative-script: &follow_api_smoketest_negative-script .follow_api_smoketest_negative-script: &follow_api_smoketest_negative-script
- | - |
./scripts/ci/start-api-smoketest.sh \ ./scripts/ci/start-api-smoketest.sh \
localhost \ $RUNNER_HIVEMIND_SMOKETEST_SERVER_HOSTNAME \
$RUNNER_HIVEMIND_SERVER_HTTP_PORT \ $RUNNER_HIVEMIND_SERVER_HTTP_PORT \
follow_api_negative/ \ follow_api_negative/ \
api_smoketest_follow_api_negative.xml \ api_smoketest_follow_api_negative.xml \
...@@ -140,7 +142,7 @@ workflow: ...@@ -140,7 +142,7 @@ workflow:
.tags_api_smoketest-script: &tags_api_smoketest-script .tags_api_smoketest-script: &tags_api_smoketest-script
- | - |
./scripts/ci/start-api-smoketest.sh \ ./scripts/ci/start-api-smoketest.sh \
localhost \ $RUNNER_HIVEMIND_SMOKETEST_SERVER_HOSTNAME \
$RUNNER_HIVEMIND_SERVER_HTTP_PORT \ $RUNNER_HIVEMIND_SERVER_HTTP_PORT \
tags_api_negative/ \ tags_api_negative/ \
api_smoketest_tags_api_negative.xml \ api_smoketest_tags_api_negative.xml \
...@@ -149,7 +151,7 @@ workflow: ...@@ -149,7 +151,7 @@ workflow:
.tags_api_smoketest_negative-script: &tags_api_smoketest_negative-script .tags_api_smoketest_negative-script: &tags_api_smoketest_negative-script
- | - |
./scripts/ci/start-api-smoketest.sh \ ./scripts/ci/start-api-smoketest.sh \
localhost \ $RUNNER_HIVEMIND_SMOKETEST_SERVER_HOSTNAME \
$RUNNER_HIVEMIND_SERVER_HTTP_PORT \ $RUNNER_HIVEMIND_SERVER_HTTP_PORT \
tags_api_patterns/ \ tags_api_patterns/ \
api_smoketest_tags_api.xml \ api_smoketest_tags_api.xml \
...@@ -158,7 +160,7 @@ workflow: ...@@ -158,7 +160,7 @@ workflow:
.mock_tests-script: &mock_tests-script .mock_tests-script: &mock_tests-script
- | - |
./scripts/ci/start-api-smoketest.sh \ ./scripts/ci/start-api-smoketest.sh \
localhost \ $RUNNER_HIVEMIND_SMOKETEST_SERVER_HOSTNAME \
$RUNNER_HIVEMIND_SERVER_HTTP_PORT \ $RUNNER_HIVEMIND_SERVER_HTTP_PORT \
mock_tests/ \ mock_tests/ \
api_smoketest_mock_tests.xml \ api_smoketest_mock_tests.xml \
...@@ -167,7 +169,7 @@ workflow: ...@@ -167,7 +169,7 @@ workflow:
.hive_api_smoketest-script: &hive_api_smoketest-script .hive_api_smoketest-script: &hive_api_smoketest-script
- | - |
./scripts/ci/start-api-smoketest.sh \ ./scripts/ci/start-api-smoketest.sh \
localhost \ $RUNNER_HIVEMIND_SMOKETEST_SERVER_HOSTNAME \
$RUNNER_HIVEMIND_SERVER_HTTP_PORT \ $RUNNER_HIVEMIND_SERVER_HTTP_PORT \
hive_api_patterns/ \ hive_api_patterns/ \
api_smoketest_hive_api.xml \ api_smoketest_hive_api.xml \
...@@ -176,7 +178,7 @@ workflow: ...@@ -176,7 +178,7 @@ workflow:
.api-benchmark-script: &api-benchmark-script .api-benchmark-script: &api-benchmark-script
- | - |
./scripts/ci/start-api-benchmarks.sh \ ./scripts/ci/start-api-benchmarks.sh \
localhost \ $RUNNER_HIVEMIND_BENCHMARK_SERVER_HOSTNAME \
$RUNNER_HIVEMIND_SERVER_HTTP_PORT \ $RUNNER_HIVEMIND_SERVER_HTTP_PORT \
$RUNNER_BENCHMARK_ITERATIONS \ $RUNNER_BENCHMARK_ITERATIONS \
$RUNNER_PYTEST_WORKERS $RUNNER_PYTEST_WORKERS
...@@ -240,40 +242,102 @@ sync_e2e_benchmark: ...@@ -240,40 +242,102 @@ sync_e2e_benchmark:
needs: needs:
- job: prepare_haf_data - job: prepare_haf_data
artifacts: true artifacts: true
- job: prepare_hivemind_image
artifacts: true
when: on_success when: on_success
services: services:
- name: $HAF_IMAGE_NAME - name: $HAF_IMAGE_NAME
alias: haf-instance alias: haf-instance
variables: variables:
PG_ACCESS: " PG_ACCESS: "
host haf_block_log haf_app_admin 0.0.0.0/0 trust\n host haf_block_log haf_app_admin all trust\n
host haf_block_log haf_admin 0.0.0.0/0 trust\n host haf_block_log haf_admin all trust\n
" "
DATADIR: $DATA_CACHE_MAINNET/datadir DATADIR: $DATA_CACHE_MAINNET/datadir
SHM_DIR: $DATA_CACHE_MAINNET/shm_dir SHM_DIR: $DATA_CACHE_MAINNET/shm_dir
LOG_FILE: $CI_JOB_NAME.log LOG_FILE: $CI_JOB_NAME.log
command: ["--replay-blockchain", "--stop-replay-at-block=5000000"] command: ["--replay-blockchain", "--stop-replay-at-block=5000000"]
- name: $HIVEMIND_IMAGE
alias: hivemind-sync # cannot be a variable
entrypoint:
- bash
- -c
- |
df -h && \
sleep 20s && \
cd /home/hivemind/app && \
source /home/hivemind/.hivemind-venv/bin/activate && \
ci/wait-for-postgres.sh ${HAF_ADMIN_POSTGRES_URL} && \
ci/add-mocks-to-db.sh && \
psql "${HAF_ADMIN_POSTGRES_URL}" -c 'CREATE EXTENSION IF NOT EXISTS intarray;' && \
cd ${HOME} && \
cat /home/hivemind/.hivemind-venv/lib/python3.8/site-packages/hive/_version.py > version.log && \
/home/hivemind/app/ci/hive-sync.sh && \
/home/hivemind/app/ci/collect-db-stats.sh && \
python -m http.server ${RUNNER_HIVEMIND_SERVER_HTTP_PORT}
- name: $HIVEMIND_IMAGE
alias: hivemind-benchmark # cannot be a variable
entrypoint:
- bash
- -c
- |
(python -m http.server --directory ${HOME} $LOG_SERVER_PORT &) && \
wget --header "PRIVATE-TOKEN: $AWAIT_SERVICE_ACCESS_TOKEN" "$AWAIT_PACKAGE_URL" -O ${HOME}/await && \
chmod +x ${HOME}/await && \
${HOME}/await -t 5m postgres://haf_admin@haf-instance:5432/haf_block_log#schemas=hivemind_app -- echo "Database found" && \
${HOME}/await -t 1h ${RUNNER_HIVEMIND_SYNC_URL} -- echo "Hivemind sync finished" && \
source /home/hivemind/.hivemind-venv/bin/activate && \
hive server \
--log-request-times \
--log-request-times-path ${HOME}/request_process_times.log \
--log-mask-sensitive-data \
--http-server-port ${RUNNER_HIVEMIND_SERVER_HTTP_PORT} \
--database-url "${HAF_POSTGRES_URL}" \
2>&1 | tee ${HOME}/hivemind-benchmark-server.log
- name: $HIVEMIND_IMAGE
alias: hivemind-smoketest # cannot be a variable
entrypoint:
- bash
- -c
- |
(python -m http.server --directory ${HOME} $LOG_SERVER_PORT &) && \
wget --header "PRIVATE-TOKEN: $AWAIT_SERVICE_ACCESS_TOKEN" "$AWAIT_PACKAGE_URL" -O ${HOME}/await && \
chmod +x ${HOME}/await && \
${HOME}/await -t 5m postgres://haf_admin@haf-instance:5432/haf_block_log#schemas=hivemind_app -- echo "Database found" && \
${HOME}/await -t 1h ${RUNNER_HIVEMIND_SYNC_URL} -- echo "Hivemind sync finished" && \
source /home/hivemind/.hivemind-venv/bin/activate && \
hive server \
--log-request-times \
--log-request-times-path ${HOME}/request_process_times_smoketests.log \
--log-mask-sensitive-data \
--http-server-port ${RUNNER_HIVEMIND_SERVER_HTTP_PORT} \
--database-url "${HAF_POSTGRES_URL}" \
2>&1 | tee ${HOME}/hivemind-server.log
variables: variables:
RUNNER_HIVEMIND_SYNC_MAX_BLOCK: 5000024 RUNNER_HIVEMIND_SYNC_MAX_BLOCK: 5000024
HIVED_UID: $HIVED_UID HIVED_UID: $HIVED_UID
RUNNER_HIVEMIND_SYNC_HOSTNAME: hivemind-sync
RUNNER_HIVEMIND_SYNC_URL: http://$RUNNER_HIVEMIND_SYNC_HOSTNAME:$RUNNER_HIVEMIND_SERVER_HTTP_PORT
RUNNER_HIVEMIND_BENCHMARK_URL: http://$RUNNER_HIVEMIND_BENCHMARK_SERVER_HOSTNAME
RUNNER_HIVEMIND_SMOKETEST_URL: http://$RUNNER_HIVEMIND_SMOKETEST_SERVER_HOSTNAME
AWAIT_SERVICE_ACCESS_TOKEN: $AWAIT_ACCESS_TOKEN
AWAIT_PACKAGE_URL: $CI_SERVER_URL/api/v4/projects/345/packages/generic/await/v1.3.2/await
LOG_SERVER_PORT: 8090
before_script: before_script:
- scripts/ci/fix_ci_tag.sh - |
- python3 -V pip install --no-cache-dir --verbose --user tox==3.25.0
- pip3 -V export PATH=/home/hivemind/.local/bin:$PATH
- python3 -m venv venv/
- . venv/bin/activate
- pip install --upgrade pip setuptools wheel
- pip install --no-cache-dir .[tests] 2>&1 | tee pip_install.log
- pip list
- env
script: script:
- echo "HAF image name $HAF_IMAGE_NAME" - |
- ./scripts/ci/wait-for-postgres.sh $HAF_ADMIN_POSTGRES_URL echo "HAF image name $HAF_IMAGE_NAME"
- ./scripts/ci/add-mocks-to-db.sh echo "Hivemind image name $HIVEMIND_IMAGE"
- psql "${HAF_ADMIN_POSTGRES_URL}" -c 'CREATE EXTENSION IF NOT EXISTS intarray;' wget --header "PRIVATE-TOKEN: $AWAIT_ACCESS_TOKEN" "$AWAIT_PACKAGE_URL"
- ./scripts/ci/hive-sync.sh chmod +x await
- ./scripts/ci/collect-db-stats.sh echo "Waiting for Hivemind sync to complete on ${RUNNER_HIVEMIND_SYNC_URL}"
- ./scripts/ci/hive-server.sh start ./await -t 1h ${RUNNER_HIVEMIND_SYNC_URL} -- echo "Hivemind sync has finished running"
SMOKETEST_AWAIT_URL="tcp://${RUNNER_HIVEMIND_SMOKETEST_SERVER_HOSTNAME}:${RUNNER_HIVEMIND_SERVER_HTTP_PORT}"
echo "Waiting for Hivemind smoketest server to start running on ${SMOKETEST_AWAIT_URL}"
./await -t 10m "${SMOKETEST_AWAIT_URL}" -- echo "Hivemind smoketest instance is running"
- *bridge_api_smoketest-script - *bridge_api_smoketest-script
- *bridge_api_smoketest_negative-script - *bridge_api_smoketest_negative-script
- *condenser_api_smoketest-script - *condenser_api_smoketest-script
...@@ -286,15 +350,31 @@ sync_e2e_benchmark: ...@@ -286,15 +350,31 @@ sync_e2e_benchmark:
- *tags_api_smoketest_negative-script - *tags_api_smoketest_negative-script
- *mock_tests-script - *mock_tests-script
- *hive_api_smoketest-script - *hive_api_smoketest-script
- ./scripts/ci/hive-server.sh stop - |
- mv ./request_process_times.log ./request_process_times_smoketests.log BENCHMARK_AWAIT_URL="tcp://${RUNNER_HIVEMIND_BENCHMARK_SERVER_HOSTNAME}:${RUNNER_HIVEMIND_SERVER_HTTP_PORT}"
- ./scripts/ci/hive-server.sh start echo "Waiting for Hivemind benchmark server to start running on ${BENCHMARK_AWAIT_URL}"
./await -t 10m "${BENCHMARK_AWAIT_URL}" -- echo "Hivemind benchmark instance is running"
- *api-benchmark-script - *api-benchmark-script
after_script: after_script:
- cat venv/lib/python3.8/site-packages/hive/_version.py > version.log - |
- echo "ARTIFACTS_JOB_ID=$CI_JOB_ID" >> variables.env echo "Downloading logs..."
- echo "APP_VERSION=$(git describe --tags)" >> variables.env wget ${RUNNER_HIVEMIND_SYNC_URL}/hivemind-sync.log || true
- echo "SERVER_NAME=$CI_RUNNER_DESCRIPTION" >> variables.env wget ${RUNNER_HIVEMIND_SYNC_URL}/version.log || true
mkdir pg-stats
wget ${RUNNER_HIVEMIND_SYNC_URL}/pg-stats/pg_settings.csv -O pg-stats/pg_settings.csv || true
wget ${RUNNER_HIVEMIND_SYNC_URL}/pg-stats/pg_stat_user_tables.csv -O pg-stats/pg_stat_user_tables.csv.csv || true
wget $RUNNER_HIVEMIND_SMOKETEST_URL:$LOG_SERVER_PORT/request_process_times_smoketests.log || true
wget $RUNNER_HIVEMIND_SMOKETEST_URL:$LOG_SERVER_PORT/hivemind-server.log || true
wget $RUNNER_HIVEMIND_BENCHMARK_URL:$LOG_SERVER_PORT/request_process_times.log || true
wget $RUNNER_HIVEMIND_BENCHMARK_URL:$LOG_SERVER_PORT/hivemind-benchmark-server.log || true
- |
echo "Preparing dotenv file..."
{
echo "ARTIFACTS_JOB_ID=$CI_JOB_ID"
echo "APP_VERSION=$(python -c "with open('version.log') as f: exec(f.read()); print(__version__)")"
echo "SERVER_NAME=$CI_RUNNER_DESCRIPTION"
} > variables.env
cat variables.env
artifacts: artifacts:
when: always when: always
expire_in: 7 days expire_in: 7 days
...@@ -302,9 +382,9 @@ sync_e2e_benchmark: ...@@ -302,9 +382,9 @@ sync_e2e_benchmark:
junit: "*.xml" junit: "*.xml"
dotenv: variables.env dotenv: variables.env
paths: paths:
- pip_install.log
- hivemind-sync.log - hivemind-sync.log
- hivemind-server.log - hivemind-server.log
- hivemind-benchmark-server.log
- pg-stats - pg-stats
- tests/api_tests/hivemind/tavern/**/*.out.json - tests/api_tests/hivemind/tavern/**/*.out.json
- request_process_times.log - request_process_times.log
......
...@@ -70,7 +70,9 @@ SHELL ["/bin/bash", "-c"] ...@@ -70,7 +70,9 @@ SHELL ["/bin/bash", "-c"]
COPY --from=builder --chown=hivemind:hivemind /home/hivemind/app/dist /home/hivemind/dist COPY --from=builder --chown=hivemind:hivemind /home/hivemind/app/dist /home/hivemind/dist
COPY --from=builder --chown=hivemind:hivemind /home/hivemind/.hivemind-venv /home/hivemind/.hivemind-venv COPY --from=builder --chown=hivemind:hivemind /home/hivemind/.hivemind-venv /home/hivemind/.hivemind-venv
COPY --from=builder --chown=hivemind:hivemind /home/hivemind/app/docker/docker_entrypoint.sh . COPY --from=builder --chown=hivemind:hivemind /home/hivemind/app/docker/docker_entrypoint.sh .
COPY --from=builder --chown=hivemind:hivemind /home/hivemind/app/scripts /home/hivemind/app COPY --from=builder --chown=hivemind:hivemind /home/hivemind/app/scripts /home/hivemind/app
COPY --from=builder --chown=hivemind:hivemind /home/hivemind/app/mock_data/block_data /home/hivemind/app/mock_data/block_data
COPY --from=builder --chown=hivemind:hivemind /home/hivemind/app/mock_data/vops_data /home/hivemind/app/mock_data/vops_data
USER haf_admin USER haf_admin
......
...@@ -82,6 +82,13 @@ class Conf: ...@@ -82,6 +82,13 @@ class Conf:
help='(debug) allows to generate log containing request processing times', help='(debug) allows to generate log containing request processing times',
action='store_true', action='store_true',
) )
add(
'--log-request-times-path',
env_var='LOG_REQUEST_TIMES_PATH',
help='(debug) specifies path for the log containing request processing times (requires --log-request-times)',
action='store',
default='./request_process_times.log'
)
add( add(
'--log-op-calls', '--log-op-calls',
env_var='LOG_OP_CALLS', env_var='LOG_OP_CALLS',
......
...@@ -219,8 +219,9 @@ def run_server(conf): ...@@ -219,8 +219,9 @@ def run_server(conf):
req_res_log = None req_res_log = None
if conf.get('log_request_times'): if conf.get('log_request_times'):
log_path = conf.get('log_request_times_path')
req_res_log = logging.getLogger("Request-Process-Time-Logger") req_res_log = logging.getLogger("Request-Process-Time-Logger")
conf_stdout_custom_file_logger(req_res_log, "./request_process_times.log") conf_stdout_custom_file_logger(req_res_log, log_path)
methods = build_methods() methods = build_methods()
......
...@@ -12,7 +12,7 @@ run_mocker() { ...@@ -12,7 +12,7 @@ run_mocker() {
psql "${HAF_ADMIN_POSTGRES_URL}" -f "${SCRIPTPATH}/wrapper_for_app_next_block.sql" psql "${HAF_ADMIN_POSTGRES_URL}" -f "${SCRIPTPATH}/wrapper_for_app_next_block.sql"
echo "Running mocking script" echo "Running mocking script"
mocker --database-url ${HAF_ADMIN_POSTGRES_URL} mocker --database-url "${HAF_ADMIN_POSTGRES_URL}"
} }
run_mocker run_mocker
...@@ -5,22 +5,25 @@ set -euo pipefail ...@@ -5,22 +5,25 @@ set -euo pipefail
haf_sync() { haf_sync() {
# Start hive sync process from haf database # Start hive sync process from haf database
echo Removing hivemind context and schema from HAF database echo "Removing hivemind context and schema from HAF database"
psql "${HAF_POSTGRES_URL}" -c "SELECT hive.app_remove_context('hivemind_app');" || true psql "${HAF_POSTGRES_URL}" -c "SELECT hive.app_remove_context('hivemind_app');" || true
psql "${HAF_POSTGRES_URL}" -c "DROP SCHEMA IF EXISTS hivemind_app CASCADE;" psql "${HAF_POSTGRES_URL}" -c "DROP SCHEMA IF EXISTS hivemind_app CASCADE;"
echo Starting hive sync using database URL: ${HAF_POSTGRES_URL} echo "Starting hive sync using database URL: ${HAF_POSTGRES_URL}"
echo Max sync block is: ${RUNNER_HIVEMIND_SYNC_MAX_BLOCK} echo "Max sync block is: ${RUNNER_HIVEMIND_SYNC_MAX_BLOCK}"
LOG_DIR=${LOG_DIR:-$(pwd)}
echo "Log dir is: $LOG_DIR"
hive sync \ hive sync \
--log-mask-sensitive-data \ --log-mask-sensitive-data \
--pid-file hive_sync.pid \ --pid-file hive_sync.pid \
--test-max-block=${RUNNER_HIVEMIND_SYNC_MAX_BLOCK} \ --test-max-block="${RUNNER_HIVEMIND_SYNC_MAX_BLOCK}" \
--test-profile=False \ --test-profile=False \
--prometheus-port 11011 \ --prometheus-port 11011 \
--database-url "${HAF_POSTGRES_URL}" \ --database-url "${HAF_POSTGRES_URL}" \
--community-start-block 4998000 \ --community-start-block 4998000 \
2>&1 | tee -i hivemind-sync.log 2>&1 | tee -i "$LOG_DIR/hivemind-sync.log"
} }
haf_sync haf_sync
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment