'Running a Production Rails Server

I am new to Rails programming. I did some research, and decided to start with Rails 7, and Ruby 3.1.0.

I am following a simple online tutorial, using the standard Rails 7 stack: Sprockets, no Webpacker, Tailwind (starting to learn it), and MySQL.

I have a local MySQL server setup on my Mac, and i use mysqlworkbench to peer into the local DB.

Locally, I don't need to do anything to get the server started on my development machine. From the command line, I only need to do:

rails s

and a local web server is started on port 3000.

I have an old laptop, that I set up as an Ubuntu 20.04 machine, and is my home network, on port 10.0.0.253. I figured i can use it as a test server, so I can learn how to deploy in the real world. I installed Ruby 3.1, and Mysql on the Ubuntu machine. I also have nginx installed on it, but I don't have it configured to do anything.

On the Ubuntu machine, I can do

rails s

and then from mt Mac, I can go to:

http://10.0.0.253:3000

and I get the rails app.

Of course, when I close the terminal on the Ubuntu machine, the app stops working.

If I don't do rails s on the Ubuntu machine, if I do:

http://10.0.0.253

I get an error (can't find the site you're looking for).

I looked online, and there are a few articles about configuring nginx with Passenger, but no two recipes are the same.

My question is: When I push my code to the Ubuntu server, and I do:

bundle install
rake db:create
rake db:migrate
rake db:seed

What next? to start the server, and I can access it directly at: http://10.0.0.253



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source