Foundry Wordpress Tool

The problem

Wordpress is a fast tool for building a certain kind of website, deployment is largely a pain in the ass. We deal with dozens of clients who often have multiple environments. These environments span different distributions, shared hosting, dedicated VMs.

The (beginning of a) solution

Introducing Foundry Wordpress Tool: standardizing deployments of Wordpress over a variety of hosts & environments. To get started, install the gem:

$ gem install 'fwt'

Next, add a config file called .fwt.yml to the root of your local wordpress installation. The file should define as many environments as you want, each with the site root directory as "deploy_to" and ssh info as "username" and "hostname". Currently, specifying a password or an identiy file is not supported, so make sure your ssh config allows you to connect without specifying either. Here's an example:

beta:
  deploy_to: /srv/beta
  host: beta.example.com
  username: deploy
production:
  deploy_to: /srv/beta
  host: www.example.com
  username: deploy

Finally, you should be able to run fwt to get a list of available tasks & usage:

$ fwt
** Welcome to Foundry Wordpress Tool v0.0.5! **

Tasks:
  fwt db_pull          # Dump the remote database & import it locally
  fwt db_push          # Dump the local database & import it remotely
  fwt help [TASK]      # Describe available tasks or one specific task
  fwt remote_git_pull  # Pull latest code on the remote server via git
  fwt uploads_pull     # Pull wp-content/uploads from the remote
  fwt uploads_push     # Push wp-content/uploads to the remote host

Options:
  -e, [--env=ENV]  # Name of the remote environment (as found in .fwt.yml).

Some assumptions

We made a few assumptions to keep this tool simple:

The Wordpress server...

  • You can SSH to it without specifying a password or an identity file. Use your .ssh/config.
  • Has a MySQL server running and accessible as the deploy user.

The development machine...

  • Is running a local build of the wordpress site.
  • Has a MySQL server running and accessible as you.

What this is not

  • A tool for installing or configuring software packages
  • A deployment tool
  • A replacement for a versioning system

Some alternatives

In choosing a toolset for dealing with wordpress, you might consider replacing or supplimenting FWT with one of these:

Contribute!

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
  • Fork the project.
  • Start a feature/bugfix branch.
  • Commit and push until you are happy with your contribution.
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright (c) 2012 Foundry Interactive. See LICENSE.txt for further details.