I've been playing ar开发者_JAVA技巧ound with a rails app and showing the customer the updates by deploying it on heroku. Now the customer wants it set up on their on server...as a live site.
Heroku made deploying rails app so simple that I can not wrap my head around starting from scratch on a server.
To the experienced rails developers, what all is required to do this? My app uses postgresql and the server is a linux server. The customer claims that they have installed rails on the server.
Do I just have to install postgresql...create the DB...run migrations and voila? or is there other stuff involved as well. Up till now I was working with development section of database.yml...now it will pick up production?
Please give some pointers and/or links that explain the process.
I think capistrano web page has a decent how-to tutorial on where to start from.
Well, think about this: what does a rails app need?
- Ruby
- Rails (the version you used for your app!)
- Ruby gems you use
- Rails plugins you use
- A database with proper login/password access
If you use the RAILS_ENV environment variable, and set it to production, you won't have to worry about it for the next steps, otherwise REMEMBER TO DO THIS FOR THE PRODUCTION ENVIRONMENT!
You can use rake db:schema:load to set up the database, and then.. Well, make sure it loads at startup automatically, make sure you have whatever preloaded data you need, make sure it's accessible from the outside, or from wherever it needs to be accessed.
I don't know if there is anything else you need for the rails app -- but of course, Capistrano is a good idea, to help you maintain the app :)
You probably need to decide which server software you're going to use first, because that's not something that Heroku give you a decision about. Anyway, it's easy because Phusion Passenger is the default choice in the Rails world now. Passenger is easy to set up—it has probably the best command-line setup program I've ever seen—and the documentation is excellent.
Slicehost have a whole series of articles that cover setting up the various bits you need for various flavours of Linux. They really are excellent:
http://articles.slicehost.com/search?q=rails
You'll also need to learn how to use Capistrano, which is what most people use for deploying Rails apps.
Is there a reason why you can't use Heroku as your production environment?
Edit:
If they're running a php webserver the chances are they already have a functioning apache server. If this is the case you should look in to installing passenger and setting up a new database.
At this point you can either copy up your application yourself, run your rake tasks to get everything setup and then sit back and relax, or you can spend the time to learn how to use capistrano so you can repeatably deploy your application.
I suggest the latter... capistrano really isn't that tricky and assuming your application set up is relatively sane the defaults should get you 90% of the way there.
精彩评论