Railway

Deploy Mautic Marketing Automation | Open Source HubSpot Alternative

Self-host Mautic. Automation with email campaigns, segments, lead scoring

Deploy Mautic Marketing Automation | Open Source HubSpot Alternative

Just deployed

/var/www/html/docroot/media

Just deployed

Just deployed

/var/lib/mysql

Mautic logo

Deploy and Host Mautic on Railway

Deploy Mautic on Railway to get a fully self-hosted marketing automation platform with email campaigns, contact segmentation, lead scoring, and multi-channel workflows — all under your control. Self-host Mautic with one click and start automating your marketing in minutes.

This Railway template pre-configures three services: the Mautic web application (Apache), a dedicated cron worker for scheduled campaign processing, and a MySQL database for persistent storage. Everything is wired together with Railway's service references — no manual hostname or credential copy-pasting.

Mautic Railway architecture

Getting Started with Mautic on Railway

After deployment completes, open your Mautic URL and log in with the admin credentials configured in your environment variables. Navigate to Contacts to create your first contact or import a CSV. Head to Channels > Emails to build your first email template using the drag-and-drop GrapesJS editor. Set up a Campaign under the Campaigns tab to define automated workflows triggered by contact actions like form submissions, page visits, or email opens. Configure your SMTP mailer under Settings > Email Settings to start sending emails in production.

Mautic dashboard screenshot

About Hosting Mautic

Mautic is the world's largest open-source marketing automation platform, built with Symfony/PHP. It provides enterprise-grade marketing tools without vendor lock-in or per-contact pricing.

  • Email marketing with drag-and-drop builder, A/B testing, and scheduled sends
  • Contact management with custom fields, segments, and lead scoring
  • Campaign builder with visual workflow automation and multi-channel triggers
  • Landing pages and forms with built-in analytics and conversion tracking
  • Multi-channel support — email, SMS, web notifications, social media
  • 50+ plugins including Salesforce, Mailgun, reCAPTCHA, and WordPress integrations

The template runs three services: the web application handles UI and API requests, the cron service executes scheduled tasks (segment rebuilds, campaign triggers, email sends), and MySQL stores all contact and campaign data.

Why Deploy Mautic on Railway

  • Zero per-contact pricing — host unlimited contacts on your infrastructure
  • Full data ownership — GDPR compliance without third-party data processors
  • One-click deploy with MySQL, web, and cron pre-configured
  • Extensible plugin marketplace with 50+ integrations
  • Visual campaign builder for complex multi-step workflows

Common Use Cases for Self-Hosted Mautic

  • Lead nurturing pipelines — automated email sequences triggered by form fills, page visits, or scoring thresholds
  • E-commerce re-engagement — abandoned cart emails, post-purchase follow-ups, and loyalty campaigns
  • Event marketing — registration confirmations, reminder sequences, and post-event surveys
  • Multi-brand agencies — isolated Mautic instances per client with custom branding via white-labeling

Dependencies for Mautic on Railway

  • Mauticmautic/mautic:latest (Apache variant, web role)
  • Mautic Cronmautic/mautic:latest (cron role for scheduled tasks)
  • MySQL — Railway managed MySQL for contact and campaign storage

Environment Variables Reference for Mautic

VariableDescriptionExample
MAUTIC_DB_HOSTMySQL host${{MySQL.MYSQLHOST}}
MAUTIC_DB_DATABASEDatabase name${{MySQL.MYSQLDATABASE}}
MAUTIC_URLPublic URL with HTTPShttps://${{RAILWAY_PUBLIC_DOMAIN}}
MAUTIC_SECRET_KEYEncryption/session key${{secret(64)}}
DOCKER_MAUTIC_ROLEContainer rolemautic_web or mautic_cron
TRUSTED_PROXIESProxy trust for HTTPS0.0.0.0/0

Deployment Dependencies

Hardware Requirements for Self-Hosting Mautic

ResourceMinimumRecommended
CPU1 vCPU2 vCPU
RAM512 MB2 GB
Storage1 GB5 GB+ (grows with media uploads)
DatabaseMySQL 5.7+MySQL 8.0+

Self-Hosting Mautic with Docker

Pull the official Apache image and connect to an existing MySQL instance:

docker run -d --name mautic \
  -p 8080:80 \
  -e MAUTIC_DB_HOST=mysql \
  -e MAUTIC_DB_PORT=3306 \
  -e MAUTIC_DB_DATABASE=mautic \
  -e MAUTIC_DB_USER=mautic \
  -e MAUTIC_DB_PASSWORD=secretpassword \
  -e DOCKER_MAUTIC_ROLE=mautic_web \
  mautic/mautic:latest

