Deploying changes with Git and DeployBot

Last Updated -


This article walks you step-by-step on how to set up DeployBot with your Pagely services.

DeployBot is a tool you can easily utilize with your environments - allowing you to quickly deploy changes made to your Application's code repository. 

What You'll Need

  1. Access to a Pagely SSH/SFTP
  2. DeployBot account
  3. A local git and/or GitHub repository (both are used for this article)

What We'll Assume

  • We'll assume you have both your Pagely SSH/SFTP access and DeployBot account set up. It is recommended that you please be logged in to these using separate browser tabs.
  • We'll also assume you've created an empty repository on GitHub and cloned it locally.
  • Lastly, we'll assume you know how to connect using SSH to a Pagely Server (if not, please review the following article)

Connecting DeployBot to your GitHub Repository

  1. Log into https://{yourorg}.deploybot.com/
  2. Select Repositories.
  3. Select Connect a Repository.
  4. If your GitHub account is already connected, you should have the option to select from the dropdown menu your specific repository as seen in the git below (pagelydeploybottest)
  5. You'll need to contact Pagely support to whitelist the following IPs

 connect-repository.gif

Creating a New Branch

You can either do this step on GitHub, or locally as seen below...

create-branch.gif

Creating an Environment

  1. Return to your DeployBot Dashboard where you should see your GitHub repository (you can also click on Repositories), select your repository.
  2. Select Create an Environment.
  3. Specify a name in the Name field.
  4. Select Manual or Automatic (it doesn't matter, but a general rule of thumb is if you're creating a deploy scenario for a production application it's probably a good idea to choose "Manual"). We'll choose Automatic since this is a staging deployment.
  5. Select your Branch
  6. Click Save.
  7. Select SFTP for the Deployment option.

adding-environment.gif

Adding Server Configurations

  1. Add a name for this server configuration
  2. Enter your Pagely VPS hostname within the Hostname field.
  3. Set the Port as 22
  4. Set your Destination Path to the location on the server that the Git repository will be sent to (I suggest putting the absolute path).

    WARNING: We suggest ONLY deploying to your wp-content folder. If you deploy to your webroot directory be sure to not target any WordPress core files. These are maintained by Pagely.

    Also be mindful that your paths between an SSH and SFTP-Only user will vary. Please check by connecting to your server and checking the relative and absolute paths first.
  5. Set the Login field to your SFTP username.
  6. There will be no password since we'll be using DeployBot's public key. To enable public key authentication, enable the checkbox labeled Use public key for authentication.
  7. To use DeployBot's public key authentication, you'll need to add their public key to your Pagely account. Click on Show the commands to add a public key to expand the code example and copy the public key from within the single quotes on the first line of the example.
  8. Switch Over to your atomic dashboard and...
    1. In ARES/New Atomic: Select Your Profile Icon in the top right corner > Account Settings > >_SSH > paste the public key > Select upload key
    2. In Legacy: Select My Account > SSH Configuration > Paste your public Key > Select Upload key
  9. We're almost there! Return to DeployBot and select Run shell commands before Deployment. Within this field, add the following:
    date > ../git-test/deploybot-ran-at
    This allows us to verify that DeployBot is running properly by logging a timestamp. Of course, feel free to remove this after initial testing is complete.
  10. You can see there are a lot of options here and there's quite a bit you can do when deploying your code. For now lets Save and see if we can connect to our server successfully...

add-server.gif

The gif below shows you how to add your public key on ARES (new atomic)...

add-public-key-ares.gif

Testing Deployments

As we saw above we've successfully connected to pagelyexample and are ready to deploy! To do this manually (or revert future changes) we can select History to see previous changes, and Deploy to manually Deploy changes.

manual-deploy.gif

In our local Git repository, let's pretend we're created a new awesome plugin that we want to commit and push to GitHub under our new branch...

git-push.gif

If we check our server at the path we suggested, we'll notice two things...

  1. DeployBot definitely ran, we can tell because of the command we had our configuration run AFTER an event transpired.
  2. So if we merge to master (making sure everything looks okay) we should see the fruits of our labor...

push-master-results.gif

Sure enough we do! We're now rocking and rolling with DeployBot and Pagely!

Related Topics

Pagely is the Managed WordPress Hosting Platform designed to exceed the needs of media, business, and Enterprise customers alike. We help the world's biggest brands scale WordPress.

Copyright © 2006-2017 Pagely, Inc. All rights reserved.
Pagely® and WordPress® are registered trademarks.

Pagely
Powered by Zendesk