Using Templates in DeployHQ
In a case where you have certain aspects of a DeployHQ project that are shared across other projects, such as the same server, notification settings and SSH commands, you can create a template. This can be applied when you come to create another project, meaning you aren't spending time setting up the same thing more than once.
Configuring a template
To create a template, head to the Templates tab at the top of the screen, then click New Template on the right hand side.
Enter a name for your template, then optionally select the option Copy configuration from an existing project?, and choose a project from the list. Click Create Template, then you'll be taken to a page to configure all the individual elements of it.
When you load up your template to configure it, you'll be initially presented with an overview of all configured elements, along with options on the left hand side that can be navigated to, to configure that specific aspect of the template.
- Servers & Groups - You can configure any number of servers and groups you like here in your template.
- Config Files - If you have a number of config files that are used across several projects, add them here.
- Excluded Files - You can add any number of excluded files you like to be used in the template.
- Notifications - If you want to set up the same notification endpoints for multiple projects, add them here.
- SSH commands - You'll be able to set up SSH commands in your template to be used across any projects you apply it to.
- Cached Build Files - Add cached files to keep stored in your project between builds.
- Build Commands - Configure commonly used build commands in your template to be used across your projects.
- Known Hosts - Configure servers that you wish to allow connections to when running a build.
Using a template
Once you've set up your template, you can apply it to a new project directly from the configuration screen by clicking the New Project From Template button, or from the new project screen via the Template dropdown.
Just add your project as normal and configure your repository, then any configured elements of the template will be added automatically. If any of these aren't required, you can simply remove them from your project.