WordCamp Montréal: Build a Website on the Moon: WordPress Development from Anywhere
At WordCamp Montréal 2013, Sarah Semark talked about how to develop WordPress sites from just about anywhere. Slides. Here are my notes:
Why local development rocks
- Faster development - no need to wait for uploads.
- Better testing - change all the file without affecting production.
- Version control - keep a revision history using git.
- A nicer production server - it’s more stable, with less downtime and outages.
- Collaboration - can work better because you don’t have two people editing the same files.
- Deployment - can automate deployment, getting rid of a lot of human error.
- Use an XAMP stack (Operating system, Apache, MySQL, PHP) for your server.
- Git for version control.
- Automation scripts to sync your database changes.
- Set up your virtual hosts, allowing multiple sites, each with their own “domain” (can use something like wallybills.dev).
- A very fast system to track changes.
- Use your remote, or staging, location (like GitHub or BitBucket) to solve conflicts, not production.
- Setup your
.gitignore file to ignore
wp-config.php, all machine-specific files, and anything with sensitive data.
- On production, keep your
.git/ folder one level above your web root (
www/, or similar).
- Keep all your site data in sync when you make file changes. (Sarah has some files on GitHub Gist to help you out here.)
- Pull data down from production to your local machine so you have real content created by clients to style.
- Don’t use PHPMyAdmin to sync. Automate it.
- Keep the table prefix the same between local and production, for simplicity’s sake.
- Keep the
.git folder out of the web root.
- No sensitive files in the web root.
- You can move
wp-config.php up one level from the WordPress install location, and WordPress will still find it.
Published on the .
By Lucas Cherkewski.