1

I'm new to Rails and am confused about running my RoR code on server (from linode.com). I have been developing my RoR application locally and I start my server using the rails server command. However, when I ported the same code to my server (git clone) and ran the command its asking me to create a new app. How can I make rails run my app? Also, what config changes are required to run the app on production environment.

I saw this, but am very confused about starting the server.

Community
  • 1
  • 1
Dunes Buggy
  • 1,779
  • 1
  • 21
  • 41

2 Answers2

4

It's highly unusual to see rails server used in production. Performance will be absolutely abysmal since it's constrained to a single process.

Most Rails projects employ a deployment tool like Capistrano to help automate the process of shipping code, building assets, and other steps required to make the application ready to power up.

It's also necessary to use a Rails hosting helper like Passenger to manage the Rails processes. There are others like Unicorn or Puma you might want to try, but the principles are similar.

Normally you'll need to prepare a different set of configuration files for your production environment. I strongly recommend keeping database passwords, API keys, and other sensitive information on the server itself, not checked into your repository. Most deployment tools make it easy to copy or link these into the appropriate place each time you deploy.

tadman
  • 208,517
  • 23
  • 234
  • 262
  • This is very helpful. I'm using `nginx` and `passenger`. Dont know how to make my rails code listen on 3000 port of localhost. Will checkout more details. But if you can point me in any direction, it would be really great. – Dunes Buggy May 08 '15 at 08:32
  • If you're using Passenger, all you need to do is configure Nginx to look in the correct document root. Once it sees a `config.ru` file it will know what to do. You won't need to start anything manually if you have it configured correctly, Passenger will start up any processes as required. – tadman May 08 '15 at 16:45
-2
rails server -e production

It will run the server in production environment.

Sachin R
  • 11,606
  • 10
  • 35
  • 40