Skip to content

Commit 96e42a0

Browse files
Luiz Gustavo Abou Hatem de Lizclaude
andcommitted
refactor(docker): remove unnecessary tmpfs mounts
Removed both tmpfs mounts (/home/foundry/.foundry and /var/log) as they are not needed with --prune-history flag. Analysis: - With --prune-history, Anvil keeps state in process memory only (~58MB) - No state files written to disk (verified 0 files after 60s runtime) - Container writable layer stays at 4.1kB (no growth) - tmpfs was reserving 16GB of RAM for 0% usage The --prune-history flag IS the real fix for disk accumulation, not tmpfs. Kept the necessary protections: - Logging limits (prevents Docker JSON log accumulation) - Prometheus retention limits (prevents unbounded metrics growth) - Anonymous volume for Rust artifacts (prevents 32GB host accumulation) Result: Same protection against disk accumulation, but without unnecessarily reserving 16GB of RAM. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent d78b122 commit 96e42a0

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,10 @@ The Docker environment is optimized to prevent excessive disk usage, but monitor
9292

9393
### Built-in Protections
9494

95-
- **Chain container (Anvil)**: Uses tmpfs (in-memory storage) with 2GB limit
95+
- **Chain container (Anvil)**: Uses `--prune-history` flag to keep state in process memory only (no disk accumulation)
9696
- **Container logs**: Limited to 10MB per file, max 3 files (30MB total per service)
9797
- **Prometheus data**: Retention limited to 7 days and 1GB
98+
- **Rust build artifacts**: Stored in Docker volumes (not on host disk)
9899

99100
### Monitoring Disk Usage
100101

docker-compose.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,8 @@ services:
1818
- ETH_BLOCKNUMBER=${ETH_BLOCKNUMBER:-}
1919
volumes:
2020
- ./docker/anvil-entrypoint.sh:/entrypoint.sh:ro
21-
# Use tmpfs for Anvil state (in-memory, auto-cleanup, prevents disk accumulation)
22-
# Anvil stores state in /home/foundry/.foundry/anvil/tmp/
23-
# Size increased to 16GB to accommodate state accumulation during long runs
24-
# Adjust based on your test duration and available RAM
25-
tmpfs:
26-
- /home/foundry/.foundry:size=16G,mode=1777
27-
- /var/log:size=50m,mode=1777
21+
# Note: tmpfs NOT needed - Anvil with --prune-history keeps state in process memory only
22+
# No disk/tmpfs accumulation occurs (verified 0% usage)
2823
ports:
2924
- "8545:8545"
3025
dns:

0 commit comments

Comments
 (0)