bolt Valebyte VPS from $4/mo — NVMe, 60s deploy.

Get a VPS arrow_forward

How to Migrate from Heroku to VPS in 2026: A Step-by-Step Guide

calendar_month May 25, 2026 schedule 8 min read visibility 64 views
person
Valebyte Team
How to Migrate from Heroku to VPS in 2026: A Step-by-Step Guide
A successful migration from Heroku to VPS in 2026 requires a server with the Ubuntu 24.04/26.04 operating system, Docker Engine, and Docker Compose installed, which allows for reducing infrastructure costs by 5-12 times compared to Heroku Professional plans.

The Economics of Heroku Migration: Why VPS is More Profitable in 2026?

The transition from PaaS solutions to your own infrastructure is primarily driven by the aggressive pricing policies of cloud giants. In 2026, a basic setup consisting of one Dyno (1 GB RAM) and a managed PostgreSQL database on Heroku costs a developer $50-70 per month. A configuration with similar power on a VPS starts at $6 to $12, while offering 4-8 times more RAM and full control over system calls.

The main reason for heroku migration is resource limits. Heroku strictly limits request execution time (30 seconds), temporary file volume (ephemeral filesystem), and the number of concurrent processes. On a VPS, you are free to configure Nginx timeouts, use local storage for caching, and run any number of containers as long as the server's physical resources allow. If you are just launching a project, explore which hosting for an MVP startup in 2026 will be the most cost-effective over a one-year period.

Comparison of Costs and Characteristics: Heroku vs VPS

Characteristic Heroku (Standard/Shield) Valebyte VPS (High Performance) Benefit
CPU Shared (limited by quotas) Dedicated vCPU (3.5+ GHz) 3-4x higher performance
RAM 512 MB - 1 GB ($25-50) 4 GB - 8 GB ($10-20) 8x more capacity for a lower price
Disk None (Ephemeral) NVMe SSD (40-160 GB) Persistent data storage
Traffic Included (with limits) 10-100 TB or Unmetered Freedom to scale traffic

Technical Requirements: Which VPS to Choose as a Heroku Alternative?

When choosing a heroku alternative, it is critically important to consider not only disk space but also single-core CPU performance, as many interpreted languages (Python, Ruby, Node.js) are sensitive to CPU frequency. For migrating a medium-sized application consisting of an API, a React/Next.js frontend, a PostgreSQL database, and a Redis cache, a server with 4 GB RAM is the optimal choice. You can read more about choosing memory capacity in the article how much RAM does a VPS need: 2 vs 4 vs 8 vs 16 GB.

Minimum and Recommended Characteristics

  • Minimum: 1 vCPU, 2 GB RAM, 20 GB NVMe. Suitable for small Telegram bots or static sites with a light backend.
  • Recommended: 2-4 vCPU, 8 GB RAM, 80 GB NVMe. Optimal for migrating from Heroku Production Dynos, allows running a full stack with monitoring.
  • For high-load systems: 8+ vCPU, 16+ GB RAM. If your application actively uses machine learning on the CPU, consider Bare-metal vs VPS for ML inference.

Also, pay attention to the storage type. In 2026, using standard SSDs (SATA) for databases is considered bad practice. Only NVMe provides the necessary IOPS for PostgreSQL to perform well under load. Before purchasing, check which disk to choose for a VPS in 2026 to avoid hitting an I/O subsystem bottleneck.

Looking for a reliable server for your projects?

VPS from $10/mo and dedicated servers from $9/mo with NVMe, DDoS protection, and 24/7 support.

View offers →

Step-by-Step Migrate from Heroku Process: From Dynos to Docker Compose

The migrate from heroku process begins with application containerization. Heroku uses Buildpacks to build the environment, but Docker is the standard for VPS. You need to create a Dockerfile in the project root that describes all dependencies. This ensures the application runs identically on both your local machine and the remote server.

Creating a Dockerfile for a Typical Application

Example Dockerfile for a Node.js application that replaces the standard Heroku buildpack:

FROM node:22-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install --production
COPY . .
EXPOSE 3000
CMD ["npm", "start"]

Configuring Docker Compose for Orchestration

Instead of manually managing multiple Dynos, we use Docker Compose. This allows you to describe the entire stack (App, DB, Redis, Worker) in a single YAML file. This is a key stage in the heroku to vps transition, ensuring ease of component management.

services:
  web:
    build: .
    ports:
      - "3000:3000"
    env_file: .env
    depends_on:
      - db
      - redis
  worker:
    build: .
    command: npm run worker
    env_file: .env
    depends_on:
      - db
      - redis
  db:
    image: postgres:16-alpine
    volumes:
      - postgres_data:/var/lib/postgresql/data
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
  redis:
    image: redis:7-alpine
volumes:
  postgres_data:
rocket_launch Quick pick

Looking for a server that just works?

Valebyte VPS — NVMe, 24/7 support, deploy in 60 seconds.

View VPS plans arrow_forward

Database Setup: PostgreSQL and Redis in Containers

