RoR 服务器构建和 Capistrano 支持

发布于 2024-07-12 22:38:00 字数 1251 浏览 6 评论 0原文

我一直在使用 Ruby on Rails 创建一个网站,并将通过朋友托管它。 他有空间和能力来托管服务器,而我有系统致力于做专用服务器。 这是我第一次尝试 Rails 网站,另外还与朋友一起自行托管。

今天和明天我将使用以下软件配置格式化和准备服务器:

  • Apache2
  • Phusion Passenger(又名 mod_rails)
  • Ruby 企业版
  • MySQL 5

我确实有很多问题,对于它们的复杂性我深表歉意。 我还没有找到此配置的指南,而且作为 Rails 新手,我还没有经验来完成此配置。

对于此配置,最推荐哪种 Linux 版本?

我一直打算部署在CentOS上。 需要注意的是,我从早期开始就是 Windows 用户,只使用 Linux 作为网络主机,并且很少使用开发命令(例如 CVS)。 所以我对Linux的了解比较少,经验也比较少。 如果我遇到任何部署障碍、Linux 发行版带来的技术细节或任何类似的问题……我就完全陷入困境。

这包括从源代码构建任何东西之类的事情。

如何在我的服务器上设置 Capistrano 以进行远程部署?

我知道这是一个矛盾的说法(Capistrano 是客户端,而不是服务器端),但我不知道它在服务器上需要什么。 需要FTP吗? SFTP? SSL? SSH? 什么?

我需要在我的服务器上配置什么,以及如何配置它,才能使 Capistrano 顺利运行?

另外,我如何让 Capistrano 知道我的 SCM 位于本地主机并且由 Mercurial 提供? (我使用了 TortoiseMg。)我可以转换为 SVN,并可能在服务器上设置一个存储库,但我不完全确定如何做到这一点。

从本地主机开发部署到完全不同的操作系统上部署时,您注意到的最大障碍是什么?

杂项

那为什么不部署到 Windows 上呢? 因为我正在买单,而且我不想支付另一份 XP 或可能的 2000 个副本; 我拒绝使用Vista。 另外,对于服务器环境来说,Linux 比 Windows 更安全。

为什么不阅读现有的指南?我是; 这是我使用 Ruby on Rails 的第一个站点,我的预算现在不到两位数,我正在尝试通过进行服务器配置和远程部署(用于站点的进一步开发)来扩展我的视野我。 过去我的 PHP 网站依赖于主机,但它们的配置更加同质。 Ruby 服务器非常昂贵,对我来说太昂贵了,了解它的配置也没什么坏处。

I have been creating a website with Ruby on Rails, and will be hosting it through a friend. He has the space and capacity to host the server, and I have a system to devote to being a dedicated server. And this is my first attempt at a Rails website, plus self-hosting with a friend.

I will be formatting and preparing the server today and tomorrow with the following software configuration:

  • Apache2
  • Phusion Passenger (aka, mod_rails)
  • Ruby Enterprise Edition
  • MySQL 5

I do have a number of questions, and I apologize for their complexity. I haven't found a guide for this configuration yet, and being new to Rails I haven't the experience to navigate my way through this yet.

What build of Linux is most recommended for this configuration?

I have been planning to deploy on CentOS. The caveat is that I have been a Windows user since my early days, and have only used Linux as a webhost and very few development commands (such as CVS). Thus my knowledge of Linux is rather small, and my experience smaller. If I run into any deployment snags, technicalities thanks to the distro of Linux, or anything of the sort ... I'm totally hung out to dry.

This includes things like building anything from source code.

How do I set up Capistrano on my server for remote deployment?

I know this is an oxymoron (Capistrano is client-side, not server-side) but I don't know what it needs on the server. Does it need FTP? SFTP? SSL? SSH? What?

What do I configure on my server, and how do I configure it, to enable Capistrano to run smoothly?

Also, how do I refer Capistrano to the fact that my SCM is on localhost and is by Mercurial? (I used TortoiseMg.) I could convert to SVN and probably set up a repository on the server, but I'm not entirely sure how to do that.

What is the biggest snag you watch for when deploying from a localhost development, to deployment on a totally different OS?

Miscellaneous

Why not deploy to Windows then? Because I'm footing the bill, and I don't want to pay for another copy of XP or possibly 2000; I refuse to use Vista. Plus, Linux is much more secure than Windows for a server environment.

