2 releases
Uses new Rust 2024
| 0.1.0 | Feb 8, 2026 |
|---|---|
| 0.1.0-alpha.2 | Feb 7, 2026 |
#901 in Database interfaces
77KB
975 lines
Agent
A sample Relay Mail Agent.
Install
Write a Docker Compose file which pulls registry.gitlab.com/relay-mail/rust/agent/relay-agent:latest and run it.
Forward all traffic to localhost:2526 with a reverse proxy like NGINX.
Make sure to use HTTPS, all connections require it.
Example compose.yml
services:
db:
image: postgres:16
container_name: relay-postgres
restart: unless-stopped
environment:
POSTGRES_USER: relay
POSTGRES_PASSWORD: relay
POSTGRES_DB: relay
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U relay -d relay"]
interval: 5s
timeout: 5s
retries: 5
agent:
image: registry.gitlab.com/relay-mail/rust/agent/relay-agent:latest
container_name: relay-agent
restart: unless-stopped
depends_on:
db:
condition: service_healthy
environment:
AGENT_DOMAIN: example.org
DATABASE_URL: postgres://relay:relay@db/relay
AGENT_ADDRESS: 0.0.0.0
AGENT_PORT: 2525
RUST_LOG: info
ports:
- "2525:2525"
volumes:
pgdata:
Example NGINX server
server {
listen 2525 ssl;
listen [::]:2525 ssl;
server_name _;
ssl_certificate /etc/letsencrypt/live/DOMAIN/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/DOMAIN/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers off;
location / {
proxy_pass http://127.0.0.1:2526;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
}
}
Dependencies
~44–85MB
~1.5M SLoC