In Heroku, the database is an external service (Add-on). When moving to a VPS, you become the administrator of your own DB. The simplest way is running it in Docker with a Volume mount for data persistence. This eliminates the need to pay for Heroku Postgres, the cost of which grows exponentially as data volume increases.

Exporting Data from Heroku

To migrate data, use the standard pg_dump utility. First, create a backup on the Heroku side:

heroku pg:backups:capture
heroku pg:backups:download

Then import the dump into your new container on the VPS:

docker exec -i server_db_1 pg_restore -U user -d dbname < latest.dump

Optimizing Redis for VPS

Heroku Redis often has limits on the number of connections. On a VPS, you can configure maxmemory-policy allkeys-lru in redis.conf for efficient RAM usage. Given that network bandwidth within a single VPS is virtually unlimited, latency between the application and the cache will drop to microseconds. If your application is traffic-intensive, check out the article on Bandwidth VPS: TB/mo vs unmetered to correctly calculate the load on the network interface.

Managing ENV and Secrets During a Heroku to VPS Move

In Heroku, environment variables are set via the Dashboard or CLI (Config Vars). During a heroku migration to a VPS, it is recommended to use .env files in combination with Docker Compose, but it is important to maintain security. Never commit .env to Git.

Secret Management Methods in 2026

  1. Environment files: Using a .env file on the server with access restricted by chmod 600 permissions.
  2. CI/CD Variables: If you use GitHub Actions or GitLab CI, secrets can be passed during the deployment process via SSH.
  3. HashiCorp Vault: For large projects requiring key rotation and centralized management.

Example of securely passing ENV via SSH during deployment:

ssh user@vps_ip "echo 'DATABASE_URL=${{ secrets.DB_URL }}' > /home/user/app/.env"

Running Background Tasks and Scheduler: Replacing Heroku Workers

Heroku uses separate Dynos for workers (e.g., Sidekiq for Ruby or Celery for Python) and Heroku Scheduler for periodic tasks. In a heroku to vps architecture, workers run as separate services in Docker Compose, allowing them to share server resources with the main application at no extra cost.

Replacing Heroku Scheduler

Instead of the paid Scheduler add-on, you can use three approaches on a VPS:

  • System Cron: Classic crontab -e on the host machine calling docker exec.
  • Docker container with Cron: A separate lightweight container that manages scheduling within the Docker network.
  • Built-in schedulers: Using libraries within the application (e.g., node-cron or apscheduler) if the application runs 24/7.

Example crontab entry for a daily database backup:

0 3 * * * docker exec db_container pg_dump -U admin mydb > /backups/db_$(date +\%F).sql
rocket_launch Quick pick

Looking for a server that just works?

Valebyte VPS — NVMe, 24/7 support, deploy in 60 seconds.

View VPS plans arrow_forward

Configuring Nginx and SSL for Production Environments

Heroku automatically manages SSL certificates and routing. On a VPS, you will need a Reverse Proxy. In 2026, the standard is the Nginx + Certbot (Let's Encrypt) combination. Nginx accepts incoming traffic on ports 80/443 and forwards it to the application's Docker container.

Nginx Configuration for a Docker Application

server {
    listen 8443 ssl;
    server_name example.com;

    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;

    location / {
        proxy_pass http://localhost:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

To automate SSL acquisition, use the command:

sudo certbot --nginx -d example.com

This will ensure automatic certificate renewal every 90 days, fully mimicking Heroku Automated Certificate Management (ACM) behavior.

Deployment Automation: CI/CD Like in Heroku

Many fear migrate from heroku due to losing the convenient git push heroku master. However, setting up GitHub Actions for VPS deployment takes no more than 15 minutes. You can set up a pipeline that builds a Docker image, pushes it to a Registry, and updates the containers on the server via SSH.

Example GitHub Action for Automated Deployment

name: Deploy to VPS
on:
  push:
    branches: [ main ]
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
      - name: Deploy via SSH
        uses: appleboy/ssh-action@master
        with:
          host: ${{ secrets.HOST }}
          username: ${{ secrets.USERNAME }}
          key: ${{ secrets.SSH_KEY }}
          script: |
            cd /app
            git pull
            docker-compose up -d --build

This approach provides continuous integration and delivery (CI/CD) that is just as convenient as PaaS solutions. If your project involves game servers—for example, if you are moving a backend for managing game worlds—check out how the best server for Minecraft 2026 is configured; the principles of containerization and resource isolation are similar there.

Similar deployment principles apply when migrating from other clouds. If you have previously wondered how to move from AWS Lightsail to VPS in 2026, you will notice that Docker Compose is a universal tool that simplifies infrastructure transfer between any providers.

Conclusions

Migrating from Heroku to a VPS in 2026 is a strategically sound decision for any growing project, allowing you to reduce costs by 80-90% and gain full control over the environment. For a successful transition, use Docker Compose for service orchestration and GitHub Actions for deployment automation, choosing a VPS with NVMe drives and at least 4 GB of RAM.

Ready to choose a server?

VPS and dedicated servers in 72+ countries with instant activation and full root access.

Start now →
support_agent
Valebyte Support
Usually replies within minutes
Hi there!
Send us a message and we'll reply as soon as possible.