views:

59

answers:

1

I've been using Wordpress for awhile, it's installed on my own server, and one of the features I most love about it is how every time there is a new version it alerts you within the app's web-based admin and with one click I can upgrade the app. I don't have to get anywhere near a console.

Personally I wouldn't mind updating manually, but I can see how this could significantly affect the adoption of a piece of software. I'm working on creating a full-featured ruby on rails forum software and I would love to figure out how to include this feature. Any ideas if this could be done with rails?

Could a rails app modify it's own files? If it did, would the server need to be restarted?

To complicate things further, what if the app was deployed from a repo. Could the rails app check in a commit of itself after updating?

Maybe packaging the core of the app as a gem would be simpler? Then maybe the upgrade would not actually modify the rails MVC stack (the rails app would just be super-basic), instead if the forum was all contained within a gem then all it has to do is trigger a 'gem update [name]'. If this occurred, I don't think the Gemfile would even need to be updated. Would a server restart even be required to load the updated gem?

Ideas or feedback on any of this?

+2  A: 

Rails files can be modified and even deleted on production - in my case aplication is still working unchanged as all classes are cached in memory. It means Rails instances must be restarted to take new change.

I suppose WordPress is Perl via CGI and you just drop application into web directory to have it working immediately - same with updates - just overwrite files and Apache picks them up immediately.

In case of Rails is that you don't know target deployment architecture thus restarting application may not be trivial. E.g. with passenger I can just do touch tmp\restart.txt and then all instances are killed and started again. Some deployments may need init.d script restart invocation.

Maybe you could recommend or prepare a ready to use deployment model which supports autoupdate. In other cases users could do updates manually.

gertas
WordPress is PHP, not perl
buru
Not a bad idea to have a prepared or recommended deployment model, and limit the auto-update feature solely for that case. That makes the problem easier to solve. I still suspect that Gems might somehow simplify the problem a bit although I'm unsure exactly how. Anyway, thanks for your thoughts.
Keith Schacht
Technically gem may contain whole Rails application - slave, and that may be required by master Rails/Rack/Sinatra app. The master application may be just basic Rails or Rack "stub proxy" - connecting routings from gem (quite easy with Rails 3), and having db config. An autoupdate code may be available in slave app then you can autoupdate update functionality. The goal is to have master so tiny that it doesn't need any manual updates except grand versions (x.0) because you don't want to limit your development.
gertas
Yep, that's exactly what I was thinking. But the key part is, "An autoupdate code may be available in slave app then you can autoupdate update functionality"... how does that occur? On my dev machine I just do "gem update [name]" to update a gem, but could the stub rack/rails app somehow trigger an update of the gem on the production machine?
Keith Schacht
Yes, using gem, rack or bundler - theirs direct API (bypassing command-line). Probably you wont have access right to modify gems home dir but you can freely save gems in `vendor/gems` of master app.
gertas