Railway

Deploy Magento — Self-Hosted Enterprise E-Commerce

Self-host Magento 2.4.7 — enterprise store, high-RAM required

Deploy Magento — Self-Hosted Enterprise E-Commerce

Just deployed

/esdata

Just deployed

/var/www

/var/lib/mysql

Deploy and Host Magento on Railway

Magento (Adobe Commerce Open Source) is the most powerful open-source e-commerce platform — an enterprise-grade store engine for large catalogs, multi-store setups, B2B, and complex merchandising, with deep customization through its module ecosystem. This template deploys Magento 2.4.7 with Elasticsearch (which Magento requires), MySQL, and Redis pre-wired. Magento is resource-heavy by design, so this is for merchants who specifically want its enterprise capabilities and will run it on an appropriately sized plan — see the requirements below.


What This Template Deploys

ServicePurpose
Magento 2.4.7The store engine, storefront, and admin (PHP on Apache/Nginx)
ElasticsearchThe catalog search engine — required by Magento 2.4
MySQLProducts, orders, customers, and configuration
RedisCache and session storage for performance

All services connect over Railway's private network. Magento serves the storefront and admin, Elasticsearch powers catalog search, MySQL holds store data, and Redis handles cache and sessions.


About Hosting

Magento is enterprise software, and its resource and setup requirements are real — this section is deliberately honest so you deploy it successfully rather than hit avoidable failures.

Provision a high-RAM plan — this is the most important thing. Magento 2.4.7 is heavy: the install steps alone (setup:install, dependency compilation, static-content deployment) commonly need 4–6 GB of RAM or they run out of memory mid-install, and Elasticsearch wants another 1–2 GB. Plan for roughly 6–8 GB across the stack to install and run comfortably. On a small plan, the install will OOM or the store will be sluggish. Size your Railway plan accordingly before deploying — this is the difference between a working store and a failed install.

Elasticsearch is mandatory, not optional. Magento 2.4 will not install or serve catalog search without an Elasticsearch (or OpenSearch) backend, so this template includes and wires it. This is why the stack is multi-service rather than a single container.

The install is a long, multi-step process — let it finish. First boot runs Magento's CLI installer, compiles dependency injection, deploys static content, and reindexes — a process that can take 20–40 minutes and is the most failure-prone phase. Watch the logs, and don't interrupt it. Once it completes and the indexes are built, the storefront and admin come up.

Set the base URL to your domain. Magento stores its base URL in the database, so it must match your Railway (or custom) domain, or the storefront and admin render with broken assets and links.

Configure cron and run production mode. Magento relies on cron for reindexing, cache flushing, and scheduled jobs — without it, the catalog and prices go stale. For a live store, run production mode (not developer mode) for acceptable performance, and consider Varnish for full-page caching at scale. Products, orders, and customers live in MySQL, and media on a volume — both survive redeploys, with MySQL the primary backup target.

Typical cost: higher than a lightweight store — budget for the RAM the stack needs (often $30–60+/month depending on plan), plus MySQL and Elasticsearch. Magento is free of license fees, but its infrastructure footprint is significant. For a lighter self-hosted store, PrestaShop or WooCommerce run on far smaller plans.


How It Compares

Magento (self-hosted)Shopify PlusPrestaShopAdobe Commerce
ScaleEnterprise, large catalogsEnterpriseSmall–midEnterprise (paid)
Resource needsVery highN/A (hosted)ModerateVery high
B2B / multi-storeDeep, built-inAdd-onsLimitedDeep
Cost modelFlat infra (high)SubscriptionFlat infra (low)License + infra
Data ownershipFull — your infraVendorFullVendor-adjacent
Self-hostableYesNoYesLicensed

Shopify Plus is powerful but a high-tier subscription on their platform. PrestaShop is a lighter self-hosted store that runs on much smaller infrastructure — the better choice if you don't need Magento's scale. Adobe Commerce is the paid, licensed version of the same engine. Magento's edge is enterprise-grade capability — huge catalogs, sophisticated B2B, multi-store, and deep customization — self-hosted with full data ownership, in exchange for a heavier footprint you provision and own.


