CakePHP应用程序部署 [英] CakePHP Application Deployment

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

问题描述

我有兴趣了解人们如何部署他们的CakePHP应用程序。最近我已经考虑了一些自由的CakePHP开发,这对我来说是一个很好的机会,可以在表单层获得一些经验(在我的FT工作中,我在业务和持久层中进行Java EE开发)。



我的想法在这一点上有点混乱,但我正在考虑以下情况:




  • 在IDE中开发的开发人员会修改与本地运行的开发Web服务器同步的文件(在后台)。这种情况是我最喜欢做开发...做出改变,并能够看到动作的变化,而没有任何额外的步骤。


  • 开发人员在IDE中工作,会通过FTP与远程运行的开发Web服务器自动(在后台)同步文件。当我使用我的上网本旅行时,这种情况会很有用(它的运行速度足够慢,因为它没有一个Web服务器)。


  • 管理员部署最新版本的CakePHP应用程序从源代码库到本地运行的Web服务器。

  • 管理员通过FTP部署最新版本的CakePHP应用程序从源代码库到Web服务器。

  • 管理员将较旧版本的CakePHP应用程序从源代码存储库部署到本地运行的Web服务器。

  • 管理员部署旧版本的CakePHP应用程序通过FTP从源代码库到Web服务器。



我最喜欢的开发工具是Eclipse,蚂蚁和Subversion。我的偏好是继续使用这些,但是如果这样做可以轻松实现场景,我会考虑切换。



问题:




  • 这些情况是否合理,还是应该以不同的方式考虑开发和部署?

  • 可以使用哪些工具有助于简化开发/部署?对于我来说,使用Ant,脚本等来滚动自己的解决方案会更好吗?

  • 在部署过程中如何处理数据库问题?如何为特定部署指定数据库连接属性?如果更新到CakePHP应用程序的较新版本(或还原到较旧版本)需要更改数据库模式和数据迁移?

  • 如何配置不同的部署?例如,考虑在开发期间使用的调试和日志记录级别增加,防止在开发过程中付款被发送到支付网关等。

  • 如何升级或恢复部署会影响客户?例如,如果它们处于交易中间(例如购买产品)?

  • 我们如何处理不同的CakePHP安装类型?根据安装类型,文件可能需要安装在不同的位置。我们如何知道应该安装哪些文件? CakePHP书介绍了开发,生产和高级安装。



对于一篇文章中的很多问题,我认为问题是所有相关的,认为在一个地方保持讨论是有用的。

解决方案


这些或者我应该以不同的方式考虑开发和部署?


似乎合理,虽然FTP同步使我想起了Dreamweaver。 :)



考虑使用允许您通过(S)FTP连接到服务器的IDE,或使用以下其中一个...


有哪些工具可以帮助简化开发/部署?对于我来说,用Ant,脚本等卷出自己的解决方案会更好吗?


Jenkins Capistrano Phing ,Ant, git push / pull rsync 等。


在部署过程中如何处理数据库问题?如何为特定部署指定数据库连接属性?如果更新到CakePHP应用程序的较新版本(或还原到较旧版本)需要更改数据库模式和数据迁移?


使用蛋糕模式生成蛋糕模式运行更新


我们如何配置不同部署之间的属性?例如,考虑在开发期间使用的调试和日志记录级别增加,防止在开发过程中付款被发送到支付网关等。


名称文件相应地(即 core.php.prd vs core.php.dev ),并在安装时重命名。 / p>


升级或还原部署如何影响客户?例如,如果他们处于交易中间(例如购买产品)?


所以你的应用程序文件不会结束在不一致的状态下,您应该首先检查一个新的应用程序副本到一个新的文件夹。复制任何用户提交的文件,重命名 *。prd 文件,然后用新的副本(通过重命名或使用符号链接)切换旧副本。会话应该存储在升级过程中的某个地方(例如 php 数据库而不是蛋糕)。


我们如何处理不同的CakePHP安装类型?根据安装类型,文件可能需要安装在不同的位置。我们如何知道应该安装哪些文件? CakePHP书介绍了开发,生产和高级安装。


开发安装与使用 .htaccess 要重定向请求的文件(人们看不到您的代码,除非您卸载/配置错误 mod_rewrite 和PHP)。生产安装稍微复杂一些,除非您可以编辑虚拟主机的文档根。高级安装允许您在文件系统中的任何地方安装Cake,但会增加更多的复杂性(因为您的文件位于两个单独的位置,但可以坐在一个备份中)


