WebOps Tutorial on Running and Upgrading a Concrete CMS Website

May 2, 2024
By myq for Developers

This tutorial assumes a basic understanding of running and managing a website (WebOps), Linux command line, MySQL, and web server configuration. The first section describes some techniques to deploy a new or existing website while the second section describes how to safely upgrade an existing website. The last section discusses some general ideas about sustainably managing a customized website. These instructions are overviews; more detailed information is linked within each section.

Prerequisites

  • A virtual private server (VPS or similar with SSH access) or a local development environment.
  • Apache or Nginx or other server.
  • PHP (version required by the Concrete CMS version you are deploying).
  • MySQL or MariaDB database.

Deploying a New Concrete CMS

Set Up a Server Environment

For more details about supported softare versions, PHP extensions, and other minutiae, see the System Requirements documentation. Further details on configuration best practices, see the Configuration Best Practices documentation.

Install a server stack: Usually this will be Linux as the OS, MySQL or MariaDB as the database, Apache or Nginx as the web server, and PHP as the code interpreter. The latter components are usually installed through a Linux distribution's package manager. For example:

# For Ubuntu with Apache
sudo apt update
sudo apt install apache2 mysql-server php libapache2-mod-php php-mysql
# For Ubuntu with Nginx
sudo apt update
sudo apt install nginx mysql-server php-fpm php-mysql

Configure the web server to handle PHP files and set up a virtual host to listen for requests. For example:

  • Apache Configuration Example:
<VirtualHost *:80>
    ServerName example.com
    DocumentRoot /var/www/html/concrete
    <Directory /var/www/html/concrete>
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>
  • Nginx Configuration Example:
server {
    listen 80;
    server_name example.com;

    root /var/www/html/concrete;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    }
}
  1. Prepare the database by creating a database and user with the appropriate permissions.
CREATE DATABASE concrete;
GRANT ALL PRIVILEGES ON concrete_cms.* TO 'concrete'@'localhost' IDENTIFIED BY '<password>';
FLUSH PRIVILEGES;

Instal Concrete CMS

More detailed steps for installing Concrete can be found in Installing Concrete CMS documentation.

Download the latest version of Concrete CMS from the official website or use wget or cURL directly on your server. For example:

wget https://www.concretecms.org/download/latest.zip -O concretecms.zip

Unzip the downloaded file into the webroot directory. For example:

unzip concretecms.zip -d /var/www/html/concrete

Set file permissions appropriate for the webserver software. For example, if using Apache, the following might be appropriate.

chown -R www-data:www-data /var/www/html/concrete
find /var/www/html/concrete -type d -exec chmod 755 {} \;
find /var/www/html/concrete -type f -exec chmod 644 {} \;

Complete the installation by navigating to your domain and folloing the installation instructions. Alternatively, use the command line tool to complete the installation. For example:

cd /var/www/html/concrete
./concrete/bin/concrete5 c5:install

and answer the questions to complete the installation.

Upgrading Concrete CMS

Before applying the upgrade, follow these steps in a staging environment or local copy. For additional options and considerations, see the Upgrading a Site documentation. Make note of any special steps or issues encountered when running the upgrade and conduct thorough testing. Check for any compatibility issues with plugins, themes, and custom code. After you are sure that the website is functioning as expected after upgrading, repeat the procedure in the production environment.

Preparation

Check system requirements and release notes to ensure your server meets the requirements of the new version and review the release notes for any critical changes or warnings.

Backup your files and database before starting an upgrade.

mysqldump -u concrete -p concrete > concrete_backup.sql
tar -czvf concrete_files_backup.tar.gz /var/www/html/concrete/public/{application/{config/generated_overrides,files},packages}/

Perform the Upgrade

Put your site in maintenance mode through the command line or through the dashboard when logged in as the superadmin. For example, using the command line:

cd /var/www/html/concrete
./concrete/bin/concrete5 c5:config set concrete.maintenance_mode true

Download and unzip the new version to the updates directory

wget https://www.concretecms.org/download_file/-/view/xxxxx/ -O new_concretecms.zip
unzip new_concretecms.zip  -d updates

Run the update command through the command line (preferred to avoid timeouts) or by visiting the site:

cd /var/www/html/concrete
./concrete/bin/concrete5 c5:update

Post-upgrade Steps

Check website functionality to ensure all features and pages are working as expected.

Disable maintenance mode to resume normal website functionality

./concrete/bin/concrete5 c5:config set concrete.maintenance_mode false

Long term

Adding custom blocks, themes, and features to Concrete can be done through the application/ or packages/ directories, not the concrete/ directory (for example, see Packaging a Theme documentation). In order to manage these customizations, some form of source control such as git is recommended. In addition to source control, deploy solutions such as CI/CD can be used to automate the update process.

Recent Tutorials
WebOps Tutorial on Running and Upgrading a Concrete CMS Website
May 2, 2024
By myq.

Describes how to deploy, manage, and upgrade a Concrete CMS website

Using the Concrete Migration Tool Addon
Apr 27, 2024

How to use the Concrete CMS Migration Tool

Create custom Site Health tasks
Apr 19, 2024
By myq.

This tutorial will guide you through the creation of a new Site Health task

Reusing the same Express entity in multiple associations
Apr 11, 2024
By myq.

How to create and manage multiple associations in Express

Express Form Styling
Apr 11, 2024
By myq.

Different ways to style Express forms

Setting addon/theme version compatibility in the marketplace
Jan 9, 2024

For developers worn out with setting the latest addon or theme version manually across too many core versions, here is a JavaScript bookmarklet to do it for you.

Improvements?

Let us know by posting here.