10

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.

youderian
  • 101
  • 1
  • 4
  • Probably Related: [Deploy a project using Git](http://stackoverflow.com/questions/279169/deploy-a-project-using-git) – hakre Jul 28 '11 at 09:00

4 Answers4

8

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

Community
  • 1
  • 1
Clement Herreman
  • 10,274
  • 4
  • 35
  • 57
  • Great, thank you! When you push your code to staging and production, is there a way to automatically run the bash scripts? Does a VCS like git allow you to do this, or do you use a crontab? As you can tell, I'm a bit new to this.... – youderian Jul 28 '11 at 09:34
  • I edited to add some precision and answer your comment =). And don't worry, eveyone was new to everything once. – Clement Herreman Jul 28 '11 at 09:37
  • Perfect! Looks like I need to learn more about git. Thank you! – youderian Jul 28 '11 at 09:54
5

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.

gagarine
  • 4,190
  • 2
  • 30
  • 39
somewhatoff
  • 971
  • 1
  • 11
  • 25
  • I had given up on using Vagrant w/ Chef/Puppet do to what appeared to be much unneeded frustration/headaches until I found ansible. Your last comment seemed to suggest there is more to be desired with ansible when compared with Chef/Puppet. Is there something it doesn't offer that the others do? – ChrisC Dec 16 '13 at 17:42
  • 1
    One thing that springs to mind is that at the time of writing dependencies (in the form of roles) had only just been released, and we've found them to be useful in organising more complex stacks. Ansible is relatively young compared to the others, but their release cycle is short and I get the impression gaps are being filled in quickly. – somewhatoff Dec 20 '13 at 19:22
4

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.

Andrew
  • 227,796
  • 193
  • 515
  • 708
1

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.

anatoly techtonik
  • 19,847
  • 9
  • 124
  • 140