I have to restart Apache every time I change my Rails code
Asked Answered
H

2

10

I'm running Rails 3 with Apache and Passenger. Ever since I switched from Mongrel to Passenger I find that I have to restart Apache every single time I change my code. Is this the intended behavior? Is the only way to avoid this problem to use Mongrel in development?

Hoenir answered 2/2, 2011 at 20:38 Comment(3)
Does this help: #1107496 and the last part of blog.bsodmike.com/2010/06/05/…Adora
Are you talking about production or development?Seitz
I don't know - I'm also having problems controlling whether I'm in production or development.Hoenir
E
22

Assuming you have to restart Apache even for model/view/controller code, it would seem as if you've set up Passenger to run your app in the production environment. You can fix this by appending RailsEnv development to your virtual host.

Some code will require you to restart the app--examples of this is anything in config/initializers and vendor.

There's a way to only restart the app (and not the entire server), which is simply touch tmp/restart.txt. This will update the timestamp of tmp/restart.txt, which will trigger Passenger to restart the app.

Additionally, you can do touch tmp/always_restart.txt. This will tell Passenger to restart the app on every page load. This can be useful if you're working on sections that require restarts (such as the examples mentioned above). To stop the automatic restarting, you'll have to delete the file, like this: rm tmp/always_restart.txt.

Emeritaemeritus answered 2/2, 2011 at 22:44 Comment(1)
I missed tmp/always_restart.txt, much better than manually hitting restart.txt every time.Dirichlet
C
0

You can also use passenger by itself in development using the standalone mode. From your project directory, type

passenger start
Calculation answered 2/2, 2011 at 21:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.