Header

Deploying to multiple servers at the same time

Tips & Tricks and Tutorials

You may be deploying your code to more than one server, which can be particularly inconvenient when it comes to making sure all of your servers are running the same version of your application.

With DeployHQ, you can set up "Server Groups" to deploy to multiple servers at the same time, regardless of an individual server's protocol. Therefore, you can even group an FTP, SSH/SFTP and an S3 into one group and run a single deployment to all of them together.

Setting up a server group

To add a new server group to your project, head to Servers & Groups on the left hand side of the page, then click the New Server Group button on the right hand side:

New server group

Add a name for your server group, then select the default branch to deploy from. All servers within the group will then be deployed from the same branch. Next, you'll be able to choose how your servers are deployed, in parallel or sequentially.

Servers in a group are always deployed to in batches of 3, so you'll need to choose the option that's most suitable. Sequential deployments mean that each server will run the deployment process from start to finish, in turn and in order. Parallel deployments will start up to 3 servers at the time and, and each stage must be completed on all servers before the next stage starts.

Finally, choose your notification preferences for the group, then click Create Server Group to finish.

Adding servers to a group

Once you've created your group, you can add servers to it. To do that, head to any given server's settings area, then you'll find a dropdown for server group at the top of the page.

Add server to group

Once you've chosen your group and hit Update Server at the bottom of the page, you'll be able to start deploying to your server group straight away.

Deploying to a server group

Once you've configured your server group, you'll be able to deploy to it in exactly the same way as an individual server. Click Deploy Project at the top of the screen, then choose your server group from the Servers dropdown.

Servers list

With this being the first deployment, the start revision will be set to the beginning of time by default, causing a full deployment to be made to each server. Normally, it's best to leave this as-is so that all servers within the group have the same version of your code after the deployment is finished.

However, if you're happy that everything is already up to date on the server, you can click the orange commit selector icon next to the start revision, then choose the same revision as the end revision. That will then run a deployment with no changes, then future deployments will only upload files changed since the last revision.

In any case, you can click the Deploy button, and a deployment will be run to the server group. Once the deployment has finished, you can click a stage to view the log for each server within it.

Transferring log

Where appropriate in the report, each server will be shown with a play button that you can click to view the logs for that particular server.

FTP server transfer log

Automatic deployments

Finally, you can also set up automatic deployments for a server group. To enable it, simply head to the Automatic Deployments area via the link to the left hand side of the page, then toggle the server group.

Automatic deployments

Once enabled, automatic deployments will be triggered when a push is made to the branch it's set to deploy from.

Completed auto deployment

If you have any questions about server groups, or any other part of the DeployHQ platform, please don't hesitate to ask them.

A little bit about the author

I'm Adam W, or as everyone prefers to call me - Batman. I get a lot of satisfaction out of helping our customers and am committed to making their customer experience as positive as possible. When not offering support to our customers, you'll find me gaming, listening to music or running.

Proudly powered by Katapult. Running on 100% renewable energy.