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

Header

Deploying a Strapi Project with DeployHQ

This guide assumes you have a hosted server with Node.js installed and configured to serve your Strapi application.

Using DeployHQ for Deployments

DeployHQ simplifies application deployments. It allows configuration definitions, custom commands, and automated deployments on code push.

The free plan allows 1 project deployment up to 5 times daily.

Creating a Project

After signup and login, create a project via Projects > New Project.

Follow the wizard to choose your repository. For connection issues, consult DeployHQ's support page.

Dedicated User for DeployHQ

Create a separate user for deployments:

sudo adduser deployhq
sudo usermod -a -G www-data deployhq

Configuring a Server

Configure your Strapi application location. Go to Servers > New Server.

  • Name the server and select SSH protocol.
  • Enter server IP in Hostname.
  • Set Username as deployhq.
  • Check Use SSH key rather than password for authentication?. Run on your server:
su - deployhq
mkdir ~/.ssh
chmod 700 ~/.ssh
nano ~/.ssh/authorized_keys
  • Paste DeployHQ's public key, save with Ctrl + X, y, Enter.
  • Set permissions:
chmod 600 ~/.ssh/authorized_keys
  • Set Deployment Path to your Strapi application location.
  • Enable Perform zero-downtime deployments on this server.

Update your process manager (e.g., PM2) configuration to point to /var/www/your-strapi-project/current.

  • Enter production in Environment and enable automatic deploy.

Save the configuration.

For connection issues, refer to DeployHQ's support page.

Config Files (Optional)

Upload sensitive files via Config Files > New Config File.

Copy your .env file contents into the config file content field.

Setting Up SSH Commands

Configure post-deployment commands via SSH Commands > New SSH Command.

Create these commands:

  • Install Dependencies:
cd %path% && npm install --production
  • Build Strapi:
cd %path% && NODE_ENV=production npm run build
  • Restart Strapi (assuming PM2 is used):
pm2 restart strapi

*Ensure correct command order.

Deploying Your Project

Click Deploy Project in the header. Select the server and revisions. Click Deploy to start deployment.

Your Strapi project deployments are now automated.

For guides on deploying other applications, visit DeployHQ's guides page.

Tree

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