Skip to content

Fix intermittent S3 timeouts by giving metron-web Network=host#517

Merged
bpepple merged 1 commit intomasterfrom
fix-thumbnails
Apr 19, 2026
Merged

Fix intermittent S3 timeouts by giving metron-web Network=host#517
bpepple merged 1 commit intomasterfrom
fix-thumbnails

Conversation

@bpepple
Copy link
Copy Markdown
Member

@bpepple bpepple commented Apr 19, 2026

Summary

  • Switch metron-web from Network=metron.network to Network=host so outbound S3 traffic (sorl-thumbnail, media uploads) goes through the kernel network stack instead of pasta's user-space proxy
  • Publish postgres (5432) and redis (6379) to 127.0.0.1 so metron-web can reach them via the host loopback; update DB_HOST, REDIS_URL, and THUMBNAIL_REDIS_HOST in metron.env.example accordingly
  • Update Anubis TARGET to http://host.containers.internal:8000 since metron-web is no longer addressable by container name from the bridge network

Background

Switching metron-web's outbound S3 connections from pasta user-space networking to the host kernel stack. Testing confirmed ~4% failure rate on S3 connects inside the container regardless of whether pasta or slirp4netns was used, while direct host tests had 0 failures.

Deploy

  1. Copy updated quadlet files
cp ~/metron/.quadlet/*.container ~/.config/containers/systemd/
  1. Update metron.env — change three values:
    DB_HOST=127.0.0.1
    REDIS_URL=redis://127.0.0.1:6379/0
    THUMBNAIL_REDIS_HOST=127.0.0.1

  2. Reload and restart everything

systemctl --user daemon-reload
systemctl --user restart metron-postgres metron-redis metron-web metron-anubis
  1. Verify
systemctl --user status metron-web metron-anubis
journalctl CONTAINER_NAME=metron-web -n 30

How to Test

  • systemctl --user status metron-web metron-anubis — both active
  • Site loads through nginx → Anubis → metron-web
  • Upload a cover image — no S3 ConnectTimeoutError in logs
  • journalctl CONTAINER_NAME=metron-web -n 50 — no timeout errors

Outbound connections from the bridge network container (to DigitalOcean Spaces S3) were proxied through pasta's user-space network stack, causing
intermittent ConnectTimeoutErrors at a ~4% rate regardless of S3 health.

Switch metron-web to Network=host so its outbound traffic goes through the kernel network stack directly. metron-postgres and metron-redis stay on the
bridge network but now publish to 127.0.0.1 so metron-web can reach them via the host loopback. Anubis (still on the bridge) reaches metron-web via
host.containers.internal:8000.

Update metron.env.example to reflect the new 127.0.0.1 addresses for DB_HOST, REDIS_URL, and THUMBNAIL_REDIS_HOST, and update DEPLOYMENT.md
with the revised architecture diagram and explanation.
@bpepple bpepple self-assigned this Apr 19, 2026
@bpepple bpepple added the bug Something isn't working label Apr 19, 2026
@bpepple bpepple merged commit a8b546c into master Apr 19, 2026
2 checks passed
@bpepple bpepple deleted the fix-thumbnails branch April 19, 2026 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant