1

I've inherited a project from a developer who I can no longer contact. It's a Ruby on Rails project hosted on Linode with SVN as the vcs.

I can SFTP into the server and change files but the changes don't show up on the site until I ssh in and reboot the server. These aren't changes to config files, just simple changes to some erb.html views.

In my previous experience using git with Linode, I just pushed and the changes would show up live. Perhaps the old developer set something up with an svn hook?

EEAA
  • 109,363
  • 18
  • 175
  • 245
LennonR
  • 113
  • 4
  • This really has nothing to do with Linode. It's just likely that you need to restart apache for the changes to take effect, no need to reboot the whole server. – EEAA Feb 20 '12 at 22:18

2 Answers2

1

I can think of two possibilities that could be causing this:

  1. Caching. If you were using PHP then I would assume this was APC with the stat setting switched to Off. Not being familiar enough with Ruby, I can only guess that there's an OpCode cache built in and that restarting the entire server flushes the cache. You might be able to get away with just restarting the HTTP daemon.
  2. Startup script. There might be a start up script that runs a checkout of the subversion repository or possibly a straight copy from one directory to another. This could also be part of an existing script such as the one that starts your HTTP daemon. Again, finding the script and running it might save you the hassle of rebooting the entire server.

An SVN post-commit hook could certainly be used to do whatever is being done here, even up to rebooting the server, but I would caution against it. Deploying code to a production server is something that you should have a certain amount of control over and should be separate from the development process. The idea of a developer committing something and having it automatically and instantly deployed gives me the heebie-jeebies.

Ladadadada
  • 26,337
  • 7
  • 59
  • 90
1

You don't really need to reboot the server, especially not with a Rails project. At worst, you might want to reload Apache/Nginx/Webserver of choice, but really, you can just restart your project internally.

You can do one of two things. Assuming that your project is being served by Phusion Passenger, you can add a commit hook to your repo on the server to reload the app...

cd /wherever/your/svn/repository/is/hooks
touch post-commit
chmod 755 post-commit

and then

#!/bin/sh
#post-commit hook. This will force Phusion to reload your RoR project
echo "Some message. Just letting you know I'm doing my job"
/bin/touch /wherever/your/project/is/tmp/restart.txt

Or reload the webserver (you need to make sure you have sudo-without-password rights though, or else this will fail. This will also force a refresh even if you're not using Phusion)

#!/bin/sh
#post-commit hook. This will reload the webserver, forcing everything to reload.
echo "Some message. Just letting you know I'm doing my job"
sudo /sbin/service whatever-your-webserver-init-is reload

And hey presto. Your project is now reloaded when you commit, and you should be able to see your changes immediately* (after you reload the page).

*these hooks are for SVN though. They might work in Git, who knows until you try. Someone might want to check on me in case I got it wrong

qweet
  • 731
  • 5
  • 11
  • So it looks like they are using Phusion Passenger but there is no hooks folder. If I make that folder will it know to look in there for possible hooks? – LennonR Feb 24 '12 at 16:38