Deploy in Under 30 Minutes

  1. Choose a high-RAM Railway plan (target ~6–8 GB across the stack) — Magento needs it
  2. Set your domain and admin details, then click Deploy on Railway
  3. Watch the logs as the installer runs, compiles, deploys static content, and reindexes (20–40 min)
  4. Once install completes, open your admin URL and log in
  5. Set production mode, configure cron, add products, and connect a payment method

Be patient with the first boot — the long install is normal for Magento, not a failure.


Common Use Cases

  • Enterprise online store — large catalogs and high SKU counts with sophisticated merchandising
  • B2B commerce — company accounts, quotes, and tiered pricing built into the platform
  • Highly customized commerce — deep extension via Magento's module and API ecosystem

Configuration

VariableRequiredDescription
Base URLRequiredYour Railway or custom domain — stored in the database at install
Admin credentialsRequiredAdministrator account for the Magento back office
MySQL connectionAuto-injectedDatabase credentials via Railway references
Elasticsearch hostAuto-injectedThe bundled search backend Magento requires
Storage volumePre-setPersistent volume for media and generated files

Provision enough RAM, and let the install finish. Magento 2.4.7 needs roughly 6–8 GB across the stack; a small plan will OOM during the multi-step install. The first boot (install, compile, static deploy, reindex) takes 20–40 minutes — watch logs and don't interrupt it.

Elasticsearch is required and base URL matters. Magento 2.4 won't run without the bundled Elasticsearch, and the base URL is stored in the database, so it must match your domain. Configure cron and production mode for a live store.


Dependencies for Magento Hosting

  • Railway account with a high-RAM plan — budget ~$30–60+/month for the resources Magento needs
  • MySQL, Elasticsearch, and Redis (all included and wired)
  • A persistent volume for media and generated files (included)
  • A payment gateway and shipping configuration, set up in the admin after install

Deployment Dependencies

Implementation Details

The template deploys Magento 2.4.7 (PHP) with the services it requires: MySQL, an Elasticsearch backend for catalog search (mandatory in Magento 2.4 — it won't install or run search without it), and Redis for cache and sessions, all over the private network. Because Magento is resource-intensive, the install steps — setup:install, dependency-injection compilation, static-content deployment, and reindexing — commonly need 4–6 GB of RAM plus 1–2 GB for Elasticsearch; an undersized plan fails with out-of-memory errors during this phase, so a high-RAM plan (~6–8 GB across the stack) is necessary.

First boot runs the full installer sequence, which can take 20–40 minutes and is the most failure-prone part of any Magento deployment; watch the logs and don't interrupt it. Magento stores its base URL in the database, so it must match the deployment's domain, and cron must run for reindexing and scheduled jobs. For a live store, run production mode (not developer mode), with Varnish recommended for full-page caching at scale. Store data persists in MySQL and media on a volume; MySQL is the primary backup target. Merchants wanting a lighter store that runs on much smaller infrastructure should consider PrestaShop or WooCommerce.


Frequently Asked Questions

Why does the install fail or run out of memory? Magento 2.4.7 is heavy — the install, compile, and static-deploy steps need 4–6 GB of RAM, plus 1–2 GB for Elasticsearch. On a small plan they OOM. Use a high-RAM plan (~6–8 GB across the stack); this is the most common cause of failed Magento deployments.

Why is Elasticsearch included? Magento 2.4 requires an Elasticsearch (or OpenSearch) backend for catalog search and won't install without it, so it's bundled and wired here.

Is Magento overkill for my store? Possibly — Magento suits large catalogs, B2B, and multi-store needs. If you run a standard store, PrestaShop or WooCommerce are far lighter, cheaper to host, and faster to deploy on Railway.


Why Deploy Magento 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 Magento on Railway you get an enterprise e-commerce platform with the services wired — Elasticsearch, MySQL, and Redis pre-connected — on infrastructure you own. Provision a high-RAM plan for Magento's real requirements, be patient with the install, and you get a powerful, fully self-hosted store for large-scale commerce.


Template Content

More templates in this category

View Template
Libredesk - Complete Setup
[Jul'26] Complete self-hosted omnichannel customer support desk.

codestorm
1
View Template
Paperless-ngx
Document management with OCR on Railway with PostgreSQL and Redis

INAPP
1
View Template
Instatic CMS - Postgres
Design, build and manage powerful static sites from state-of-the-art CMS

Instatic
137