开发者

What, where and how to upload Ruby on Rails application files to the VPS?

I am using Ruby on Rails 3.0.9 and I would like to publi开发者_JAVA技巧sh my web site. I already set my VPS running Ubuntu 10.04 LTS and the capistrano gem (this one I think as well as possible). Now, what I need to do is to upload all files to the www/project_name directory (I am on Mac OS)...

What I have to do to accomplish that?


You don't need your deployment machine to have Capistrano. Capistrano automates a bunch of tasks that I suggest you do at least one manually so you know what's going on. Sooner or later, you'll be debugging some Capistrano task, so you may as well figure out the guts sooner or later.

Coarsely, what you need to do is to basically duplicate your development environment on your production machine. If you have it on version control, you can git clone or svn whateveritis on your production machine. If not, you can scp it over with scp /local/rails/dir remoteuser@remotehost:www/projectname.

At this point, you should actually do the remainder of the work on the server. Since you've managed to install Capistrano, I assume you're familiar with the basics of making your way around SSH.

Once the code's over, you have to install the prerequisites. If you're using 3.0.9 you should be able to run bundle install --deployment, where the deployment flag basically tells bundler to use the identical gem set as on your development machine.

When that's done, actually getting the server online will vary based on your setup. If you're using non-standalone passenger, just follow any of the many guides at this point. If you're running standalone passenger or thin or unicorn or any other standalone rails server, go ahead and start that in daemon mode (so it won't quit on you when you end your SSH session) and make sure you se the production flag. You can either start it in sudo and have it listen on port 80 (e.g., sudo thin start -d -p 80) or have it listen on a higher-number port and use a reverse proxy on your WWW-facing server. The instructions for how to reverse proxy are all over the internet.

Let me know if you have any questions.


You have half of a deployment solution with Capistrano. Commonly Passenger is used as the other half, which sits on the server and loads your app. To accomplish this, usually, SSH keys are used. There are numerous tutorials on how to set this up. One of my favorites written by Dan Benjamin can be found on his blog Hivelogic.

Edited to provide more begginer info:

Capistrano begginer's guide from the Capistrano wiki.

Passenger Stand Alone Guide from the Passenger website.

Be sure to check out the other guides for the webserver of your choice when you're ready.

These guides will give you the background you need to get a local Passenger & Capistrano deployment going. These guides provide the knowledge you need to get achieve what you want.


Simple and short sample of deployment via SSH http://alexeypetrushin.github.com/vfs/ssh_deployment.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