For production with cron support, use Docker Compose:

services:
  mautic_web:
    image: mautic/mautic:latest
    ports: ["8080:80"]
    environment:
      MAUTIC_DB_HOST: db
      MAUTIC_DB_DATABASE: mautic
      MAUTIC_DB_USER: mautic
      MAUTIC_DB_PASSWORD: secretpassword
      DOCKER_MAUTIC_ROLE: mautic_web
    depends_on: [db]

  mautic_cron:
    image: mautic/mautic:latest
    environment:
      MAUTIC_DB_HOST: db
      MAUTIC_DB_DATABASE: mautic
      MAUTIC_DB_USER: mautic
      MAUTIC_DB_PASSWORD: secretpassword
      DOCKER_MAUTIC_ROLE: mautic_cron
    depends_on: [mautic_web]

  db:
    image: mysql:lts
    environment:
      MYSQL_DATABASE: mautic
      MYSQL_USER: mautic
      MYSQL_PASSWORD: secretpassword
      MYSQL_ROOT_PASSWORD: rootpassword
    volumes: ["mysql-data:/var/lib/mysql"]

volumes:
  mysql-data:

How Much Does Mautic Cost to Self-Host?

Mautic is 100% free and open-source under the GPLv3 license. There are no per-contact fees, no feature gates, and no user limits. The only cost is infrastructure — on Railway, expect roughly $5–15/month depending on contact volume and email frequency. The Mautic company offers a managed cloud version starting at ~$250/month, but self-hosting gives you the same features at a fraction of the cost.

Mautic vs HubSpot for Marketing Automation

FeatureMauticHubSpot
PricingFree (self-hosted)Free tier, paid from $800/mo
Contact limitsUnlimitedTiered by plan
Data ownershipFull (your server)HubSpot cloud
Email builderGrapesJS drag-and-dropProprietary builder
Integrations50+ plugins, open API1000+ native integrations
Campaign builderVisual workflow editorVisual workflow editor
Self-hostingYesNo

Mautic is the stronger choice for teams that need unlimited contacts without per-seat pricing and want full data ownership. HubSpot excels for teams that prioritize breadth of native integrations and are willing to pay for a managed platform.

FAQ

What is Mautic and why self-host it? Mautic is an open-source marketing automation platform that handles email campaigns, lead scoring, contact segmentation, and multi-channel workflows. Self-hosting gives you unlimited contacts with no per-user fees, full GDPR-compliant data ownership, and the ability to customize every aspect of the platform.

What does this Railway template deploy for Mautic? This template deploys three services: the Mautic web application (Apache-based PHP app handling the UI and API), a dedicated Mautic Cron service for executing scheduled tasks like campaign triggers and email sends, and a MySQL database for storing contacts, campaigns, and configuration.

Why does Mautic on Railway need a separate cron service? Mautic relies on scheduled tasks for critical operations — rebuilding contact segments, triggering campaign actions, sending queued emails, and updating lead scores. Without the cron service, campaigns won't fire on schedule and emails won't send automatically. The cron container shares the same image but runs CLI commands instead of Apache.

How do I configure SMTP for sending emails with self-hosted Mautic? After deploying, go to Settings > Email Settings in the Mautic admin panel. Set the mailer transport to SMTP and enter your provider's credentials (Mailgun, SendGrid, Amazon SES, or any SMTP server). Update the MAUTIC_MAILER_DSN environment variable to match your SMTP endpoint for persistence across redeploys.

Can I migrate from Mailchimp or HubSpot to self-hosted Mautic? Yes. Export your contacts as CSV from your current platform and import them via Contacts > Import in Mautic. Campaign logic must be recreated manually using Mautic's visual campaign builder, but contact data, custom fields, and segment memberships transfer cleanly via CSV import.

How do I scale Mautic on Railway for high contact volumes? For large contact databases (100K+), increase the PHP memory limit via PHP_INI_VALUE_MEMORY_LIMIT, add more cron workers by scaling the Mautic Cron service, and ensure MySQL has adequate storage. Mautic's architecture separates web serving from background processing, so you can scale each independently on Railway.


Template Content

More templates in this category

View Template
N8N Main + Worker
Deploy and Host N8N with Inactive worker.

jakemerson
View Template
Postgres Backup
Cron-based PostgreSQL backup to bucket storage

Railway Templates
View Template
Prefect [Updated Apr ’26]
Prefect [Apr ’26] (ETL & Automation alternative to Airflow) Self Host

shinyduo