A Rails application with Postgres, Sidekiq and Redis serves the app and API on Clever Cloud in Paris. Several separate SMTP servers send email, receive email and provide the SMTP gateway. The services talk to each other with HTTP RPC calls, with Redis caches between them.
Section: Hosting: Clever Cloud | Section: SMTP Servers | Section: The bits in between: HTTP Services
Components
Component
Role
Where
App and API
Receives send requests and serves the email dashboard. Rails 7 with Turbo for the interactive parts.
Section: App & API | Section: Front end and API: Rails
Database
Postgres, the application's database.
Section: Database: Postgres
Background jobs
Sidekiq, through ActiveJob, processes outbound email and many other background jobs, keeping job details and state in Redis.
Section: Background Jobs: ActiveJob with Sidekiq and Redis
Inbound SMTP and SMTP gateway
Custom JavaScript SMTP servers on fly.io that receive email and accept mail from customers over SMTP.
Section: Inbound SMTP & SMTP Gateway: JavaScript
Outbound SMTP
ZoneMTA with plugins that fetch DKIM keys in real time, run spam checks and update the database when emails are sent or bounce. Runs on Ubuntu VMs from Freethought, deployed with Capistrano.
Section: Outbound SMTP: ZoneMTA (JavaScript)
Inter-service caches
Redis caches that sit between the services, which exchange data through HTTP RPC calls; the caches are there for speed and resilience.
Section: The bits in between: HTTP Services
Backups
Scheduled backups from Clever Cloud plus an additional backup to AWS S3 made with the backup gem.
Section: Backups: Clever Cloud and AWS S3
Attachment storage
Clever Cloud Cellar, an S3 equivalent, holds attachments, which were moved there from Postgres.
Section: Attachment storage: Clever Cloud Cellar
Cron VM
A separate VM runs cron jobs and regularly sends the team email through MailPace itself.
Host the app, database and jobs on Clever Cloud in Paris, a managed platform, not on one of the three big clouds
mailpace-2023-tech-stack#d1at corpus version 26a1b3a7e3dd
Chosen
The Rails app, database and jobs are hosted on Clever Cloud in Paris, deployed from the master branch on GitHub through a Dockerfile. The platform handles load balancing and horizontal and vertical scaling.
Section: Hosting: Clever Cloud
Reasoning
One of the team's three stated principles is to avoid Google, AWS and Azure and proprietary cloud-native services that only someone else can run, and to prefer European providers and locations. Using the platform means the team handles no operations infrastructure for the app.
Near: Avoid the big three cloud providers | Near: This means we don't handle any operations
Cost
The team reports little room to tune for performance or convenience: deployments take longer than it would like, maintaining the database needs the provider's support, and it relies on how the provider sets up VMs. It calls this a worthy trade-off overall.
Split the critical components into a few services that call each other over HTTP, not microservices
mailpace-2023-tech-stack#d2at corpus version 26a1b3a7e3dd
Chosen
The app and API and the several SMTP servers (sending, receiving and the SMTP gateway) are separate services. They send and receive data with HTTP RPC calls, and Redis caches sit between the HTTP services.
Section: The bits in between: HTTP Services | Section: SMTP Servers
Reasoning
A stated principle is separation of responsibility for critical components, which the team sums up as services, not microservices. It says HTTP calls give some freedom and resiliency between components, and that it knows HTTP well and finds it trivial to use from any language.
Near: Separation of responsibility for our critical components | Section: The bits in between: HTTP Services
Run outbound mail on plain VMs deployed with Capistrano, and the lightweight SMTP front ends on fly.io
mailpace-2023-tech-stack#d3at corpus version 26a1b3a7e3dd
Chosen
Outbound email runs on ZoneMTA on Ubuntu VMs from Freethought, deployed with Capistrano. The custom inbound SMTP servers and the SMTP gateway run on fly.io and are deployed with fly deploy from a Dockerfile.
The team found ZoneMTA by far the easiest mail transfer agent to configure and write plugins for. The outbound servers rarely change, so it is content with simple, old-style server management for them. It chose JavaScript for the SMTP servers because it knows it well and finds node.js reasonably fast and light for asynchronous work.
Section: Outbound SMTP: ZoneMTA (JavaScript) | Near: We use JavaScript because a) we know
Build on tools the team already knows (Rails, Postgres, Sidekiq with Redis)
mailpace-2023-tech-stack#d4at corpus version 26a1b3a7e3dd
Chosen
The app and API are Rails 7, the database is Postgres, and background jobs, outbound email among them, run on Sidekiq with Redis holding job details and state.
Section: Front end and API: Rails | Section: Database: Postgres | Section: Background Jobs: ActiveJob with Sidekiq and Redis
Reasoning
The first stated principle is boring tech: things the team already knows how to use and that have been proven. The author calls Rails by far the simplest way to get a CRUD app running and easy to add features to, and allows that the API could be rewritten in Rust for some speed, perhaps in future.
Near: Use boring tech - we use things | Section: Front end and API: Rails
Keep the provider's scheduled backups and a second copy at another provider, and test the restore
mailpace-2023-tech-stack#d5at corpus version 26a1b3a7e3dd
Chosen
Backups are taken on regular schedules by Clever Cloud, and an additional backup goes to AWS S3 using the backup gem. The team says it has tested its restore process.