One of the simplest and yet most useful features in [Deploy](https://www.deployhq.com) is the ability to set up automatic deployments from a number of repository hosting services. In this post, we're going to look at setting up an automatic deployment from [Codebase](https://www.codebasehq.com), and outline some additional advantages provided by this ability.

## Setting up a Deploy project

To add a new project that will deploy from a [Codebase](https://www.codebasehq.com) repository, we'll click through to add a new project from the **Projects** page, then choose [Codebase](https://www.codebasehq.com) as our repository provider and click **Create Project** to proceed:

![New project](https://blog.deployhq.com/attachment/fac4d39a-de06-4ff9-9583-257e39c8ae74/rm-By-Tkn.png)

Next we'll need to login with our [Codebase](https://www.codebasehq.com) account details, then choose the appropriate project, after which we'll be presented with a list of available repositories to choose from.

![Repository list](https://blog.deployhq.com/attachment/ae9f6dd5-0cdb-4a2b-8973-70e8eb71771e/46dj1Es.png)

Once we've selected our repository, [Deploy](https://www.deployhq.com) will automatically connect to [Codebase](https://www.codebasehq.com), add a deployment key to the repository then upload a hook to the project's deployment notifications. We can then go ahead and [add a server](https://support.deployhq.com/articles/getting-started/adding-a-server) ready for deployment.

## Automatic Deployment

Each server in a [Deploy](https://www.deployhq.com) project has its own unique automatic deployment URL, allowing us to choose if we want to set up automatic deployment, or leave the server to be deployed to manually. This is especially useful when setting up a multi-server and branch workflow, with a testing, staging and production server for example.

To locate the automatic deployment URL, we just need to head to our **Servers & Groups** page via the **Settings** dropdown, then click to view and configure our server. The URL will be found on the right hand side of the page, under **Automatic Deployment** :

![Automatic deployment URL](https://i.ibb.co/vKQdcDB/KBr3pn-G.png)

This just needs to be copied to the clipboard, then added to our **Post-Receive Hooks** in our repository settings in [Codebase](https://www.codebasehq.com).

![Post-Receive Hooks](https://blog.deployhq.com/attachment/840ef011-33a3-46b8-a16b-e6d2ef06fe19/4z05Jre.png)

That's it! All future pushes to the configured branch for your server will automatically trigger a deployment.

## Deployment Notifications

As I briefly mentioned earlier, when we add the [Codebase](https://www.codebasehq.com) repository to our [Deploy](https://www.deployhq.com) project, [Deploy](https://www.deployhq.com) automatically adds a notification hook to our project in [Codebase](https://www.codebasehq.com).

This means that whenever we run a deployment in [Deploy](https://www.deployhq.com), automatic or manual, a notification will be sent back to [Codebase](https://www.codebasehq.com) that will display as an event in our feed for the project as well as in the Deployments page within the repository, allowing for easy tracking of deployments for the project.

![Push](https://blog.deployhq.com/attachment/49e4f654-48e7-4684-afc6-abb84e37c4a6/q-MTAh-B8.png)

![Deployment notification](https://blog.deployhq.com/attachment/8063e609-8531-49a7-b9ce-00e8e9cb03ab/52BEPih.png)

If you have any questions about automatic deployments using [Codebase](https://www.codebasehq.com) and [Deploy](https://www.deployhq.com), please [get in touch with us](mailto:support@deployhq.com).

