One of the simplest and yet most useful features in Deploy 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, 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 repository, we'll click through to add a new project from the Projects page, then choose Codebase as our repository provider and click Create Project to proceed:
Next we'll need to login with our Codebase account details, then choose the appropriate project, after which we'll be presented with a list of available repositories to choose from.
Once we've selected our repository, Deploy will automatically connect to Codebase, 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 ready for deployment.
Each server in a Deploy 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:
This just needs to be copied to the clipboard, then added to our Post-Receive Hooks in our repository settings in Codebase.
That's it! All future pushes to the configured branch for your server will automatically trigger a deployment.
This means that whenever we run a deployment in Deploy, automatic or manual, a notification will be sent back to Codebase 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.