How you build and deploy a WordPress site will vary greatly depending on the project scope. The following are a few tips for dealing with production, staging and dev sites as a single developer working with a small business client.
Start development locally using Git (Theme folders only).
You might ask, why Git if I’m only a single developer. Great question. Without Git you have no track record of what happened when and where. Things don’t simply break. Things break when things changes. In WordPress that means either you changed something in code or something changed during a plugin or WordPress update.
While this won’t be a guide on how to use Git, a good tool for getting started is Tower. The secret for keeping things from getting too complex is only commit your theme folder. That leaves your production site flexible enough to receive plugin and WordPress updates outside of Git deployments. The only thing you’ll be pushing/pulling with Git are theme changes. This can be done by running
git init at the root of the current website project and the following
# wordpress specific
# anchorhost specific
# wpengine specific
# wp core (as of 3.4.1)
# large/disallowed file types
# a CDN should be used for these
Deploy to public site when your ready to show to client
If it’s a new website then I recommend deploying directly to where you plan to host the live site under a default name. With WP Engine that would look something like
http://projectname.wpengine.com. Launching is then as simple as pointing DNS to WP Engine, adding domain mapping and a bulk updating urls.
If remaking an existing site then I recommend cloning the existing site into staging and deploying directly to that cloned copy. The launch process would vary depending on if you need to pull over anything from production. If not you could deploy fresh from staging.
Avoid workflows requiring deploys staging to/from production
Production to staging deployments with WP Engine is a one click process. It’s all or nothing. When your ready to deploy the staging site back to production you have two options.
- Deploy Staging to Production which will destroy any changes to production like new orders and new form fill outs or
- Manually copy of your theme changes and reapply any page or content changes manually.
These are both painful options. It’s best to avoid unless it’s a one time thing like handling an entire new website redesign launch.
Theme updates locally, content updates publicly
All theme development should happen on your local computer then deployed via Git. There is no need for the development site to be fancy and polished with all the right information. When building sites you only need to get the core structure in place which be accomplished with fake content.
Content updates like page and post population should always be made on the final customer facing site. While building a new site all of these can be done before putting it the website live with it’s final domain name. After launch you can continue to make page revisions just as your client would.
Update the site like you’re the client. Use staging for previews only.
If you’ve created a good website, then making changes should be as simple as hitting an edit button. If there is a major new feature you’d like to preview before putting on the live site then use a staging clone. A staging site can be generated quickly from the production site and used to preview your locally development. I would treat the staging site as a local dev copy and plan for the info to be out of sync. Any changes should be manually reintroduced on production to prevent any information from being lost on production.