Why not read the existing guides? I am; this is my first site with Ruby on Rails, my budget is in the less than double-digits area now, and I'm trying to expand my horizons by doing the server configuration and the remote deployment (for further development of the site) by myself. I've relied on hosts in the past for my PHP websites, but they're much more homogeneous in their configuration. Ruby servers are expensive, prohibitively so for me, and to learn its configuration wouldn't hurt to know.

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

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

发布评论

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

评论(3

爱情眠于流年 2024-07-19 22:38:00

对于此配置,最推荐哪种 Linux 版本?

只要可以运行 Apache2(几乎是所有发行版)并且您可以安装 Passenger(以及 ruby​​ 和导轨)。
我个人使用 CentOS,发现它的包管理器非常容易使用 (yum)。

yum install -y httpd ruby
gem install rails passenger

然后您所要做的就是在 /etc/httpd/conf/httpd.conf 中进行一些配置来添加 Passenger(在 Passenger 的安装文件之后 passenger-install-apache2-module code>)并将其指向您的部署文件夹 .../app_name/current/public

由于您使用的是 Passenger,因此您应该覆盖重新启动任务以使其工作。

config/deploy.rb

namespace :deploy do
  desc "Restart Application"
  task :restart, :roles => :app do
    run "touch #{current_path}/tmp/restart.txt"
  end
end

如何在我的服务器上设置 Capistrano 进行远程部署?

Capistrano 需要的只是 SSH 访问权限,并具有足够的权限来部署、迁移、重新启动应用程序服务器,只需按照 入门指南 进行操作即可.capify.org/" rel="nofollow noreferrer">Capistrano 网站,您将立即启动并运行。

Capistrano 需要访问您的 SCM,您需要允许它连接到您的机器。 Capistrano 所做的就是将您的代码检出到发布文件夹中,并从旧版本中移动符号链接并重新启动您的应用程序服务器。

从本地主机开发部署到完全不同的操作系统上部署时,您遇到的最大障碍是什么?

最大的障碍是迁移、测试、测试、测试、再测试。 应用程序中的错误很容易修复和重新部署,但迁移中的错误可能会带来巨大的痛苦,并可能导致数据丢失。

What build of Linux is most recommended for this configuration?

Any of the distributions will work fine as long as they can run Apache2 (which is almost all of them) and you can install Passenger (along with ruby and rails).
I personally use CentOS and find its package manger to be ridiculously easy to use (yum).

yum install -y httpd ruby
gem install rails passenger

Then all you have to do is a little configuration in /etc/httpd/conf/httpd.conf to add Passenger (following the install file for Passenger passenger-install-apache2-module) and point it to your deployment folder .../app_name/current/public.

Since you are using Passenger you should override the restart task to work for it.

config/deploy.rb

namespace :deploy do
  desc "Restart Application"
  task :restart, :roles => :app do
    run "touch #{current_path}/tmp/restart.txt"
  end
end

How do I set up Capistrano on my server for remote deployment?

All Capistrano needs is SSH access with sufficient permissions to deploy, migrate, restart app server, etc. Just follow the getting started guide at the Capistrano website and you will be up and running in no time.

Capistrano needs access to your SCM, you will need to allow it to connect to your machine. All Capistrano does is checkout your code into a release folder and moves the symbolic link from the old version and restarts your app server.

What is the biggest snag you watch for when deploying from a localhost development, to deployment on a totally different OS?

The biggest snag is with migrations, test, test, test, and test them some more. A bug in your application is easy to fix and redeploy, but a bug in your migration could end up a huge pain in the ass with the possibility of data loss.

戏蝶舞 2024-07-19 22:38:00

我发现 Slicehost.com(一家 VPS 托管公司)上发布的文章非常有帮助。

完整的文章列表位于:http://articles.slicehost.com/sitemap 。 您将在那里找到许多与 Ruby on Rails 应用程序的生产部署相关的文章。

I've found the articles posted at Slicehost.com (a VPS hosting company) to be pretty helpful.

The full list of articles are at: http://articles.slicehost.com/sitemap . You'll find a number of articles there related to production deployment of a Ruby on Rails application.

不一样的天空 2024-07-19 22:38:00

我建议使用 Ubuntu 服务器和 deprec,因为它提供了大量的系统管理方法,使事情变得更加容易。

I recommend using Ubuntu server and deprec, as it provides a ton of sysadmin recipes that make things even easier.

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