From 44f45b2c4074135959f1e2f9e7ea11d075bab441 Mon Sep 17 00:00:00 2001 From: Kristin Kirkov Date: Fri, 16 Aug 2024 17:02:32 +0300 Subject: [PATCH] refactor(relay): Start proverServer from process-compose directly --- process-compose.yaml | 4 +- .../start-proverserver.sh | 44 ------------------- 2 files changed, 2 insertions(+), 46 deletions(-) delete mode 100755 relay/process-compose-scripts/start-proverserver.sh diff --git a/process-compose.yaml b/process-compose.yaml index e6ccf0277..241c17f62 100644 --- a/process-compose.yaml +++ b/process-compose.yaml @@ -18,8 +18,8 @@ processes: proverserver: description: proverserver log_location: ./logs/prover_server.log - working_dir: ./relay/process-compose-scripts/ - command: ./start-proverserver.sh + working_dir: ./ + command: proverServer ${PROVER_SERVER_PORT} /data/light_client.zkey depends_on: downloadZkAndDatFiles: condition: process_completed diff --git a/relay/process-compose-scripts/start-proverserver.sh b/relay/process-compose-scripts/start-proverserver.sh deleted file mode 100755 index 6388a789f..000000000 --- a/relay/process-compose-scripts/start-proverserver.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env bash - -source "${GIT_ROOT}/.env" - -if [[ -z "${PROVER_SERVER_HOST}" ]] && [[ -z "${PROVER_SERVER_PORT}" ]]; then - echo "PROVER_SERVER_HOST and PROVER_SERVER_PORT environment variables are not set. Using default values." - PROVER_SERVER_HOST="http://127.0.0.1" - PROVER_SERVER_PORT="5000" -else - echo "Using prover server settings from environment variables" -fi - -if [[ "${PROVER_SERVER_HOST}" == "http://127.0.0.1" ]]; then - ( - cd "${GIT_ROOT}" || exit 1 - proverServer "${PROVER_SERVER_PORT}" "${GIT_ROOT}/data/light_client.zkey" - echo "Prover server started with command" - ) - - max_attempts=300 # 300 attempts * 2s delay = 10 minutes - server_started=false - - echo "Waiting for server to start..." - - for ((i = 1; i <= max_attempts; i++)); do - response=$(curl -s -o /dev/null -w "%{http_code}" "${PROVER_SERVER_HOST}":"${PROVER_SERVER_PORT}"/status) - - if [ "${response}" -eq 200 ]; then - echo "Server is up and running." - server_started=true - break - fi - - echo "Attempt ${i}: Server is not responding. Waiting for 2 seconds..." - sleep 2 - done - - if [ ${server_started} == false ]; then - echo "Server failed to start after 5 minutes. Exiting." - exit 1 - fi -else - echo "Using remote prover server at ${PROVER_SERVER_HOST}:${PROVER_SERVER_PORT}" -fi