Black Friday Sale: 50% off all plans!
Use code BLACKFRIDAY50

Header

Deploying a Ghost Project with DeployHQ

Deploying a Ghost Project with DeployHQ

Prerequisites:

  • A hosted server with Node.js and npm installed.
  • A Ghost project ready for deployment.
  • A DeployHQ account.

Using DeployHQ for Ghost Deployments

DeployHQ simplifies the deployment process for Ghost, automating builds and deployments.

Creating a DeployHQ Project

  1. Sign up and log in to your DeployHQ account.
  2. Create a new project:
    • Go to Projects > New Project.
    • Follow the wizard to connect your Git repository.

Configuring a Deployment Server

  1. Create a new server:
    • Go to Servers > New Server.
    • Name the server.
    • Select SSH as the protocol.
    • Enter the Hostname (server IP address).
    • Set the Username (e.g., deployhq).
    • Enable SSH key authentication:
      • On your server, run:
 su - deployhq
 mkdir ~/.ssh
 chmod 700 ~/.ssh
 nano ~/.ssh/authorized_keys
  • Paste DeployHQ's public SSH key into the file.
  • Save and close the file.
  • Set permissions: chmod 600 ~/.ssh/authorized_keys
  • Set the Deployment Path: Specify the directory where your Ghost project will be deployed.
  • Enable zero-downtime deployments: This ensures smooth deployments without downtime.
  • Set the Environment: Enter production.
  • Enable automatic deployment: This triggers a deployment whenever there's a code change.
  • Save the configuration.

Configuring SSH Commands

  1. Create new Commands in the Build Pipeline:
# Install dependencies
cd %path% && npm install --production

# Build the Ghost project
npm run build
  1. Create new SSH Commands :
 # Restart Ghost (If using a process manager like PM2)
 pm2 restart ghost

 # If using a systemd service
 sudo systemctl restart ghost

Deploying Your Ghost Project

  1. Click "Deploy Project" in the header.
  2. Select the server and revision to deploy.
  3. Click "Deploy" to initiate the deployment process.

Additional Tips

  • Configure environment variables: Use DeployHQ's configuration files to securely store sensitive information like database credentials.
  • Leverage custom scripts: Create custom scripts for more complex deployment tasks, such as database migrations or custom configuration changes.
  • Monitor deployments: Keep track of deployment statuses and logs to identify and resolve issues promptly.

By following these steps and customizing the configuration to your specific needs, you can effectively automate your Ghost deployments with DeployHQ, ensuring smooth and reliable updates to your website.

Tree

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