Skip to content

Commit

Permalink
chore: Send anvil logs to stdout (#8311)
Browse files Browse the repository at this point in the history
Instead of a local file, so we can read them from cloudwatch when
deployed in aws.

Also, it's possible that logrotate wasn't running, since the container
runs the process required and not cron and logrotate. Logging inside the
container is an antipattern that I walked straight into.
  • Loading branch information
spalladino authored Sep 2, 2024
1 parent 27e4761 commit 6a2614a
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 12 deletions.
1 change: 0 additions & 1 deletion iac/mainnet-fork/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ build:
COPY ./scripts ./scripts
COPY ./redeploy ./redeploy
COPY ./nginx/ /etc/nginx/
COPY --chmod 640 ./etc/anvil.logrotate.conf /etc/logrotate.d/anvil

# Expose port 80
EXPOSE 80
Expand Down
9 changes: 0 additions & 9 deletions iac/mainnet-fork/etc/anvil.logrotate.conf

This file was deleted.

4 changes: 2 additions & 2 deletions iac/mainnet-fork/scripts/run_nginx_anvil.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ mkdir -p /data
# Log directory for anvil
mkdir -p /var/log/anvil/

# Run anvil logging to /var/log/anvil
.foundry/bin/anvil --block-time 12 --host $HOST -p $PORT -m "$MNEMONIC_STRIPPED" -f=https://mainnet.infura.io/v3/$INFURA_API_KEY --chain-id=$L1_CHAIN_ID --fork-block-number=15918000 --block-base-fee-per-gas=10 -s=$SNAPSHOT_FREQUENCY --state=./data/state --balance=1000000000000000000 >>/var/log/anvil/anvil.log &
# Run anvil logging to stdout
.foundry/bin/anvil --block-time 12 --host $HOST -p $PORT -m "$MNEMONIC_STRIPPED" -f=https://mainnet.infura.io/v3/$INFURA_API_KEY --chain-id=$L1_CHAIN_ID --fork-block-number=15918000 --block-base-fee-per-gas=10 -s=$SNAPSHOT_FREQUENCY --state=./data/state --balance=1000000000000000000 &

echo "Waiting for ethereum host at $ETHEREUM_HOST..."
while ! curl -s $ETHEREUM_HOST >/dev/null; do sleep 1; done
Expand Down

0 comments on commit 6a2614a

Please sign in to comment.