将 Ruby on Rails 应用程序文件上传到 VPS 的内容、地点和方式?

发布于 2024-11-27 05:21:08 字数 194 浏览 2 评论 0原文

我正在使用 Ruby on Rails 3.0.9,我想发布我的网站。我已经将我的 VPS 设置为运行 Ubuntu 10.04 LTS 和 capistrano gem(我认为这也是可能的)。现在,我需要做的是将所有文件上传到 www/project_name 目录(我使用的是 Mac OS)...

我需要做什么才能完成此任务?

I am using Ruby on Rails 3.0.9 and I would like to publish 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

千紇 2024-12-04 05:21:08

您不需要部署计算机来安装 Capistrano。 Capistrano 会自动执行一系列任务,我建议您至少手动执行一项任务,这样您就知道发生了什么。迟早,您将调试一些 Capistrano 任务,因此您迟早可能会弄清楚其本质。

粗略地说,您需要做的就是在生产计算机上复制您的开发环境。如果您有版本控制,您可以在生产计算机上使用git clonesvnwhateveritis。如果没有,您可以使用 scp /local/rails/dir remoteuser@remotehost:www/projectname 对其进行 scp。

此时,您实际上应该在服务器上完成剩余的工作。既然您已经成功安装了 Capistrano,我假设您熟悉使用 SSH 的基础知识。

代码完成后,您必须安装先决条件。如果您使用的是 3.0.9,您应该能够运行 bundle install --deployment,其中部署标志基本上告诉捆绑程序使用与您的开发计算机上相同的 gem 集。

完成后,实际使服务器联机将根据您的设置而有所不同。如果您使用的是非独立乘客,此时只需遵循众多指南中的任何一个即可。如果您正在运行独立的 guest 或 Thin 或 unicorn 或任何其他独立的 Rails 服务器,请继续并以守护程序模式启动(这样当您结束 SSH 会话时它不会退出)并确保您设置了生产标志。您可以在 sudo 中启动它并让它侦听端口 80(例如,sudo Thin start -d -p 80),或者让它侦听更高编号的端口并在您的计算机上使用反向代理。面向 WWW 的服务器。有关如何反向代理的说明遍布互联网。

如果您有任何疑问,请告诉我。

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.

疯了 2024-12-04 05:21:08

Capistrano 的部署解决方案已完成一半。通常 Passenger 用作另一半,它位于服务器上并加载您的应用程序。为了实现这一点,通常使用 SSH 密钥。有很多关于如何设置的教程。 Dan Benjamin 写的我最喜欢的文章之一可以在他的博客 Hivelogic

编辑以提供更多初学者信息:

Capistrano来自 Capistrano wiki 的初学者指南。

来自乘客网站的乘客独立指南

准备好后,请务必查看您选择的网络服务器的其他指南。

这些指南将为您提供获得当地乘客和乘客所需的背景知识。 Capistrano 部署正在进行中。这些指南提供了实现您想要的目标所需的知识。

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.

为你鎻心 2024-12-04 05:21:08

通过 SSH 进行部署的简单简短示例 http://alexeypetrushin.github.com/vfs/ssh_deployment.html

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文