TYPO3 Enterprise CMS Cluster

TYPO3 Enterprise CMS Cluster

TYPO3 is a widely used CMS for websites of all sizes.

By setting up a high-availability cluster with two Apache application servers, an NGINX balancer, a Memcached instance, and two replicated MySQL databases, you can make your TYPO3 site extremely flexible, accessible, stable, and high-performing.

TYPO3 Enterprise CMS Cluster

The Memcached node stores Apache server sessions. These sessions are backed up, so if one Apache server fails, the other can retrieve sessions from Memcached to continue serving sessions.

The NGINX balancer distributes traffic within the cluster. Additionally, MySQL database master-slave replication increases performance, data security, and fail-over capabilities.

Let’s now walk through the steps to configure your highly-available clustered TYPO3 application.

Deploying TYPO3 Application

First, let’s set up the environment and deploy the TYPO3 application.

Step 1. Log in to the AccuWeb.Cloud dashboard and click on “Create environment.”

New Environment

Step 2. Choose Apache for the application server, MySQL for the database, and Memcached. Set your cloudlet limits and give your environment a name (e.g., typo3-cluster). Click “Create.”

Environment Topology

Step 3. Wait briefly for your environment to be created.

Environment Created

Step 4. Visit the official TYPO3 website to download the latest version as a zip package.

Official Doc

Step 5. Use the Deployment Manager to upload the downloaded package.

Upload Local File

Step 6. Once the package is uploaded, deploy it to the environment you just created.

Deploy Environment

Note: To ensure your TYPO3 application runs smoothly, disable the zend_extension. Navigate to the etc -> php.ini file and comment out the following line:

#zend_extension=/usr/lib64/php/modules/opcache.so

Disable zend_Extension

Set Up PHP Sessions Clustering

You can ensure your PHP application stays available by setting up PHP sessions clustering in the cloud. We’ll use Memcached to manage failover for application servers.

Step 1. Click on the Config button next to the Apache node. In the Config Manager, go to etc -> php.ini and enable the Memcached module by adding this line:


extension=memcached.so

Enable Memcached Module

Step 2. To enable session support, edit the Session section in php.ini by adding these lines:


session.save_handler = memcached
session.save_path = "<memcached_server_ip>:11211"

Edit Session Section

Note: Replace <memcached_server_ip> with the actual IP address of your Memcached server. You can find it by clicking the arrow button next to your environment’s Node ID under Cache.

Ip Address

Step 3. Save your changes and restart the Apache server to apply them.

Restart Node

Setting Up Database Replication

Let’s configure MySQL master-slave replication to protect your application from downtime or data loss.

MySQL in your TYPO3 environment will act as the master database. For the slave database, you’ll need to create a separate environment.

Go to the AccuWeb.Cloud dashboard and create a new environment with a MySQL node designated as the slave database. Name this environment (e.g., slave-db) and click Create.

MySQL Environment

Now, let’s configure each database:

Master Database

In your TYPO3 environment (e.g., typo-cluster), MySQL serves as the master database.

Step 1. Click on the Config button for your master database.

Config File

Step 2. Navigate to etc -> my.cnf file and uncomment and set the following properties:


server-id = 1
log-bin = mysql-bin
binlog-format=mixed

We use binlog-format=mixed to allow replication of operations involving foreign keys.

Allow Replication

Note: Do not use binlog_format=statement to avoid errors later.

Step 3. Save the changes and restart MySQL to apply the new configuration.

Restart Node

Step 4. Click “Open in Browser” for the master MySQL and log in using the credentials provided via email when creating the environment.

Open in Browser

Step 5. Go to the Replication tab and click “Add replica replication user.”

Add replica replication user

Step 6. Provide a name and password for your slave replication user and click “Go.”

User Credentials

Your slave user is now successfully created.

Added New User

Setting Up Slave Database

Now, let’s connect the master database with the slave MySQL.

Step 1. Click the Config button for your slave database.

Config File

Step 2. Navigate to the my.cnf file and add these lines:

server-id = 2
slave-skip-errors = all

Allow to Skip Errors

We allow the slave database to skip all errors from the master (slave-skip-errors = all) to ensure continuous operation even if errors occur on the master side. This is crucial for production environments where minor errors shouldn’t halt operations.

Note: Skipping errors is not recommended during the development stages to identify and fix bugs. However, for production, where code is tested, minor errors might occur but should not disrupt replication.

Step 3. Save the changes and restart your slave database server to apply the new settings.

Save and Restart

Step 4. Click “Open in Browser” for the slave-db MySQL and log in using the credentials provided via email when creating the environment.

