Header

SSH Commands

SSH commands are commands that you can configure to run on a server before or after a deployment. These can be anything your server supports, such as starting or stopping services related to your app, or running a database migration.

To configure an SSH Command, head to the SSH Commands on the left hand side of the page within your project, then click New SSH Commmand to start:

SSH Command

Enter a description for your command which will be displayed in the deployment log, then the exact command you want to execute below. If you're executing multiple commands on different lines, you may need to terminate each line with a \.

Please note that DeployHQ does not automatically change the path commands are executed from, even if a deployment path has been provided. For any commands that have to be executed from a specific directory, you'll just need to add a command at the start of your sequence to cd to it.

Next, you can choose how long the command can run for, and the option to stop the deployment completely if the command fails, which may be particularly useful if you're running commands before the file upload process is started.

SSH commands - when to execute

After that, choose when the command should be executed; before or after the file upload process, then for all deployments, the first deployment, or every deployment after the first one.

Finally, you can choose if you want the SSH command to run on all servers in your project, or for only specific ones. If you want to set specific servers, first uncheck the Run this command on all current and future servers? option then you'll be able to select individual servers in the Choose a server dropdown.

Specific servers

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