I am interested in finding out how folks are deploying their CakePHP applications. I have recently been approached about doing some freelance CakePHP development, which would be a nice opportunity for me to get some experience in the presentation tier (in my FT job I do Java EE development in the business and persistence tiers).

My thoughts are a bit disorganized at this point, but I'm considering the following scenarios:

  • Developer working in an IDE modifies a file, which is automatically (in the background) synchronized with a development web server running locally. This scenario is how I would ideally like to do development... make a change and be able to see the change in action without any extra steps.

  • Developer working in an IDE modifies a file, which is automatically (in the background) synchronized via FTP with a development web server running remotely. This scenario would be useful when I'm traveling using my netbook (which runs my IDE slowly enough as it is without a web server in the mix).

  • Administrator deploys the latest version of a CakePHP application from a source code repository to a web server running locally.
  • Administrator deploys the latest version of a CakePHP application from a source code repository to a web server via FTP.
  • Administrator deploys an older version of a CakePHP application from a source code repository to a web server running locally.
  • Administrator deploys an older version of a CakePHP application from a source code repository to a web server via FTP.

The development tools that I'm most comfortable with are Eclipse, Ant, and Subversion. My preference is to continue using those, but I would consider switching if doing so makes it easy to achieve the scenarios.

Questions:

  • Are these reasonable scenarios, or should do I need to think about development and deployment in a different way?
  • What tools exist that can help simplify development/deployment? Would it be better for me to roll my own solution with Ant, scripts, etc?
  • How do we handle database issues during deployment? How are database connection properties specified for a particular deployment? What if updating to a newer version (or reverting back to an older version) of the CakePHP application requires a change to the database schema and data migration?
  • How do we configure properties that vary between deployments? For example consider increased debug and logging levels used during development, preventing payments from being sent to payment gateways during development, etc.
  • How does upgrading or reverting a deployment affect customers? For example what if they are in the middle of a transaction (e.g. purchasing a product)?
  • How do we handle different CakePHP installation types? Files may need to be installed in different locations depending on the installation type. How can we know where files should be installed? The CakePHP book describes development, production, and advanced installations.

Sorry for so many questions in one post, but I think the questions are all related and thought it would be useful to keep the discussion in one place.

解决方案

Are these reasonable scenarios, or should do I need to think about development and deployment in a different way?

Seems reasonable, although the FTP synchronisation makes me think of Dreamweaver. :)

Consider using an IDE that allows you to connect to a server over (S)FTP, or use one of the following...

What tools exist that can help simplify development/deployment? Would it be better for me to roll my own solution with Ant, scripts, etc?

Jenkins, Capistrano, Phing, Ant, git push/pull, rsync, etc.

How do we handle database issues during deployment? How are database connection properties specified for a particular deployment? What if updating to a newer version (or reverting back to an older version) of the CakePHP application requires a change to the database schema and data migration?

Use cake schema generate and cake schema run update.

How do we configure properties that vary between deployments? For example consider increased debug and logging levels used during development, preventing payments from being sent to payment gateways during development, etc.

Name files that differ accordingly (ie. core.php.prd vs core.php.dev) and rename on install.

How does upgrading or reverting a deployment affect customers? For example what if they are in the middle of a transaction (e.g. purchasing a product)?

So your application files don't end up in an inconsistent state, you should begin by checking out a fresh copy of the application to a new folder. Copy across any user submitted files, rename *.prd files, and then switch the old copy with the new copy (by renaming or using symlinks). Sessions should be stored somewhere that will survive the upgrade (ie. php or database, rather than cake).

How do we handle different CakePHP installation types? Files may need to be installed in different locations depending on the installation type. How can we know where files should be installed? The CakePHP book describes development, production, and advanced installations.

The development install is just as secure as any PHP application that uses .htaccess files to redirect requests (people won't see your code unless you uninstall/misconfigure mod_rewrite and PHP). The production install is slightly more complicated unless you can edit the document roots of your virtual hosts. The advanced install allows you to install Cake anywhere in the filesystem, but adds more complexity (since your files sit in two seperate locations, but may sit in a single repo)

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

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