I'm thinking about a good workflow for php/mysql web-development.
Anybody got some tips?
Here is what we do:
We have a few custom scripts that take care of our database upgrades and our push to Production. For our database we keep all the deltas in a single folder and the script checks the current DB level against the available deltas and, if needed, applies them.
For promotion to Production we have another script that pulls down all the production data and then runs rsync to push up changes.
You don't mention what level of control you have over the servers, but the overall process would be the same for general development.
I think everybody does theese things slightly different, depending on the exact application. Here's our setup:
Before a release:
/trunk
./tags/yymmddhhiiss
.Once it's stabilised, we run the deploy script:
/current
to point to the freshly checked out tag.If we need to push a small change out quickly, we merge it to the current tag, and we can then run a much simpler hotfix process at the server:
svn update
Note that there are certain tools that are aimed at structuring/automating theese processes. Phing is one, and Symfony has its own batch system, which used to be a stand alone project called pake. And as if that's not enough, Zend Framework are about to create their own variant. It's all really a bit of a mess, but Phing is probably the most widely used. You can also use something non-php specific, such as Ant or Capistrano. We just use shell scripts, which basically fills the same need.
We also have a continuous build running, which checks out from the trunk and runs all tests. Currently we just have a basic collection of shell scripts doing it, but we're considering to switch to PhpUnderControl or xinc.
The migrations step perhaps deserves a bit explanation. Theese contains changes to the database, as well as other tasks that must be run for the new release. Our migrations are a bit simple at the moment; We simply have a folder with a bunch of .php
and .sql
scripts and the during the migration, theese are run in sequence. The way we keep track of which changes has been run, is by emptying the migrations
folder right after a new tag has been made. It would probably be smarter to use the database to log which changes have been run though. We are considered adopting something like ruckusing for this purpose.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With