Configure Cyclos Cluster Based on Jelastic Platform-as-Infrastructure

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

    Recently, Cyclos released a new fourth version of their product, and Jelastic provided the opportunity to install it in one click. This can be done through 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 custom settings necessary for your needs. On the Jelastic platform, Cyclos can be launched using servers such as Tomcat, Jetty, and Glassfish. PostgreSQL (at least version 9.3) is suitable as a database for Cyclos 4. The minimum required memory to run one Cyclos server is 500 MB (i.e. you will need at least 4 cloudlets).

    In this tutorial, we’ll show how to set up a highly reliable and scalable cluster of Cyclos applications with database replication and high availability using Jelastic cloud hosting.
    cluster scheme
    High availabilityhelps to avoid various problems (for example, transactions) that can 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 server of the Tomcat cluster. 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 main and subordinate PostgreSQL databases improves the performance and fault tolerance of your environment.

    Creating a Jelastic Environment


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

    1. Sign up for Jelastic (if you haven’t done this before) or log in to your Jelastic account.

    2. Click the Create Environment button and select:
    • Tomcat 7 as an application server
    • PostgreSQL 9.3 as a database

    Please note that the version of PostgreSQL database 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, an environment will be created.

    environment listed

    Deploy Cyclos


    Now you are 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 previously).

    download cyclos
    register at cyclos site

    2. Confirm the creation of an account using the email you received.
    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. To configure a clustered solution, it is recommended to install Cyclos manually.

    cyclos one-click install

    3. Extract the files from the .zip archive 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 any other with the extension .war ).

    5. Download the Cyclos war file to the distribution manager .

    upload cyclos archive

    6. Then deploy it to the newly created environment.

    deploy cyclos application

    Setting up database replication


    Now you can start configuring database replication to protect your application from downtime or data loss.

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

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

    slave cyclos database

    Setting up the main database


    1. In the environment with the main database (with the Cyclos application deployed), click the Configuration button near 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 configuration file pg_hba.conf , which is located in the same folder ( conf ).

    5. Connect to the slave 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 empty line.

    postgresql master-slave configuration

    6. Restart the database server to apply the settings.

    Setting up a subordinate database


    Browse 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 base to indicate host . The values ​​of the user and password parameters can be found in the email that you received when creating the environment with the main PostgreSQL database.

    slave recovery

    3. Restart the database server for the change 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:
    • enter a name for the database (e.g. cyclos4 )
    • select template0 template and UTF8 encoding in drop-down lists
    • click Create

    create postgresql database

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

    master postgresql database

    For more information on how to verify or replication with a sub-database worked, see PostgreSQL Replication .

    Configure Cyclos


    Now you need to follow the last steps of the Cyclos application configuration and complete the full cluster configuration by enabling High Availability.

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

    configure tomcat

    2. Go to the webapps / ROOT / WEB-INF / classes folder and create the 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 for your PostgreSQL database:

    • in the cyclos.datasource.jdbcUrl parameter , specify the host of the main database with the name of the database created during the database setup:

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

    • database credentials received in email

    database credentials

    Save your changes and Restart Tomcat.

    5. Finally, let's configure the cluster itself. Click the Change environment topology button next to the Cyclos environment.

    change environment topology

    In the dialog that opens, enable 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 a browser and you can get started.

    open cyclos

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

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

    cyclos credentials

    That's all. You now have your own highly reliable Cyclos cluster in the cloud. Such a cluster will provide high fault tolerance, and the scalability of the cloud ensures that failure of one server does not lead to overloading the rest. In the comments below, you can share your experience with Cyclos clustering.

    Also popular now: