Deploy Mautic — Self-Hosted Marketing Automation
Self-host Mautic — email campaigns, segments & lead scoring, free
Mautic
Just deployed
/var/www/html/docroot/media
Mautic Cron
Just deployed
MySQL
Just deployed
/var/lib/mysql
Deploy and Host Mautic on Railway
Mautic is the leading open-source marketing automation platform — a self-hosted alternative to HubSpot, Mailchimp, and ActiveCampaign for email campaigns, contact segmentation, lead scoring, landing pages, and visual automation workflows. Own your marketing data and run unlimited campaigns without per-contact or per-seat fees. This template deploys Mautic as three pre-wired services — the web app, a dedicated cron worker, and MySQL — so campaigns actually fire on schedule and emails send automatically, the piece most Mautic deploys get wrong.
What This Template Deploys
| Service | Purpose |
|---|---|
| Mautic Web | The marketing app, campaign builder, and admin (PHP on Apache) |
| Mautic Cron | The dedicated worker that fires scheduled campaigns and sends email |
| MySQL | Contacts, campaigns, segments, and all marketing data |
All three connect over Railway's private network via service references — no manual hostname or credential copy-pasting. The web app serves the UI, the cron worker processes scheduled tasks, and MySQL holds your data.
About Hosting
Mautic is powerful, and one architectural detail decides whether your automation actually works — this template handles it.
The cron worker is the make-or-break piece. Mautic's campaigns, scheduled emails, segment updates, and background tasks only run if a cron process fires them on a schedule. Without it, you can build campaigns in the UI but they silently never send — the single most common failure in self-hosted Mautic. This template ships a dedicated cron service (the same image running Mautic's CLI role instead of Apache), so your automation fires reliably from the first deploy. This is the difference between a marketing platform that works and one that looks fine but sends nothing.
Three services, wired automatically. The web app, cron worker, and MySQL are connected through Railway's service references, so database hostnames and credentials are injected rather than copied by hand. Mautic's architecture separates web serving from background processing, so each can scale independently.
Your data and configuration persist. Contacts, campaigns, and segments live in MySQL, while Mautic's config, uploaded media, and logs persist on volumes — all surviving redeploys. MySQL is the component to back up, since it holds your entire contact database and campaign history.
Configure SMTP to actually send. Mautic builds and schedules emails, but sending requires an email provider: after deploy, go to Settings > Email Settings and configure your SMTP host (or a service like Amazon SES, SendGrid, or Postmark). For real volume, a dedicated sending service protects deliverability far better than a generic SMTP relay.
Log in with your admin credentials. The administrator account is created from the environment variables on first boot — open your Mautic URL, sign in, and start by importing contacts and building an email in the drag-and-drop editor.
Scale each part independently. For large contact databases (100K+), raise the PHP memory limit via PHP_INI_VALUE_MEMORY_LIMIT, scale the cron service for more throughput, and ensure MySQL has adequate storage — the web and worker tiers scale separately.
Typical cost: ~$10–15/month on Railway for the three services. Mautic is GPL-licensed and free — unlimited contacts and campaigns, versus HubSpot's tiered pricing and Mailchimp's per-subscriber fees.
How It Compares
| Mautic (self-hosted) | HubSpot | Mailchimp | ActiveCampaign | |
|---|---|---|---|---|
| Cost model | Flat infra | Tiered SaaS | Per subscriber | Subscription |
| Contact limit | Unlimited | By plan | By plan | By plan |
| Automation depth | Full, customizable | Deep | Limited | Strong |
| Lead scoring | Yes | Yes | Limited | Yes |
| Data ownership | Full — your infra | Vendor | Vendor | Vendor |
| Self-hostable | Yes | No | No | No |
HubSpot is polished but expensive and priced by tier. Mailchimp is easy to start but bills per subscriber and limits automation depth. ActiveCampaign is strong on email but subscription-based. Mautic's edge is unlimited campaigns, contacts, and deep customizable automation at flat infrastructure cost — with your entire marketing database on infrastructure you own, no per-contact fees as your list grows.
Deploy in Under 5 Minutes
- Click Deploy on Railway — the web app, cron worker, and MySQL build and wire together (~4 minutes)
- Confirm the admin credentials and
MAUTIC_DB_*connection are set - Open your Mautic URL and log in with your admin credentials
- Go to Settings > Email Settings and configure SMTP so emails can send
- Import contacts, build a segment, and create your first email campaign
The cron worker fires scheduled campaigns automatically — no external cron setup needed.
Common Use Cases
- Email marketing — build, segment, and send campaigns with a drag-and-drop editor
- Marketing automation — visual workflows that nurture leads based on behavior and triggers
- Landing pages and forms — capture leads with built-in pages and forms, no extra tools
- HubSpot replacement — full automation and CRM-adjacent marketing without per-contact fees
Configuration
| Variable | Required | Description |
|---|---|---|
MAUTIC_DB_HOST / _PORT / _DATABASE / _USER / _PASSWORD | Auto-injected | MySQL connection via Railway references |
| Admin credentials | Required | Administrator account created on first boot |
DOCKER_MAUTIC_ROLE | Pre-set | Distinguishes the web (mautic_web) and cron worker roles |
PHP_INI_VALUE_MEMORY_LIMIT | Optional | Raise for large contact databases |
| Storage volumes | Pre-set | Persist Mautic config, media, and logs |
The cron worker must run, or nothing sends. Mautic's campaigns and scheduled emails only fire via the cron service — this template ships a dedicated one, so automation works without external cron setup.
Configure SMTP to send email. Mautic builds campaigns but needs an email provider — set your SMTP host under Settings > Email Settings, ideally a dedicated sending service for deliverability at volume.
Dependencies for Mautic Hosting
- Railway account — ~$10–15/month for the three services
- MySQL (included and wired via Railway references)
- An SMTP provider (Amazon SES, SendGrid, Postmark, or similar) for sending email
- Persistent volumes for config, media, and logs (included)
Deployment Dependencies
Implementation Details
The template deploys three services: the Mautic web application (mautic/mautic, PHP on Apache) serving the UI and campaign builder, a dedicated cron worker running the same image in Mautic's CLI role for scheduled processing, and a Railway-managed MySQL database — all connected over the private network through Railway service references, so database hostnames and credentials are injected rather than manually configured.
The cron worker is essential: Mautic's campaigns, scheduled sends, segment rebuilds, and background jobs only execute when a cron process triggers them, so a deployment without it can build campaigns that never fire — the most common self-hosted Mautic failure. Running the worker as a separate service, distinguished by its role variable, ensures automation runs reliably and lets the web and background tiers scale independently (for large lists, raise PHP_INI_VALUE_MEMORY_LIMIT and scale the cron service).
Contacts, campaigns, and segments persist in MySQL, while Mautic's config, media uploads, and logs persist on volumes; MySQL is the primary backup target. Email sending is configured post-deploy under Settings > Email Settings against an SMTP provider, with a dedicated sending service recommended for deliverability at volume.
Frequently Asked Questions
Why aren't my campaigns or emails sending? Almost always a missing cron worker — Mautic's scheduled tasks only fire via a cron process. This template ships a dedicated cron service, so campaigns and emails run automatically without any external cron setup.
How do I send emails? Configure SMTP under Settings > Email Settings after deploy — point it at Amazon SES, SendGrid, Postmark, or your provider. A dedicated sending service protects deliverability far better than a generic relay.
Does my data persist? Yes — contacts, campaigns, and segments live in MySQL, and config, media, and logs on volumes, all surviving redeploys. Back up MySQL to preserve your contact database and campaign history.
How is it different from HubSpot? Mautic is self-hosted and free with unlimited contacts and campaigns, versus HubSpot's tiered pricing. You own all your data and can customize deeply, in exchange for running the infrastructure — which this template handles.
How do I log in? The admin account is created from the environment variables on first boot. Open your Mautic URL and sign in, then import contacts and build your first campaign.
Why Deploy Mautic on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Mautic on Railway you get a full marketing automation platform with the hard parts solved — a dedicated cron worker so campaigns actually fire, MySQL wired, persistent storage, and automatic HTTPS. Unlimited email campaigns, segments, and lead scoring, self-hosted on infrastructure you own.
Template Content
Mautic
mautic/mautic:latestMAUTIC_ADMIN_EMAIL
Create Initial admin email
MAUTIC_ADMIN_PASSWORD
Create Initial admin password
Mautic Cron
mautic/mautic:latestMySQL
mysql:9.4