Live data from Hacker News

Ask HN: How do you deploy your PHP apps to production?

news.ycombinator.com

21–30 of 57 posts

Re: Ask HN: How do you deploy your PHP apps to production?

#21
Right now I'm using symfony php framework that deploys the code to whatever server I want(uses rsync and you must have access to ssh on that server). All the projects are kept in svn repo's.

I can imagine writing a script that just runs every so often to sync the staging server to the production server, however I don't really care for this method because I want more control. I may change my mind in the future.

For some internal applications that I work on at work, we deploy them using the good ol' "svn up". I really don't like this method for a ton of reasons. The first reason being I can just goto http://www.example.com/.svn and see all the svn files.

I think the best by far is using rsync. Some things that I have done with rsync is configure the database settings in a config file, then just have rsync ignore that file so I can set different database settings for dev/staging servers.

For personal projects I usually have them on a private space on Assembla, which one of the options is they allow you to FTP your code to a server. I haven't used it myself, but I can see where this would be useful.

Re: Ask HN: How do you deploy your PHP apps to production?

#22

We use Mercurial here. Easy, secure (ssh with keys) never forget files, small transfer size, possibility of committing regularly when the client has access to the files. With hooks, the update is done as soon as the changesets are received. In some cases we can even create websites on the fly with a simple "hg clone" I guess Git allows more or less the same workflow but Mercurial is easier for your designers.

Yes, I do basically this, but with Git.

Re: Ask HN: How do you deploy your PHP apps to production?

#23

We have build scripts for phing, exports from subversion, migrates the database, loads stored procs, triggers and views, creates symlinks for data here and there, creates our dojo build layers, and builds a couple of executables we need. Capistrano is better for the simple stuff, but once we started doing more we moved to phing.

We have a bash script which grabs the latest Phing config/property files and then Phing handles the rest...

* calls YUI Compressor to minify css/js * calls a custom script to upload images to the CDN * calls dbdeploy to update our staging database * symlinks the "built" revision to our staging site

When we push a build from staging to production, we run a small bash script that calls Phing which symlinks the desired revision to the production site.

Re: Ask HN: How do you deploy your PHP apps to production?

#25
Subversion -- the website is a working copy of the production branch and I just do an svn update when changes need to be deployed.

The whole thing is wrapped up in a script that makes it possible to one-click deploy changes.

The biggest thing is the application is directory independent and auto-senses the host for database selection. This means that no changes are required to the application to run it in development, staging, or production.

Edit: Apache is setup so that no .svn directories are served. Given that most web applications go through a front-controller now, I'm hoping this isn't as much of a concern anymore.

Re: Ask HN: How do you deploy your PHP apps to production?

#26

Capistrano, despite being written in Ruby, will deploy PHP. I've used it to deploy WordPress and SMF installs once or twice. The advantage here is that you don't have to choose git over svn or any CVS for that matter. You can keep your configs separate and link them in.

+1 for Capistrano, we use it to deploy Rails, Sinatra, and PHP apps. gem install capistrano-ext and you can do easy multi-stage deploys (deploy a different branch to your staging/testing/beta server by doing cap staging deploy vs. cap production deploy for example). More details here: http://weblog.jamisbuck.org/2007/7/23/capistrano-multistage

Re: Ask HN: How do you deploy your PHP apps to production?

#28
Work: rdist over ssh Personal projects: rsync over ssh

In both cases I use a wrapper script to make the push as simple as possible. At work I push from the dev server to prod, at home I push from my desktop to either dev or (dev and prod).

In both case I use RCS for version control.

Re: Ask HN: How do you deploy your PHP apps to production?

#30

Subversion -- the website is a working copy of the production branch and I just do an svn update when changes need to be deployed. The whole thing is wrapped up in a script that makes it possible to one-click deploy changes. The biggest thing is the application is directory independent and auto-senses the host for database selection. This means that no changes are required to the application to run it in development,…

Same here, but Mercurial instead of Subversion.
Post reply on HN