Last updated on 13th April 2026

Managing Servers with the CLI

The DeployHQ CLI lets you manage all server configurations, including project servers, server groups, and account-wide global servers.

Project Servers

Listing Servers

dhq servers list -p my-app

This shows all servers configured for the project, grouped by server group where applicable.

Viewing Server Details

dhq servers show <server-identifier> -p my-app

Creating a Server

dhq servers create -p my-app \
  --name "Production Web" \
  --protocol-type ssh \
  --server-path /var/www/html

# Specify an environment
dhq servers create -p my-app \
  --name "Staging" \
  --protocol-type sftp \
  --server-path /home/deploy/staging \
  --environment staging

Supported protocol types include: ssh, ftp, sftp, s3, rackspace, heroku, elastic_beanstalk, and others depending on your account plan.

Protocol-Specific Flags

Each protocol type accepts additional flags specific to its connection requirements:

SSH / SFTP:

dhq servers create -p my-app \
  --name "Production Web" \
  --protocol-type ssh \
  --hostname example.com \
  --port 22 \
  --username deploy \
  --server-path /var/www/html

FTP:

dhq servers create -p my-app \
  --name "FTP Server" \
  --protocol-type ftp \
  --hostname ftp.example.com \
  --port 21 \
  --username deploy \
  --server-path /public_html \
  --use-passive true

S3:

dhq servers create -p my-app \
  --name "S3 Bucket" \
  --protocol-type s3 \
  --bucket-name my-bucket \
  --region us-east-1 \
  --access-key AKIA... \
  --secret-key ...

Run dhq servers create --help for the full list of flags for each protocol type.

SSH Key Authentication

When creating SSH or SFTP servers, you can automatically install your project's deploy key on the server:

dhq servers create -p my-app \
  --name "Production Web" \
  --protocol-type ssh \
  --hostname example.com \
  --username deploy \
  --server-path /var/www/html \
  --install-key

The --install-key flag copies the project SSH public key to the server's authorized_keys file, saving you from doing it manually.

Updating a Server

dhq servers update <server-identifier> -p my-app --name "New Name"

Deleting a Server

dhq servers delete <server-identifier> -p my-app

Resetting a Host Key

If a server's SSH host key has changed (e.g., after server rebuild):

dhq servers reset-host-key <server-identifier> -p my-app

Server Groups

Server groups allow you to deploy to multiple servers simultaneously.

Listing Server Groups

dhq server-groups list -p my-app

Viewing a Server Group

dhq server-groups show <group-identifier> -p my-app

Creating a Server Group

dhq server-groups create -p my-app --name "Production Cluster"

Updating a Server Group

dhq server-groups update <group-identifier> -p my-app --name "New Group Name"

Deleting a Server Group

dhq server-groups delete <group-identifier> -p my-app

Global Servers

Global servers are account-wide server templates that can be copied to any project. This is useful when you have standard server configurations shared across projects.

Listing Global Servers

dhq global-servers list

Viewing a Global Server

dhq global-servers show <server-id>

Creating a Global Server

dhq global-servers create \
  --name "Standard Production" \
  --protocol ssh \
  --server-path /var/www/html

Updating a Global Server

dhq global-servers update <server-id> --name "Updated Name"

Copying a Global Server to a Project

dhq global-servers copy-to-project <server-id> -p my-app

Deleting a Global Server

dhq global-servers delete <server-id>