-
Notifications
You must be signed in to change notification settings - Fork 29
Development #728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Development #728
Changes from all commits
76dc87f
a1ffcf3
632f38d
d8fb367
114e537
23a63d9
85dd0b4
109211e
c668326
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -263,6 +263,8 @@ services: | |
| - EXEC_CMD=true | ||
| - MDA_API_BASE_URL=http://localhost:8000/api/mail/ | ||
| - MTA_HOST=localhost | ||
| - MTA_PORT=25 | ||
| - MTA_IMPL=postfix | ||
| command: pytest -vvs tests/ | ||
| volumes: | ||
| - ./src/mta-in:/app | ||
|
|
@@ -277,6 +279,71 @@ services: | |
| target: uv | ||
| pull_policy: build | ||
|
|
||
| # ---- Pure-Python (aiosmtpd) inbound MTA -------------------------------- | ||
| # Runs side-by-side with the Postfix-based `mta-in` service on a different | ||
| # host port (8920 vs 8910). Both implementations share the same MDA | ||
| # contract, env vars, and test suite. Toggle which one is the public-facing | ||
| # MTA at the edge by switching the upstream pool. | ||
|
|
||
| mta-in-py: | ||
| build: | ||
| context: src/mta-in | ||
| dockerfile: Dockerfile.pymta | ||
| target: runtime-distroless-prod | ||
| args: | ||
| DOCKER_USER: ${DOCKER_USER:-65532} | ||
| user: ${DOCKER_USER:-65532} | ||
| env_file: | ||
| - env.d/development/mta-in.defaults | ||
| - env.d/development/mta-in.local | ||
| - env.d/development/mta-in-py.defaults | ||
| - env.d/development/mta-in-py.local | ||
| ports: | ||
| - "8920:25" | ||
| - "9120:9100" # Prometheus metrics | ||
| # Defence-in-depth: pymta needs no on-disk writes at runtime. Read-only | ||
| # rootfs + dropped capabilities + no-new-privileges mirror the posture | ||
| # a production k8s pod-spec should run with. | ||
| read_only: true | ||
| cap_drop: | ||
| - ALL | ||
| security_opt: | ||
| - no-new-privileges:true | ||
| tmpfs: | ||
| - /tmp:rw,noexec,nosuid,size=16m | ||
| depends_on: | ||
| - backend-dev | ||
|
|
||
| mta-in-py-test: | ||
| profiles: | ||
| - tools | ||
| build: | ||
| context: src/mta-in | ||
| dockerfile: Dockerfile.pymta | ||
| target: runtime-dev | ||
| args: | ||
| DOCKER_USER: ${DOCKER_USER:-65532} | ||
| user: ${DOCKER_USER:-65532} | ||
| cap_drop: | ||
| - ALL | ||
| security_opt: | ||
| - no-new-privileges:true | ||
| env_file: | ||
| - env.d/development/mta-in.defaults | ||
| - env.d/development/mta-in.local | ||
| - env.d/development/mta-in-py.defaults | ||
| - env.d/development/mta-in-py.local | ||
| environment: | ||
| - EXEC_CMD=true | ||
| - MDA_API_BASE_URL=http://localhost:8000/api/mail/ | ||
| - MTA_HOST=localhost | ||
| - MTA_PORT=25 | ||
| - MTA_IMPL=pymta | ||
| - MTA_METRICS_URL=http://localhost:9100/metrics | ||
| command: pytest -vvs tests/ | ||
| volumes: | ||
| - ./src/mta-in:/app | ||
|
|
||
|
Comment on lines
+288
to
+346
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '\n== Files of interest ==\n'
git ls-files | rg '^(compose\.yaml|src/mta-in/|env\.d/development/mta-in-py\.|env\.d/development/mta-in\.)'
printf '\n== compose.yaml around mta-in-py ==\n'
python3 - <<'PY'
from pathlib import Path
p = Path('compose.yaml')
lines = p.read_text().splitlines()
for start, end in [(260, 360)]:
print(f'--- {p}:{start}-{end} ---')
for i, line in enumerate(lines[start-1:end], start):
print(f'{i:4d}: {line}')
PY
printf '\n== Dockerfile.pymta outline ==\n'
if command -v ast-grep >/dev/null 2>&1; then
ast-grep outline src/mta-in/Dockerfile.pymta || true
else
sed -n '1,240p' src/mta-in/Dockerfile.pymta
fi
printf '\n== Search for port config / 25 / 2525 / PYMTA_SMTP_PORT ==\n'
rg -n 'PYMTA_SMTP_PORT|2525|:25\b|port\s*=?\s*25|SMTP_PORT|bind.*25|listen.*25' src/mta-in env.d/development compose.yamlRepository: suitenumerique/messages Length of output: 7494 🏁 Script executed: #!/bin/bash
set -euo pipefail
python3 - <<'PY'
from pathlib import Path
files = [
'src/mta-in/Dockerfile.pymta',
'src/mta-in/entrypoint.pymta.sh',
'src/mta-in/src/pymta/settings.py',
'src/mta-in/src/pymta/server.py',
'src/mta-in/README.md',
'env.d/development/mta-in-py.defaults',
]
for file in files:
p = Path(file)
print(f'\n== {file} ({sum(1 for _ in p.open())} lines) ==')
lines = p.read_text().splitlines()
# print focused slices where useful
if file.endswith('Dockerfile.pymta'):
ranges = [(1, 240)]
elif file.endswith('entrypoint.pymta.sh'):
ranges = [(1, 220)]
elif file.endswith('settings.py'):
ranges = [(1, 160)]
elif file.endswith('server.py'):
ranges = [(1, 180)]
elif file.endswith('README.md'):
ranges = [(50, 90)]
else:
ranges = [(1, 80)]
for start, end in ranges:
print(f'--- {file}:{start}-{end} ---')
for i, line in enumerate(lines[start-1:end], start):
print(f'{i:4d}: {line}')
PYRepository: suitenumerique/messages Length of output: 26369 Restore a portable bind path for
🤖 Prompt for AI Agents |
||
| mta-out: | ||
| build: | ||
| context: src/mta-out | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.