用于简单 LAMP 开发的 Chef/Fabric/Puppet 的替代方案?
我最终致力于真正正确地学习软件设计过程,以提高我的技能并发展我的业务。这意味着采用版本控制 (git)、设置开发-暂存-生产环境并尽可能保持这些环境的配置相似。
我真的很忙最后一步,选择一个解决方案来自动化和同步我的服务器设置。我研究过《Chef, Puppet &》。织物,但就我的目的而言,它们似乎都过于复杂。我是:
- 在单个服务器上开发一个小型 Web 应用程序
- 将在具有中级 PHP 和 PHP 的 LAMP 环境中进行开发UNIX 技能
- 不会大量修改环境变量(主要是 php.ini、apache 配置)
我将不胜感激任何有关解决方案的建议,这些解决方案比掌握复杂的 Chef 环境或学习 Python 使用 Fabric 更容易实现。如果有必要,我可以这样做,但考虑到我非常简单的需求,我希望有一个更基本/优雅的解决方案。
I've finally committed to really learning the software design process correctly in order to advance my skills and grow my business. This means embracing version control (git), setting up a development-staging-production environment and keeping these environments as similarly configured as possible.
I'm getting really caught up with the last step, in picking a solution to automate and sync my server settings. I've looked into Chef, Puppet & Fabric, but for my purposes they all seem overly complex. I am:
- Developing a small web app on a single server
- Will be developing in a LAMP environment with intermediate PHP & UNIX skills
- Won't be heavily modifying environmental variables (primarily php.ini, apache configs)
I would appreciate any recommendations on solutions that would be easier to implement than mastering the complex Chef environment or learning Python to use Fabric. I can do this if necessary, but am hoping there is a more basic / elegant solution given my very simplistic needs.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在我工作的公司中,我们有或多或少相同的需求,我们只是设置了几个 bash 脚本。
基本上它设置了 git repo(本地和远程裸机),安装 apache2 和 PHP5(以及一些 php 扩展),配置 apache 的虚拟主机、php.ini,如果需要的话安装框架和引导项目(对我们来说是 symfony)。
我们有另一个脚本,它触发一些 EC2 实例,运行前面提到的脚本,启动测试套件,并下载这些脚本的报告。
厨师& Puppet 工作得很好,但有点矫枉过正,除非您有许多同时运行的项目。
编辑:
如果您想在提交/推送后运行脚本(例如部署到临时/预生产服务器、启动持续集成构建等),有一种方法可以使用 git call < code>post-hook,请参阅使用 Git Push 部署项目
In the company I work for, where we have more or less the same needs, we just setup a couple of bash script.
Basically it sets up the git repo (local, and distant bare), install apache2 and PHP5 (and some php extensions), configure the apache's vhost, php.ini, install frameworks and bootstrap project if needed (for us it's symfony).
We have another script, that fire some EC2 instance, run the previously mentionned script, launch the test suite, and download the report of these scripts.
Chef & Puppet works well, but it's a little overkill, unless you have many projects that runs in the same time.
Edit :
If you want to run a script after commiting/pushing (like deploy to staging/pre-production server, launching your continuous integration build, etc), there's a way to do this using git call
post-hook
, see Deploy a project using Git push为此,我强烈建议您查看 Ansible。
它是一个完整的解决方案,这意味着它可以处理配置管理、部署等。然而,根据我的经验,它比 Chef 或 Puppet 更容易学习,因为您可以从执行基本的 shell 命令开始,然后从那里继续。
无需学习新语言;您要做的所有配置和规范都是在 YAML 中完成的,它只是结构化文本。
总的来说,Ansible 将为您提供 Chef 或 Puppet 在您的水平上所提供的大部分功能,希望您会发现它更容易上手。
I'd strongly recommend having a look at Ansible for this purpose.
It is a full solution, which means it can handle configuration management, deployment and so forth. However, it is far easier to learn in my experience than Chef or Puppet as you can start by doing basic shell command execution and move on from there.
There's no need to learn a new language; all the configuration and specification you would be doing is done in YAML, which is just structured text.
Overall, Ansible will give you much of what Chef or Puppet will at your level and hopefully you will find it more straightforward to get started with.
如果您认真对待专业 Web 开发,我强烈建议您再考虑一下 Chef。它对我们(我和我的同事)来说真的很棒。我知道这可能看起来有点矫枉过正,但在我看来,它的优势远远超过了学习曲线。尝试维护不同的服务器环境(以及同事之间的本地开发环境)需要做很多工作。另外,Chef 使安装 Apache、PHP 和 MySQL 变得非常容易,因为已经有可用的食谱/食谱。
另外,请务必查看 Vagrant。它与 Chef 和 VirtualBox 配合使用,使得设置本地开发环境变得非常简单。
另外,如果您正在开发 Zend Framework 项目,您可能会对 Zend Framework Boilerplate 项目 感兴趣,该项目是一个使用 Vagrant 的一体化 LAMP 开发环境。
If you're serious about professional web development, I would strongly recommend taking a second look at Chef. It works really great for us (me and my co-workers). I know it may seem like overkill, but in my opinion, the advantages far outweigh the learning curve. It's a lot more work to try to maintain different server environments (and local development environments among co-workers). Plus, Chef makes it super easy to install Apache, PHP, and MySQL since there are already cookbooks/recipes available.
Also, make sure you check out Vagrant. It works with Chef and VirtualBox, making it really simple to set up a local development environment.
Also, if you're working on a Zend Framework project, you may be interested in the Zend Framework Boilerplate project which is an all-in-one LAMP development environment which uses Vagrant.
对于
简单 LAMP 开发
,您根本不需要任何东西。这并不是说简单的开发不能自动化,而是因为对于简单的开发来说,自己编写一些脚本通常就足够了(更容易和更快)(即使是在Python中)。当您意识到自定义脚本难以维护或不够时,您就可以使用 Fabric(shell 命令自动化)和/或 Chef/Puppet(服务器配置管理)等工具了。它们不容易学习,因为它们管理的系统互连并不简单(显然,这不是您的情况)。
对于您的单个服务器,我想说 README + Mercurial(如果您需要 GitHub,则使用 Git)加上一些符号链接应该足以管理配置、源和服务器设置。对于自动化和部署,只需编写一个脚本,将您的站点上传到 FTP/SSH、重新启动服务器、执行测试,无论您决定什么。这就是
简单部署,简单开发
。如果您不想为此编写 PHP 并且不了解 shell - 那么 Fabric 将为您节省一些时间。一旦你的脚本准备好了,你就已经知道你的问题了,你可以在后台学习 Chef/Puppet,看看是否值得让你的环境变得复杂。
如果您选择尝试 Chef - 不要从 Chef Solo 开始 - 对于初学者来说这是有毒的小吃 - 使用 Hosted Chef + Client - 您的设置是免费的。对 Puppet 没什么可说的——我选择了 Chef,因为我妈妈说我需要知道如何做饭。
For
Simple LAMP Development
you don't need anything at all. It is not that simple development can't be automated, it's because for simple development it is usually sufficient (easier and faster) to write some scripts yourself (even in Python).When you realise that your custom scripts are hard to maintain or not enough, you are ready for tools like Fabric (shell command automation) and/or Chef/Puppet (server configuration management). They are not easy to learn, because system interconnections that they are managing are not simple (which is not your case, obviously).
For your single server, I'd say README + Mercurial (Git if you need GitHub) plus some symlinking should be more than enough to manage configs, sources and server setup. For automation and deployment just write a script that uploads your site to FTP/SSH, restarts server, executes tests, whatever - you decide. That is
Simple Deployment for Simple Development
. If you'd rather avoid writing PHP for that and don't know shell - then Fabric will save some time for you.Once your scripts are ready, you already know your problems, you can learn Chef/Puppet in background to see if it is worth complicating things for your environment.
If you choose to try Chef - don't start with Chef Solo - it's a poisonous snack for a starter - use Hosted Chef + Client - it is free for your setup. Can't say anything for Puppet - I chose Chef because my mom said I need to know how to cook.