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

Header

Deploying a Concrete CMS Project with DeployHQ

Installing Concrete CMS

Before deploying, you need to set up your Concrete CMS project. Here's how to create a new project using Composer:

  1. Ensure you have Composer installed on your local machine.
  2. Open a terminal and navigate to your desired project directory.
  3. Run the following command to create a new Concrete CMS project:
composer create-project concretecms/composer new_project
  1. Once the installation is complete, navigate into your new project directory:
cd new_project
  1. Initialize a Git repository in this directory:
git init
  1. Add all files to the repository:
git add .
  1. Make your initial commit:
git commit -m "Initial Concrete CMS project setup"
  1. Create a repository on your preferred Git hosting service (e.g., GitHub, GitLab, Bitbucket).
  2. Add the remote repository to your local Git setup:
git remote add origin <your-repository-url>
  1. Push your code to the remote repository:
git push -u origin master

Using DeployHQ for Deployments

DeployHQ is a service that simplifies deploying applications to your servers. You can define configurations, custom commands, and automate deployments on pushing code.

The free plan lets you deploy 1 project up to 5 times a day!

Creating a Project

  1. After signing up and logging in, create a project by going to Projects > New Project.
  2. Follow the wizard and choose your repository. If you encounter issues connecting, refer to DeployHQ's support page.

Dedicated User for DeployHQ

For security, it's recommended to create a separate user for deployments:

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

Configuring a Server

Now, tell DeployHQ where your Concrete CMS application resides. Go to Servers > New Server.

  1. Choose a memorable name and select SSH as the protocol.
  2. Enter your server's IP address in the Hostname field.
  3. The Username should be deployhq (for example, you can use the one you want).
  4. Check the "Use SSH key rather than password for authentication?" box. Then, run these commands on your server:
   su - deployhq
   mkdir ~/.ssh
   chmod 700 ~/.ssh
   nano ~/.ssh/authorized_keys

Paste DeployHQ's public key, press Ctrl + X, y, then Enter to save.

  1. Finally, set correct permissions with:
   chmod 600 ~/.ssh/authorized_keys
  1. Set the Deployment Path to where your Concrete CMS application resides (e.g., /var/www/your-concrete-project).
  2. Enable "Perform zero-downtime deployments on this server".
  3. Enter "production" in the Environment field and enable automatic deploy.
  4. Once done, press Save.

Note: If you have connection issues, refer to DeployHQ's support page.

Config Files (Optional)

DeployHQ allows uploading files during deployment that you don't want in your repository (like application/config/database.php containing sensitive database credentials).

  1. Go to Config Files and click New Config File.
  2. In your project, copy the contents of your database.php file (or similar) into the config file content field.

Setting Up SSH Commands

We'll configure commands to execute on the server after deployment.

Go to SSH Commands and click New SSH Command.

Create the following commands:

  1. Clear Cache: cd %path% && php concrete/bin/concrete5 c5:clear-cache

  2. Update Composer Dependencies (if using Composer): cd %path% && composer install --no-dev --optimize-autoloader

  3. Run Database Migrations (if needed): cd %path% && php concrete/bin/concrete5 c5:update-schema

Commands run sequentially, so ensure they're in the correct order.

Deploying Your Project

That's it! Time to deploy.

  1. Click Deploy Project in the header.
  2. The created server and revisions should be preselected.
  3. Once everything looks good, click Deploy to begin deployment.

Now you've automated your Concrete CMS project deployments!

If you've got any other projects you'd like to automate deployments for, DeployHQ supports a wide range of application frameworks and content management systems.

Tree

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