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:
- Ensure you have Composer installed on your local machine.
- Open a terminal and navigate to your desired project directory.
- Run the following command to create a new Concrete CMS project:
composer create-project concretecms/composer new_project
- Once the installation is complete, navigate into your new project directory:
cd new_project
- Initialize a Git repository in this directory:
git init
- Add all files to the repository:
git add .
- Make your initial commit:
git commit -m "Initial Concrete CMS project setup"
- Create a repository on your preferred Git hosting service (e.g., GitHub, GitLab, Bitbucket).
- Add the remote repository to your local Git setup:
git remote add origin <your-repository-url>
- 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
- After signing up and logging in, create a project by going to Projects > New Project.
- 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.
- Choose a memorable name and select SSH as the protocol.
- Enter your server's IP address in the Hostname field.
- The Username should be
deployhq
(for example, you can use the one you want). - 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.
- Finally, set correct permissions with:
chmod 600 ~/.ssh/authorized_keys
- Set the Deployment Path to where your Concrete CMS application resides (e.g.,
/var/www/your-concrete-project
). - Enable "Perform zero-downtime deployments on this server".
- Enter "production" in the Environment field and enable automatic deploy.
- 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).
- Go to Config Files and click New Config File.
- 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:
Clear Cache:
cd %path% && php concrete/bin/concrete5 c5:clear-cache
Update Composer Dependencies (if using Composer):
cd %path% && composer install --no-dev --optimize-autoloader
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.
- Click Deploy Project in the header.
- The created server and revisions should be preselected.
- 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.