In this article we’re going to cover how to set up a DeployBot account, where to get your SFTP login credentials from GoDaddy, how to connect your GitHub remote repository to your DeployBot account, getting your commits to auto-deploy to your Godaddy Managed WordPress server with every “git push,” and finally, how to send a command to your Managed WordPress server that will auto-clear its cache. Let’s dig in!
We all strive for the ultimate workflow.
Your setup gets you in a groove that keeps the momentum going and the productivity up. Nothing is better for productivity than making robots run cumbersome errands for you, like FTPing files to your server and clearing that server’s cache.
There only seems to be one weak link in the workflow chain: how to auto-deploy commits to your GoDaddy Managed WordPress server.
DeployBot has got your back.
DeployBot, previously deploy.io, provides the super-helpful service of updating your server’s files with your remote repository files upon every commit, automatically or manually.
They give you a ton of options in which to communicate with your server: FTP, SFTP, SSH, and so on. For the purposes of this article we’re going to stick to SFTP deployments, given that it’s secure and your GoDaddy Managed WordPress hosting provides it.
Step 1: Check for admin privileges.
The first thing we need to do is make sure that you have administrative privileges to the GitHub repositories you want to connect. For instance, if you are a collaborator on a project, make sure that the owner of the repository has given you GitHub administrative privileges.
Also, if you have not generated an SSH key for your GitHub account, you will need to do so in order for DeployBot to communicate with your remote repository. For more information on how to generate and add SSH keys to your GitHub account, refer to GitHub’s documentation.
Now, let’s take a quick trip on over to your GoDaddy account portal and grab the credentials that we’ll need a bit further into the article.
Next, click on the Settings button of the Managed WordPress server you wish to give DeployBot access to.
Select the SSH and SFTP tab. Copy your hostname, SFTP username, and password. Then enable SSH. (If you don’t have Jumpcut yet, go get it — it’s total game-changer.)
Step 2: Connect DeployBot
After you have those items on your clipboard, your GitHub repository set up, and have the SSH key generated, we need to mosey on over to DeployBot.com and register an account.
I should mention there are varying pro accounts. If you need to connect more than 50 repositories, there are options for enterprise accounts.
Once you have registered, log in and connect your GitHub account.
Next, you will need to click on the “Repositories” navigation link located in the top left side of the page, and select the “Connect a repository” button.
Now it’s time to connect your GitHub remote repository.
Simply click on the GitHub logo, then select your GitHub username and the repository you wish to pull your updated files from.
After the repository has been initialized, you will receive an email from GitHub notifying you that your SSH key was added to the repository you selected.
Go ahead and click on the initialized repository. It will redirect you to a page asking if you would like to create a new environment and server. After selecting that, you will be directed to the “Add an environment” page.
All you need to do here is label the of server you are deploying to. You can name this anything you want.
For the Deployment mode, select “Automatic”.
Lastly, select the repo branch that you would like to update your server’s files with. If you are inclined to notify third-party applications such as Slack upon each deployment, you can read more about it on DeployBot’s Integration page.
Upon saving you will be prompted to select an option on how you would like your commits deployed. Given the scope of this article and that you are using GoDaddy’s Managed WordPress hosting, we’re going to select SFTP.
We should now be on DeployBot’s “Add a new SFTP server” page. This is where all the magic happens.
Enter the name of your server in the name field.
Next, enter the hostname that you grabbed from your account.
Because we’re using SFTP we’ll need to use port 22 in the Port field.
Next, enter the destination path. This is where you want your files to go to on your server. For instance, you will be changing files to your theme or child theme so you will want to assign a path to that directory.
Your Managed WordPress path should look something like this: ~/html/wp-content/themes/my-theme
Now we can enter our login credentials that we copied from GoDaddy — but don’t save just yet!
Step 3: Add a shell command to flush the WordPress cache.
For our last feat of Jedi-level multitasking we will flush the GoDaddy cache automatically post-deployment.
While still on the “Add a new SFTP server” page, scroll down to the “Run shell commands after deployment” section. Enter this command:
wp godaddy cache flush
Note: This command is not part of WP-CLI. It’s specific to GoDaddy’s Managed WordPress setup.
Select the “Save Changes” button and voila, you are a multitasking wizard!
If you run into a snag or two, never fear. Leave your comments, tips, and questions below or in the GoDaddy Community.
Image by: Luke Anderson via Flickr