Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What user is running my Rails app?

I'm trying to get a bare bones Rails app deployed under Apache, Passenger 3.0.0 and Rails 3.0.3. I'm getting all kinds of weird errors. mostly revolving around what I think is related to bundler or RAILS_ENV.

Only non-default thing about the app is that development & test environments use SQLite3 and production uses MySQL.

When hitting app from web browser Passenger is throwing errors regarding gems (sqlite3) that are specifically (in the Gemfile AND in the database.yml) declared as NOT part of the production environment.

How can I tell what user the server is trying to run my Rails app as? I would like to make sure the RAILS_ENV is set correctly for that user as I think Passenger is trying to run this app in development mode for some reason.

Edit: added results of ps aux | grep httpd

myserver:current elvis$ ps aux | grep httpd
elvis     4424   0.4  0.0    66152    192 s000  S+   11:03AM   0:00.00 grep httpd
_www      1950   0.0  0.2    93024   2544   ??  S    11:40PM   0:01.23 /usr/sbin/httpd -D FOREGROUND
root      1918   0.0  1.0    93024  10244   ??  Ss   11:39PM   0:02.75 /usr/sbin/httpd -D FOREGROUND
_www      4084   0.0  0.2    93024   2536   ??  S     9:41AM   0:00.15 /usr/sbin/httpd -D FOREGROUND

and ls -l ...

myserver:current elvis$ ls -l config
total 48
-rw-rw-r--  1 aaron  admin  1923 Nov 19 21:40 application.rb
-rw-rw-r--  1 aaron  admin   326 Nov 19 21:40 boot.rb
-rw-rw-r--  1 aaron  admin   741 Nov 19 21:40 database.yml
-rw-rw-r--  1 aaron  admin  1257 Nov 19 21:40 deploy.rb
-rw-rw-r--  1 aaron  admin   149 Nov 19 21:40 environment.rb
drwxrwxr-x  5 aaron  admin   170 Nov 19 21:40 environments
drwxrwxr-x  7 aaron  admin   238 Nov 19 21:40 initializers
drwxrwxr-x  3 aaron  admin   102 Nov 19 21:40 locales
-rw-rw-r--  1 aaron  admin  1808 Nov 19 21:40 routes.rb
like image 297
Meltemi Avatar asked Nov 20 '10 07:11

Meltemi


People also ask

How do you know if Rails is running?

Go to your browser and open http://localhost:3000, you will see a basic Rails app running. You can also use the alias "s" to start the server: bin/rails s . The server can be run on a different port using the -p option. The default development environment can be changed using -e .

How do I create a controller in Rails?

To generate a controller and optionally its actions, do the following: Press Ctrl twice and start typing rails g controller. Select rails g controller and press Enter . In the invoked Add New Controller dialog, specify the controller name.

What is a Rails console?

Rails console is an irb session that is built into the rails environment and is accessed by typing rails c into the terminal. It can be used to test association methods, validations and check error messages when building a rails app.


1 Answers

By default, passenger will run your app as the user who owns the config/environment.rb or config.ru file, see http://www.modrails.com/documentation/Users%20guide%20Apache.html#user_switching

Passenger will run in the production environment by default unless you tell it otherwise with the RailsEnv, see http://www.modrails.com/documentation/Users%20guide%20Apache.html#rails_env

like image 70
malclocke Avatar answered Nov 03 '22 01:11

malclocke