📜 ⬆️ ⬇️

Setting up a Cyclos cluster based on Jelastic Platform-as-Infrastructure

Cyclos is a banking online system with additional modules for e-commerce, communications, and many other functionalities in this field. With the help of Cyclos dynamic structure, you can easily create a specialized payment system by simply changing the settings.

Cyclos recently released a new fourth version of its product, and Jelastic provided an opportunity to install it in one click. This can be done via the Cyclos website (registration is required for this) or using the JPS widget in our documentation (you can also install Cyclos 3 from our Marketplace page).
jelastic and cyclos
You can also install Cyclos manually using the custom settings necessary for your needs. On the Jelastic Cyclos platform, you can run using servers such as Tomcat, Jetty and Glassfish. PostgreSQL is suitable for Cyclos 4 as a database (version 9.3 or higher). The minimum amount of memory required to run one Cyclos server is 500 MB (i.e., you need at least 4 cloudlets).

In this guide, we will show how to set up a highly reliable and scalable Cyclos application cluster with database replication and high availability using Jelastic cloud hosting.
cluster scheme
High availability helps avoid various problems (for example, with transactions) that may affect your users. Installing the application on multiple servers provides redundancy, i.e. if one of the servers fails, its users will be automatically redirected to another Tomcat cluster server. All sessions of the failed server will be available on the second server due to replication, so users will not notice any changes.
')
In addition, replication of the master and slave PostgreSQL databases improves the performance and fault tolerance of your environment.

Creating the Jelastic environment


First of all, you need to prepare the basis for our cluster with the application - an environment with all the necessary containers.

1. Register with Jelastic (if you have not done this before) or log in to your Jelastic account.

2. Click the Create Environment button and select:

Please note that the PostgreSQL database version must be at least 9.3.

create cyclos environment

Set resource limits for each container. Then enter a name for your environment, for example, cyclos , and click Create .
In just a minute, the environment will be created.

environment listed

Cyclos unfolding


Now everything is ready to deploy the Cyclos application.

1. To download the archive with the application, go to the Cyclos website and register (if you have not done so before).

download cyclos
register at cyclos site

2. Confirm the account creation with the received email.
Log in using your credentials and download the archive with the application.
Please note that you can also use the Jelastic one-click install button to automatically install Cyclos. It is recommended to install Cyclos manually to configure the cluster solution.

cyclos one-click install

3. Extract the files from the .zip archive that you just downloaded.

cyclos archive

4. Create a .WAR file from the contents of the web folder ( cyclos-4.0.1 / web / ).

Just pack the contents of this folder into another zip archive, for example, cyclos_4.zip , and change its name to cyclos_4.war (or to any other with the .war extension).

5. Upload the Cyclos war file to the Distribution Manager .

upload cyclos archive

6. Then deploy it to the environment you just created.

deploy cyclos application

Configure Database Replication


Now you can begin setting up database replication to protect your application from downtime or data loss.

PostgreSQL in an environment with Cyclos deployed will be used as the main database. For the subordinate base, you must create a separate environment.

Go to the Jelastic control panel and create an environment with PostgreSQL node that will be used as a subordinate database. Set the environment name (for example, cyclos-slave ) and click Create .

slave cyclos database

Setting the main database


1. In the environment with the main database (with the application deployed by Cyclos), click the Configuration button next to the PostgreSQL server.

2. Open the conf> postgresql.conf file. Change the following settings to enable streaming replication:

listen_address = '*' wal_level = hot_standby max_wal_senders = 10 

postgresql master db

4. Then open the pg_hba.conf configuration file, which is located in the same folder ( conf ).

5. Connect to the subordinate database by specifying the following parameters:

 host replication all {standby_ip_address}/32 trust 

Please note that after these settings, you need to add another blank line.

postgresql master-slave configuration

6. Restart the database server to apply the settings.

Setting a subordinate database


Go to the environment with the subordinate database in the list of environments.

1. Click the Configuration button next to the PostgreSQL subordinate database.

2. In the conf folder, create a new recovery.conf file with the following settings:

 standby_mode = 'on' primary_conninfo = 'host={master_ip_address} user=webadmin password={master_password}' 

Use the internal IP address of the main database to identify the host . The values ​​of the user and password parameters can be found in the email you received when creating the environment with the main PostgreSQL database.

slave recovery

3. Restart the database server for the changes to take effect.

After setting up both databases, go to the administration panel of the main database (as part of the cyclos environment) and create a new database:

create postgresql database

As a result, you will receive a new database, which will also be replicated to the subordinate.

master postgresql database

For more detailed information on how to test or replicate with a subordinate database worked, please refer to the PostgreSQL Replication document.

Cyclos Setup


Now you need to perform the last configuration steps of the Cyclos application and complete the complete cluster configuration, including High Availability.

1. Open the Jelastic control panel and click the Configuration button for Tomcat server.

configure tomcat

2. Navigate to the webapps / ROOT / WEB-INF / classes folder and create a cyclos.properties file.

3. Copy the contents of the cyclos-release.properties file in the class folder and paste it into the newly created cyclos.properties file.

4. In the open cyclos.properties file, specify the data of your PostgreSQL database:


 jdbc:postgresql://postgres-{env_name}.{hoster_domain}/{db_name} 


database credentials

Save your changes and restart Tomcat.

5. Finally, let's set up the cluster itself. Click the Change Environment Topology button next to the Cyclos Environment.

change environment topology

In the dialog that opens, turn on High Availability . Set the amount of resources for the automatically added NGINX balancer (it will process and distribute all requests in the cluster).

cyclos high availability

6. Click Open in browser and you can start working.

open cyclos

Please note that the first opening of the Cyclos application may take a few minutes, please be patient.

After opening, you need to go through several steps of the Cyclos Settings Wizard using the account information that you registered on the Cyclos website earlier.

cyclos credentials

That's all. Now you have your own highly reliable Cyclos cluster in the cloud. Such a cluster will provide high resiliency, and the scalability of the cloud ensures that the failure of one server does not overload the rest. In the comments below you can share your Cyclos clustering experience.

Source: https://habr.com/ru/post/233693/


All Articles