Get started today!◦ Full contract buyout ◦ Up to $1,000 credit ◦ Free migrations
Chat with us
Home » What is WordPress Guide » WordPress Development: What It Is and How to Get Started » Deploying a WordPress or WooCommerce Site with Branch – Nexcess

Deploying a WordPress or WooCommerce Site with Branch – Nexcess

Get fast, reliable hosting for WordPress

Power your site with the industry’s fastest, most optimized WordPress hosting

Branch is a Continuous Integration (CI) and Continuous Delivery (CD) tool designed around the needs of WordPress developers from the same folks behind WP Pusher. Best of all, Branch has built-in support for deploying to Nexcess!

 

To get started, sign up for Branch by connecting your GitHub, GitLab, or Bitbucket account, then create a site within Branch by selecting a Git repository.

 

Next, we’ll want to configure all of the steps necessary to build our site. Branch offers a number of “recipes” for common actions (installing Composer dependencies, running Webpack, etc.), but also gives us the ability to add any number of custom steps.

 

Build recipes within Branch, including npm, Composer, Grunt, Gulp, Webpack, and more

 Once we’ve outlined the steps necessary to build our site, we can move onto the next stage of our pipeline: testing.

If you have an automated test suite for your site already, you can simply tell Branch to run whatever commands are necessary. Even if you don’t already have tests, Branch makes it a breeze to add in linting, coding standards, and compatibility checks:

 

Build recipes within Branch, including npm, Composer, Grunt, Gulp, Webpack, and more

 

Now that we’ve installed our dependencies, built everything, and passed our tests, it’s time to get our code into production!

 

Branch contains recipes for deploying to Nexcess, and connecting the two platforms is painless:

 

  1. Select your site in the Branch dashboard, click “Settings”, then grab your Branch site’s public SSH key
  2. Add this public key to the list of keys within the Nexcess portal

 

Once Branch is able to communicate with your Nexcess site, we can select the “Nexcess” deployment recipe and fill in a few details:

 

  1. The hostname and username for the site (available via the Nexcess portal on your site’s “Access” screen)
  2. The web root that we’re deploying to. If our git repo is meant to serve as the wp-content/ directory, this value should be “public_html/wp-content”.
  3. The files we wish to deploy (generally the default, “*”, is sufficient)
  4. The git branch to deploy to this environment

 

Configuration for the Nexcess deployment recipe on Branch

 

The “Git branch” setting is especially important, as this lets you specify different deployments for different branches. For example, you might have a “staging” branch that deploys to your staging environment, letting you test changes before making them live.

 

It’s worth noting that Branch uses the continuous deployment model by default, where the pipeline runs with each push to the given branch. If you would prefer more of a continuous delivery model (where some manual action must be taken), you might consider maintaining a “production” branch that only gets merged into when you’re ready to release.

 

At this point, Branch should be configured to build and deploy your git repository to Nexcess! You may trigger your first deployment either by clicking the “Run Deployment” button on your site’s “Pipelines” page or by pushing to your Git repository.

Customizing your release process

One of the really nice features of Branch is the ability to configure additional steps after a successful deployment, such as automatically clearing your site’s object cache after a deployment. This can be accomplished using the WP-CLI recipe under “Other”:

 

The WP-CLI recipe configuration within Branch

 

The host and username will generally be the same as we used in the deployment step, and you can chain as many commands as necessary.

 

Please note that the commands will be run relative to the home directory of the SSH user, so commands should be prefixed with “–path=public_html” to avoid issues with WP-CLI not finding WordPress. For example, clearing the object cache would be “wp –path=public_html cache flush”.

 

 

Ready to get started?

Get the fastest, most secure WordPress.org hosting on the market.

Additional resources

What is managed WordPress hosting? →

Get details and decide if managed WordPress hosting is right for you.

Must-have web development plugins to create WordPress websites at scale →

Explore the best web development plugins to enhance functionality, improve performance, and streamline your WordPress site.

A complete guide to WordPress shortcodes →

Shortcodes make life easier. Learn how to get started!