Live data from Hacker News

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

news.ycombinator.com

41–50 of 57 posts

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

#41

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.

We use capistrano with multi-stage deployment. There is a recipe called "railsless-deploy" that removes all the rails dependent processes (http://github.com/leehambley/railsless-deploy). We also use the "git-deployment" recipe which does auto tagging of staging and production pushes (http://github.com/apinstein/git-deployment).

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

#42

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, not as nicely automated though (still need to actually type 'svn update'). What I really like is the ability to instantly roll back to any version. Don't forget to block .svn directories in your apache config!

The other advantage is sometimes, in emergency situations, I've had to edit the production code directly on the server. It's nice to be able to see what's changed, commit if necessary, or rollback to the original production version.

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

#43
post #19

I've tried out a few different tools now; the only two I've had any real success with were Capistrano and Fabric. Capistrano works well, great git integration, but it does have some rails-isms you need to override to make it work sanely. The capistrano-php extension can help with that: http://github.com/namics/capistrano-php but you'll need to use gem to manage it. You'll also definitely want the multistage plugin wh…

I was using Capistrano too but, like you, couldn't get my co-workers up-and-running with it so we switched to using Phing. I didn't want to be the only one doing deployments at work.

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

#44

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,…

We use Subversion as well. However, we use Ant scripts to do the build work. It makes updating our servers pretty straight forward.

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

#45

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, multiple sites. Using the same code base for dev/stage/production is a huge win.

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

#46
post #39

Earlier quoted context omitted.

I assume they're `svn export`ing rather than `svn checkout`ing.

Yet I see at least one reference to `svn update` I'm scurred.

Read the whole comment. It's easy to configure Apache or whatever HTTP server you're using to not serve anything in .svn directories. Duh.

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

#47
post #44

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,…

We use Subversion as well. However, we use Ant scripts to do the build work. It makes updating our servers pretty straight forward.

My sites are PHP so building is limited but some things do need to be built. However, my sites effectively build themselves without the need for another tool. On the first access of a resource, if the target doesn't exist it's built by the code automatically and stored in a cache. During development, the cache is disabled so you can edit and run without any intermediate build step. Things built this way include parts of the ORM and output templates.

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

#48
post #19

I've tried out a few different tools now; the only two I've had any real success with were Capistrano and Fabric. Capistrano works well, great git integration, but it does have some rails-isms you need to override to make it work sanely. The capistrano-php extension can help with that: http://github.com/namics/capistrano-php but you'll need to use gem to manage it. You'll also definitely want the multistage plugin wh…

hey thanks - we were trying to figure out between cap and fabric and your answer was of big help.

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

#49

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, not as nicely automated though (still need to actually type 'svn update'). What I really like is the ability to instantly roll back to any version. Don't forget to block .svn directories in your apache config!

umm, isn't that what svn export is for :)

why stop at .svn, how about .~, .bak, .tmp, .swp !

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

#50
post #39

Earlier quoted context omitted.

I assume they're `svn export`ing rather than `svn checkout`ing.

Yet I see at least one reference to `svn update` I'm scurred.

Don't be afraid, just configure your Apache server correctly and you'll be fine.

One-liner if you're already using rewrite:

RewriteRule ^(./)?.svn/ - [F,L]

If you're not:

/.svn/"> Order deny,allow Deny from all

Post reply on HN