Deployment

Using redeployment hooks

Overview

Redeployment hooks allow you to achieve continuous deployment by deploying your application whenever you push a change to your Git repository or when your continuous integration pipeline builds successfully.

Cloud 66 offers several methods for achieving continuous integration. Please read our continuous integration guide to compare and select the ideal method to suit your requirements.

Accessing redeployment hooks

A unique redeployment hook URL is automatically generated for each Cloud 66 application. To access it:

  1. Open the application from your Dashboard
  2. Click on ⚙️ Settings in the left-hand nav
  3. Click on Deployment in the sub nav
  4. Copy the hook URL from the Redeployment Hook row

You can use the Redeployment Hook URL to trigger automated deployments via your preferred Git or CI service.

Usage example

An example of a standard redeployment hook:

https://hooks.cloud66.com/stacks/redeploy/xxxx/yyyy

Use the correct redeployment URL

The xxxx/yyyy in the examples is for illustrative purposes only and should be replaced with your redeployment URL on your Application Information page.

Missing branch info?

In the case where the payload of the commit hook does not contain any branch information (Github and Bitbucket payload formats are supported) then the application will redeploy without attempting to match branch.

Adding redeployment hooks to your pipeline

The process of adding the hook differs by Git host, so we will guide you through doing this with GitHub, Bitbucket and a generic solution.

GitHub Setup

On your application, click Settings in the right sidebar and then the Information tab. Then copy the URL provided in the Redeployment hook field.

Next, visit your GitHub repository, click Settings in the right sidebar, and then Webhooks & Services in the left sidebar.

In the Webhooks window, click Add webhook and paste the redeployment hook URL into the Payload URL field. When you confirm by clicking Add webhook, GitHub will automatically test your hook with a Ping and you should get a green HTTP200 response.

Bitbucket Setup

On your application, click Settings in the right sidebar and then the Information tab. Then copy the URL provided in the Redeployment hook field.

Next, visit your Bitbucket repository, click Settings in the left sidebar, and then Hooks in the settings menu that appears. In the Select a hook field, select a POST hook, click Add hook and paste your redeployment hook URL into the field provided. Click Save to confirm.

Generic Setup

Most Git providers have a commit hook mechanism that you can use to post to the Cloud 66 redeployment hook URL. Please check your Git provider documentation for this information. If your Git provider has a non-conforming payload format (not compatible with Github or BitBucket formats) then please get in touch and we can extend our payload support!

Invoking your redeployment hook manually

To invoke the redeployment hook manually, you can POST an HTTP request to your redeployment hook URL. You can do this in curl like this:

curl -X POST [your redeployment hook URL]
Previous
Preview Deployments