• We’ve been working on a better deployment strategy within Linchpin for a while now. After some trial and a lot of errors we came up with a slightly different solution that is a bit out of the box.

    Understanding the Challenge

    As an organization with multiple designers, developers, project managers and product owners each who have access to our project repositories we have a slightly different challenge compared to smaller 1 or 2 person shops.

    WP Engine has some pretty stellar support for simple .git deployments. Out of the box their solution works really well if A) You are tracking your changes in a .git repo and have 1 repo for all your theme files. B) And/or keep all non core files (including plugins) within one repo. The solution provided by WP Engine does not necessarily support deploying multiple repos (for plugins and themes) in a clean way.

    LFTP as SFTP

    For our automated deployments to WP Engine we will be utilizing a service called Codeship. There are numerous Continuous Integration and Continuous Deployment services our there. Codeship happens to be the one we use for Linchpin.

    In order for this tutorial to be any help to you. Be sure to check to see if your provider allows LFTP.

    The reason we are using LFTP is to get around some of the inherit limitations of SFTP. SFTP does not have any commands to recursively delete a NON empty directory. This creates a big barrier to automating our deployments unless we create a lot of additional scripts. Luckily LFTP to the rescue. We can have LFTP act like SFTP in order to run simple commands like rm -rf my-old-theme as if we were using terminal/ssh

    Automating the Things

    1. Pull down the repo from .git (with the bash script(s))
    2. Remove files and directories not needed on production
      • (.git, scss, node_modules, bower components)
    3. Script Runs
      • Create Maintenance.
      • Connect to Server using LFTP (as SFTP)
      • Move Maintenance file to root on remote server.
      • Mirror ~/clone directory into themes/plugins folder (based on repo type)
      • Rename original theme/plugin folder to “project/name-” currentTimestamp()
      • Rename newly updated clone to repo/project name
      • Run wget command and check response to homepage to see if 200 response, (expand further)

    Discover more from Linchpin

    Subscribe to get the latest posts sent to your email.