Simple and Complex Solutions For Hosting PHP Apps in the Jelastic Cloud: Get Your Concrete5 Cluster
The PHP programming language is widely used in the development world and is actively increasing the number of its users. The reasons vary: massive amounts of documentation, huge community for support, availability on various hosts and platforms, lots of existing apps, optimizers and accelerators for performance and much more. One of the most important reasons to choose PHP, is a low barrier to entry and Jelastic Cloud makes it even lower.
With our platform you can easily install a variety of PHP applications in just one click, or build and deploy your own custom apps, or just follow our step-by-step instruction in order to install some existing PHP applications to the Jelastic Cloud. It doesn’t matter which method you choose, Jelastic makes it easy.
Recently we’ve published a set of new documents on different PHP applications and installation in the Jelastic Cloud. You can find them by the following the links:
In this article, we are going to have a closer look at the Concrete5 application installation. We’ll describe not just a simple way to deploy it (this can be found in the documentation), but a way to configure a clustered solution for running your Concrete5 app.
Concrete5 is a free and open source content management system (CMS) designed for easy usage, so even newbies with a minimal set of technical skills can work with it. You can edit the content of your site without leaving the page, instead of using an administrative interface or web editors.
To enhance the availability and reliability of your service, we are going to show you how to set up a clustered solution with 2 Apache servers, 2 replicated MySQL databases, a Memcached node and NGINX load balancer.
In this case, Memcached is used to backup the Apache server sessions. So if one server fails, the second will take the sessions from Memcached and perform the further serving. NGINX is going to balance the traffic inside the cluster. And, replicated MySQL master and slave databases increase the performance, data security and the fail-over capabilities of your environment.
Create a PHP Environment and Deploy Concrete5
Firstly, you need to create a new environment with one Apache server and one MySQL database in order to deploy the Concrete5 application to it.
1. Login to the Jelastic dashboard and click the Create environment button at the top panel. You will see the topology wizard opened.
2. Navigate to its PHP tab and select the following nodes:
- Apache application server
- MySQL database
- Memcached node
Also, choose the PHP 5.3 version within the appropriate drop-down list.
3. Define the amount of cloudlets for the chosen nodes, specify the environment name (e.g. concrete) and click Create. In a minute or so your environment will appear at the dashboard.
4. Then navigate to the official Concrete5 web-site and download its Latest Stable Version.
5. Switch back to the Jelastic Cloud dashboard and click the Upload button at the Deployment manager panel. In the opened frame, choose the received .zip archive for uploading.
6. Once the package is in Jelastic, click the Deploy to button next to it and choose the environment you have just created. In the opened window, specify the context Concrete5 will be deployed to (or just leave it blank) and click the Deploy button.
Congrats! You have deployed your application. Let’s move to the next step.
Configure Session Storage
Now, let’s set up the sessions clustering in order to provide the high availability for our cluster.
1. Click the Config button for Apache node. In the opened Configuration manager, navigate to the /etc/php.ini file and activate the PHP Memcached module by adding the following line:
2. Find Session block in the same php.ini file and enable sessions support by editing the next two lines:
session.save_handler = memcached
session.save_path = “< server >:11211”
Note: < server >is the Memcached IP or URL. You can find it by clicking the Info button next to the Memcached node in your environment.
3. Save the changes you’ve performed and restart Apache server in order to apply the new settings.
That’s it! For now, if one application server instance in a cluster fails, a user’s session will be automatically picked up and served by another Apache instance.
The next step is to configure the master-slave database replication, aimed to ensure the protection of the data in your Concrete5 cluster.
1. In order to set up the MySQL cluster, you need to create one more environment with just a single MySQL node, which will be used as a slave database.
The role of the master DB will belong to the MySQL server, in the environment with the Concrete5 application deployed.
To configure the replication between these databases, follow the detailed instructions in B-C sections of the MySQL/MariaDB Master-Slave Replication document.
2. Once you’ve adjusted the database clustering, navigate to the phpMyAdmin panel of the master DB and create a new concrete database.
3. You can make sure that database replication is configured properly by navigating to the admin panel of your slave MySQL server. You’ll see that the newly created and already replicated concrete DB is added to the list of databases in the appropriate tab.
Concrete5 CMS Installation
Now it is time to complete the installation of our Concrete5 CMS. Select Open in browser button next to the environment with the application deployed.
You’ll be shown an installation wizard in a new tab. The next steps are rather simple. Therefore, let’s pay some attention to defining the main settings.
Fill in the following fields:
- Name Your Site: insert the desired name of your site
- Email Address: type the email of administrator user
- Password: specify the password for administrator user
- Server: paste the link to the master database without http://
- MySQL Username: enter login you’ve received in the email with credentials to master DB during environment creation (root by default)
- MySQL Password: type the password from the same email
- Database Name: specify the name of the database you’ve created just after configuring the DB replication (concrete in our case)
Then, choose if your site will contain the sample of content, or if it will be blank and complete the installation process.
Finally, let’s configure the cluster itself.
1. Click the Change environment topology button for the environment with the CMS deployed.
2. Increase the number of Apache application servers by clicking the corresponding button. Note: that an NGINX-balancer node will be automatically added to your environment. Click Apply.
In such a way, all the data between application server instances will be synchronized and there is no need to perform the double installation and configuration.
3. Now you can open your Concrete5 CMS and start working with it.
As a result, you get your highly available and reliable Concrete5 application up and running. Using this instruction as an example, you can easily configure the required clustered solution for any other PHP application deployed to the Jelastic Cloud. Try it yourself and get all the benefits of PHP hosting in Jelastic. Stay tuned to get even more useful instructions on your application’s settings!