fix/podman-postgres-integration (#37)
resolves #25 Co-authored-by: openhands <openhands@all-hands.dev> Co-authored-by: johba <johba@harb.eth> Reviewed-on: https://codeberg.org/johba/harb/pulls/37
This commit is contained in:
parent
8947ec11ca
commit
b4c829e4d6
25 changed files with 187 additions and 144 deletions
|
|
@ -2,7 +2,7 @@
|
|||
set -euo pipefail
|
||||
|
||||
MNEMONIC_FILE=/workspace/onchain/.secret.local
|
||||
ANVIL_CMD=(anvil --fork-url "${FORK_URL:-https://sepolia.base.org}" --chain-id 31337 --block-time 1 --host 0.0.0.0 --port 8545)
|
||||
ANVIL_CMD=(anvil --fork-url "${FORK_URL:-https://sepolia.base.org}" --chain-id 31337 --block-time 1 --host 0.0.0.0 --port 8545 --threads 4 --timeout 2000 --retries 2 --fork-retry-backoff 100)
|
||||
|
||||
if [[ -f "$MNEMONIC_FILE" ]]; then
|
||||
MNEMONIC="$(tr -d '\n\r' <"$MNEMONIC_FILE")"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Install jq if not available
|
||||
if ! command -v jq >/dev/null 2>&1; then
|
||||
apk add --no-cache jq >/dev/null 2>&1 || apt-get update && apt-get install -y jq >/dev/null 2>&1 || true
|
||||
fi
|
||||
|
||||
ROOT_DIR=/workspace
|
||||
STATE_DIR=$ROOT_DIR/tmp/podman
|
||||
LOG_DIR=$STATE_DIR/logs
|
||||
|
|
@ -35,9 +40,7 @@ log() {
|
|||
|
||||
wait_for_rpc() {
|
||||
for _ in {1..120}; do
|
||||
if curl -s -o /dev/null -X POST "$ANVIL_RPC" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"jsonrpc":"2.0","id":1,"method":"eth_chainId","params":[]}'; then
|
||||
if cast chain-id --rpc-url "$ANVIL_RPC" >/dev/null 2>&1; then
|
||||
return 0
|
||||
fi
|
||||
sleep 1
|
||||
|
|
@ -141,7 +144,7 @@ seed_application_state() {
|
|||
|
||||
prime_chain() {
|
||||
log "Pre-mining blocks"
|
||||
for _ in {1..1200}; do
|
||||
for _ in {1..2000}; do
|
||||
cast rpc --rpc-url "$ANVIL_RPC" evm_mine >/dev/null 2>&1 || true
|
||||
done
|
||||
}
|
||||
|
|
@ -153,6 +156,8 @@ KRAIKEN_ADDRESS=$KRAIKEN
|
|||
STAKE_ADDRESS=$STAKE
|
||||
START_BLOCK=$DEPLOY_BLOCK
|
||||
PONDER_RPC_URL_BASE_SEPOLIA_LOCAL_FORK=$ANVIL_RPC
|
||||
DATABASE_URL=postgresql://ponder:ponder_local@postgres:5432/ponder_local
|
||||
DATABASE_SCHEMA=ponder_local_${DEPLOY_BLOCK}
|
||||
EOPONDER
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,12 +11,21 @@ while [[ ! -f "$CONTRACT_ENV" ]]; do
|
|||
done
|
||||
|
||||
cd "$PONDER_WORKDIR"
|
||||
|
||||
echo "[ponder-entrypoint] Installing dependencies..."
|
||||
npm install --no-save --loglevel error 2>&1 || {
|
||||
echo "[ponder-entrypoint] npm install failed, trying with --force"
|
||||
npm install --force --no-save --loglevel error
|
||||
}
|
||||
|
||||
# Load and export all environment variables from .env.local
|
||||
if [[ -f .env.local ]]; then
|
||||
echo "[ponder-entrypoint] Loading environment from .env.local"
|
||||
set -a
|
||||
source .env.local
|
||||
set +a
|
||||
fi
|
||||
|
||||
export CHOKIDAR_USEPOLLING=${CHOKIDAR_USEPOLLING:-1}
|
||||
export HOST=0.0.0.0
|
||||
export PORT=${PORT:-42069}
|
||||
|
|
|
|||
|
|
@ -31,16 +31,7 @@ fi
|
|||
echo "[txn-bot-entrypoint] Compiling TypeScript..."
|
||||
if [[ ! -f dist/index.js ]]; then
|
||||
echo "[txn-bot-entrypoint] Running tsc to compile kraiken-lib..."
|
||||
./node_modules/.bin/tsc \
|
||||
--outDir dist \
|
||||
--declaration \
|
||||
--module commonjs \
|
||||
--target es2020 \
|
||||
--skipLibCheck \
|
||||
--esModuleInterop \
|
||||
--allowSyntheticDefaultImports \
|
||||
--resolveJsonModule \
|
||||
src/index.ts src/helpers.ts src/subgraph.ts src/__generated__/graphql.ts 2>&1 | head -20 || {
|
||||
./node_modules/.bin/tsc 2>&1 | head -20 || {
|
||||
echo "[txn-bot-entrypoint] TypeScript compilation had some issues, checking if files were created..."
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue