Factor #1: Codebase
One codebase tracked in revision control, many deploys
The first factor is a good one to start on because it’s probably the easiest. Your WordPress site/app codebase needs to be tracked in a version control system. Git, Mercurial, Subversion, etc. Pick one and use it. Git is usually the de facto choice these days and you can’t go wrong with it.
To make this clear and more WP specific:
1 WordPress site = 1 repo (1 codebase per app)
A deploy is simply a running instance of the app. That means that you could have many servers in different environments (such as production, staging, development, etc.) all deployed to various revisions/commits/branches. It’s still one codebase and many deploys.
The easiest way to get started with VCS is to host the repository locally on your own computer. If you aren’t familiar with the command line, there’s a long list of great GUI programs that make it really easy.
You’ll also probably want to host your repo somewhere externally, especially if anyone else is contributing to it. GitHub and Bitbucket are the most popular and both offer private repositories as well. If you just want a place to host some private repositories without much collaboration, Bitbucket offers unlimited free private repos.
Elephant in the Room
Using version control is the first thing any software developer should do and yet it’s still common for WP developers to modify live production files over FTP. VCS isn’t new. GitHub didn’t invent it. RCS came out in 1982. Source Code Control System (SCCS) was created in 1972. Basically, version control is an old and solved problem. But it’s only solved if you actually use it.
I’m not sure what I could say to convince you to start using Git (for example) if you don’t already, but I’ll give it a shot:
Using version control is the single best thing you can implement for any software project. It will make things easier and eventually save your ass. It’s also the difference between professional and amateur developers. You shouldn’t be charging people if you aren’t using it.
- Backing Services
- Build, release, run
- Port binding
- Dev/prod parity
- Admin processes
Want to turn your WordPress site into a Twelve-factor App? Bedrock is a modern WordPress stack to help you get started with the best tools and practices.