user2015453
user2015453

Reputation: 5104

Restarting only a portion of a rack/Sinatra app

The great thing about PHP is that if you have something like

clothes.com, clothes.com/men.php, clothes.com/women.php

Then if you only edit the men's page, only that particular "app" will be restarted.

But on rack/Sinatra I have to touch the restart.txt file to restart the ENTIRE website.

Is there a way around this problem, so that users browsing other parts of the site wont have any problems while another part of the site get edited?

(i'm using mod-passenger on Apache, not that it's important..)

Upvotes: 0

Views: 79

Answers (2)

ian
ian

Reputation: 12251

This would be true in all cases anyway for editing (non-inline) views (not layouts).

Aside from that, if you're really worried about this then I'd suggest using versioned folders to hold the application code. When you do a deployment, change the proxy to point at the newer version. Those who had already made requests will remain on an instance of Apache and the application that is already running, as long as their request remains alive, and seemlessly (unless you've broken something with the code) move to the new code on the next request.

It's also a convenient way to rollback to the/a previous version quickly and easily.

Upvotes: 1

erdeszt
erdeszt

Reputation: 791

Check out the sinatra reloader from sinatra contrib

Upvotes: 1

Related Questions