部署rails应用程序时要做的大事情 [英] Big things to do when deploying a rails app

查看:105
本文介绍了部署rails应用程序时要做的大事情的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题的问题在部署rails应用程序之前,我需要做些什么?我收到的大量答案比小东西要大。所以这个问题是差不多的。

In the question What little things do I need to do before deploying a rails application I am getting a lot of answers that are bigger than "little things". So this question is slighly different.

在部署rails应用程序之前,需要采取相当重要的步骤。在这种情况下,我的意思是要超过5分钟的事情,因此需要安排。对于小的线上配置更改,请使用小事情的问题。

What reasonably major steps do I need to take before deploying a rails application. In this case, i mean things which are are going to take more than 5 mins, and so need to be scheduled. For small oneline config changes, please use the little things question.

推荐答案

设置Capistrano部署如果您还没有,您将需要学习capistrano知道它,并使用它以自动的方式部署您的代码。这将涉及设置您的共享目录和共享资源,如database.yml。

Set up Capistrano to deploy You'll want to learn capistrano if you don't already know it, and use it to deploy your code in an automated way. This will involve setting up your shared directory and shared resources like database.yml.

安装基于C的MySQL宝石如果您没有全部所需的libs,这可能需要一点时间,但不到20分钟。

Install C Based MySQL gem If you don't have all the required libs, this can take a little while, but less than 20 minutes.

确保您不会遇到常见的Web应用程序攻击会话固定,会话劫持,跨站点脚本,SQL注入(可能您不用担心SQL注入)。在视图屏幕中输出用户输入的数据时,请确保使用h()。很多很好的材料在线上关于这个。

Make sure you aren't vulnerable to common web application attacks Session fixation, session hijacking, cross-site scripting, SQL injection (probably you don't have to worry much about SQL injection). Be sure you use h() when outputting user-entered data in a view screen. Lots of good material online about this.

选择服务器体系结构 Nginx,Mongrel,FastCGI,CGI,Apache,Passenger:有很多可供选择。想想你的应用程序将如何使用并决定最佳架构,然后设置它。

Choose a server architecture Nginx, Mongrel, FastCGI, CGI, Apache, Passenger: there is a lot to choose from. Think about how your app will be used and decide on the best architecture, then set it up.

设置异常通知程序或异常记录器您将希望应用程序在中断时提醒您。设置其中一个工具来跟踪生产异常。注意:异常通知器将在路由错误发生时(即当人们的胖手指URL或脚本小孩攻击您时)发出警告:所以请考虑您希望框架在何时发生并进行相应调整。

Set up Exception Notifier or Exception Logger You will want your app to warn you when it breaks. Set one of these tools up to track production exceptions. Note: Exception notifier will warn you when routing errors occur (i.e. when people fat-finger URLs or script kiddies attack you): so think about what you want the framework to do when that happens and adjust accordingly.

确保您的所有密码都超出了源代码控制。如果您有database.yml,mail.yml(如果您使用yaml_mail_config)或源代码控制中的其他敏感文件,将它们移出,将其替换为database.yml.example,并将它们放在服务器上的共享/文件夹中。

Make sure all of your passwords are out of source control If you have database.yml, mail.yml (if you use yaml_mail_config) or other sensitive files in source control, get them out of there, replace them with database.yml.example, and put them in the shared/ folder on your server.

确保您的数据库被锁定。在设置新的生产Rails框时,很多人忘记保护MySQL。不要像他们

Ensure that your DB is locked down. A lot of people forget to secure MySQL when setting up their new production Rails box. Don't be like them.

确保所有小型网络文件都已到位如果您计划在Google中列出,请生成一个网站地图.xml 文件。如果您打算使用一个.mt htaccess 文件,请确保它在那里。如果您需要一个 robots.txt 文件,以防止您的网站的某些区域被索引,请制作一个。如果您想要一个很好的<404>页面,请确保其设置正确。如果您希望在部署时出现Be Back Back页面,请确保您具有指定的Capistrano维护文件,并且Nginx或Apache知道如何以及何时重定向到它。

Make sure all of the little web-files are in place If you are planning to be listed in Google, generate a sitemap.xml file. If you are planning to use an .htaccess file for something, make sure it's there. If you need a robots.txt file to prevent certain areas of your site from being indexed, make one. If you want a good looking 404 Page, make sure it's set up correctly. If you want a "Be Right Back" page to be present when you deploy, make sure that you have a Capistrano maintenance file specified and Nginx or Apache knows how and when to redirect to it.

获取您的SSL证书如果要使用SSL,请确保获得在您的生产域上有效的证书,设置它们

Get your SSL Certs in place If you are going to use SSL, make sure you get certificates that are valid on your production domain, and set them up.

这篇关于部署rails应用程序时要做的大事情的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