DEV Community

Hrishi Mittal
Hrishi Mittal

Posted on • Originally published at learnetto.com

How to deploy a Rails 7 app to Fly.io

This is a video lesson from the Full Stack Rails Mastery course.

In this 5-minute lesson, you'll learn how to deploy a simple Rails 7 app to Fly.io, a popular web hosting service.

Some common errors you may run into when deploying to Fly.io:

500 error on deploy

Image description

If you get a 500 error on deploy, it may be because the database did not get set up or migrated. You need these lines in your fly.toml file:

[deploy]
  release_command = './bin/rails db:prepare'

Enter fullscreen mode Exit fullscreen mode

Sometimes Fly removes that command, which causes the 500 error.

Missing assets

If you find that your CSS is not loading, even though the link tags look fine, it could be because these lines are missing or incorrect in fly.toml:

[[statics]]
  guest_path = '/rails/public'
  url_prefix = '/'
Enter fullscreen mode Exit fullscreen mode

It's something Fly adds to serve assets directly from its cache (which is not quite a CDN), bypassing your web server. Sometimes the guest path is set to an incorrect value.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More