---
title: "Migrating From Heroku To Railway"
description: "Moving a Heroku app to Railway comes down to three steps: deploy from a GitHub repo, import Heroku config vars, and add Postgres and Redis as separate database services."
url: "https://swe.quest/articles/migrating-from-heroku-to-railway-dbd89b10c75a9d07"
canonical: "https://blog.railway.com/p/railway-heroku-rails"
source: "Railway"
published: "2022-08-19"
difficulty: "medium"
kind: "How-to"
reading_minutes: 7
tags: ["deployment","cloud","ruby"]
---

# Migrating From Heroku To Railway

A post on [Railway](https://swe.quest/sources/railway.md), published 2022-08-19, 7 min read, How-to. Original: [https://blog.railway.com/p/railway-heroku-rails](https://blog.railway.com/p/railway-heroku-rails)

## Summary

Moving a Heroku app to Railway comes down to three steps: deploy from a GitHub repo, import Heroku config vars, and add Postgres and Redis as separate database services. Railway reads the repo's Procfile and turns each named process (e.g. web, worker) into its own service, which takes the place of Heroku's dyno process model. It injects DATABASE\_URL and REDIS\_URL automatically, so any imported Heroku copies of those variables must be deleted or they will override Railway's. The guide also covers \`railway run\` for running commands like migrations against cloud variables, \`railway up\` for CLI deploys, and having apps listen on 0.0.0.0:$PORT so Railway can expose them.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Deployment](https://swe.quest/tags/deployment.md) (Reliability & operations)
- [Cloud platforms](https://swe.quest/tags/cloud.md) (Infrastructure)
- [Ruby](https://swe.quest/tags/ruby.md) (Languages)

## Prerequisites

- Heroku Procfiles
- environment variables

## Keywords

Railway, Heroku, Procfile, Ruby on Rails, PostgreSQL, Redis, Railway CLI

## Related posts

- [Migrate a Rails App from Heroku to Render](https://swe.quest/articles/migrate-a-rails-app-from-heroku-to-render-a8a375d8766a19ae.md): Render · 2022-05-23 · Medium · 8 min read · Ruby, Infrastructure as code, Deployment, Cloud platforms
  Migrating the open-source git-scm.org Rails app from Heroku to Render means mapping Heroku concepts (web/worker processes, dynos, Heroku Postgres/Redis, Scheduler, config vars) to Render equivalents and codifying the whole stack in a render.yaml Blueprint.
- [Getting started with Ruby on Rails and Postgres on Supabase](https://swe.quest/articles/getting-started-with-ruby-on-rails-and-postgres-on-supabase-03d6ca4747754aea.md): Supabase · 2024-01-29 · Medium · 3 min read · Ruby, PostgreSQL, Deployment
  A Rails app can be wired to a Supabase-hosted Postgres database by scaffolding with \`rails new -d=postgresql\` and supplying the Supabase pooler connection URI through the \`DATABASE\_URL\` environment variable.
- [Deploy a Dart App on Railway, Part 1](https://swe.quest/articles/deploy-a-dart-app-on-railway-part-1-9c43a3141edcb7ac.md): Railway · 2024-12-13 · Medium · 7 min read · Deployment, Containers, Cloud platforms, PostgreSQL
  A Flutter + Serverpod trivia app is deployed to Railway with a Railway-hosted PostgreSQL database, using the Railway CLI and a custom multi-stage Dockerfile that compiles the Dart server and bundles a Flutter web build into Serverpod's static webserver.
- [Migrate a Django App from Heroku to Render (and get it ready for prod)](https://swe.quest/articles/migrate-a-django-app-from-heroku-to-render-and-get-it-ready-for-prod-9f68854dd66c351a.md): Render · 2022-06-27 · Medium · 18 min read · Infrastructure as code, Deployment, Python, Cloud platforms
  A Django e-commerce app (Saleor) can be moved from Heroku to Render by translating its app.json, Procfile, Dockerfiles and docker-compose.yml into a single render.yaml Blueprint.
- [Building a NestJS App on Railway](https://swe.quest/articles/building-a-nestjs-app-on-railway-6bac96cda5fec5ce.md): Railway · 2024-12-13 · Medium · 6 min read · TypeScript, Deployment, Caching, PostgreSQL, Cloud platforms
  A NestJS app can run on Railway as a Dockerized service from a GitHub repo, with Redis for caching, Postgres via TypeORM, and in-process cron jobs.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