Open in Browser

Step 5. Go to the Replication tab and click “Configure” for Slave replication.

Configure Replication

Step 6. Configure your master server (enter the name, password, and host of your slave replication user). After then click on the Go button.

Configure Master Slave

Step 7. If you get an error while setting up the Replica in phpMyAdmin, you need to enable $cfg[‘AllowArbitraryServer’].

Error in Replica

Step 8. Go to the /etc/phpMyAdmin/ directory and add the following line to the config.inc.php file:


$cfg['AllowArbitraryServer'] = true;

Config.inc.php File

Now your master server is configured.

Configured Master server

Step 7. Click on Control replica -> Full start for the slave server to activate Slave SQL and Slave IO threads.

Full Start

Step 8. Check the slave status table to ensure everything is working correctly.

Slave Status

Your replication is now set up, and all data is synchronized between the master and slave databases.

Installing TYPO3

Now let’s finish installing TYPO3.

Step 1. Go to the AccuWeb.Cloud dashboard and click “Open in browser” next to your TYPO3 environment. This will start the installation. Click “Continue.”

Open in Browser

Step 2. To start the installation, create an empty file named FIRST_INSTALL in the document root of your web server.

Installing TYPO3 CMS

For this example, using Apache as the web server, the document root is /var/www/webroot/ROOT/. Note that the file name is case-sensitive and will be deleted after the installation process is complete.

Step 3. Click on the Settings icon and select “New File” to create an empty file. Name this file FIRST_INSTALL as mentioned in Step 2 and press enter.

Create New File

Step 4. The installation wizard will check the web server settings, PHP, and PHP extensions, identifying any issues that may prevent TYPO3 from running correctly. Any detected problems will be listed below.

Detected Problems

Step 5. To fix the errors, enable the PHP extensions gd and intl in the php.ini file. Then, increase the value of max_input_vars from 1000 to 1500.


Enable extension gd in php.ini file

Enable Extension


Enable extension intl in php.ini file

Enable Extension intl in php.ini FIle

Increase the value of max_input_vars from 1000 to 1500 in the php.ini file.

Increse

Then, restart the Apache server by clicking on the Restart Nodes.

Restart Node

Step 6. Once these changes are made, click on “Scan environment again” to recheck the web server settings.

Scan environment again

Step 7. If no errors are detected, you will see the message “No problem detected, continue with installation.” Click on it to proceed further.

Continue with Installing

Step 2. In the “Connect to your database host” window:

Connect to your database host

  • Select the MySQL/MySQLi connection. Here, we have selected [MySQLI] Manually configured MySQL TCP/IP connection as an example.
  • Enter the Username and Password you received via email when creating the environment.
  • Put the database server address in the Host field.

Click “Continue.”

Step 3. At the “Select database” step, create a new database by entering a name (e.g., typo3_db) for your TYPO3 database. Click “Continue.”

Note: Due to the database replication setup earlier, this database will automatically be available on both the master and slave MySQL servers.

Select a Database

Step 4. In the “Create Administrative User & Specify Site Name” window, enter your username, password, email address, and site name in the respective fields, then click the “Continue” button.

Administrative User

Step 5. In the “Installation Complete” window, choose a template for your website. If you want a simple starting page, select “Create empty starting page.”

If you prefer a pre-configured site template, choose “Yes, download the list of distributions.” Alternatively, you can select “Take me straight to the backend” if you want to create a custom page.

After making your choice, click the “Open the TYPO3 Backend” button to complete the installation.

TYPO3 Backend Installation

Step 6. Log in to your TYPO3 website with the credentials you set during the installation.

Log in Credentials

Step 7. You have successfully logged into the TYPO3 website.

Log in Successful

Congratulations! TYPO3 has been successfully installed.

Setting Up Cluster Configuration

Once TYPO3 installation is finished, you can start configuring a highly-available cluster.

Step 1. Go to the platform dashboard and click “Change environment topology” next to your TYPO3 app environment.

Change Environment Topology

Step 2. Add another Apache application server by clicking the “+” button (shown in the image). The NGINX balancer will be added automatically. Click “Apply.”

Add Another Server

We add the second application server after installation to synchronize all data between the Apache nodes and avoid duplicating installation and configuration efforts.

You can also set up file synchronization between servers in your cluster using the File Sync instructions.

Step 3. Click “Open in Browser” to begin using your TYPO3 application.

Open in Browser

Now, you have a highly reliable and scalable clustered environment with TYPO3.

Configured TYPO3 Cluster