Over a million developers have joined DZone.

Running Cyclos Cluster on Jelastic Platform-as-Infrastructure

· Cloud Zone

Build fast, scale big with MongoDB Atlas, a hosted service for the leading NoSQL database on AWS. Try it now! Brought to you in partnership with MongoDB.

Cyclos is a complete on-line banking system with additional modules such as e-commerce and communication tools. With the dynamic structure of Cyclos, you can ‘build’ a dedicated payment system from scratch, by simply changing the configuration.

Recently, Cyclos released a new fourth version and Jelastic enabled the ability to install it, in just one click. This can be done via the Cyclos site (you need to register first) or via our JPS widget as seen in our Cyclos 4 document.

In Jelastic, you can run Cyclos on Tomcat, Jetty and Glassfish. The database for Cyclos 4 is the open source database PostgreSQL (not less than 9.3). The minimal memory space requirement to run a single Cyclos instance is 500 Mb (so you need to use at least 4 cloudlets).

In this tutorial we’ll show you how to configure a highly reliable and scalable Cyclos cluster with master-slave database replication – and High Availability enabled within Jelastic’s Cloud hosting.scheme_new_07

The High Availability helps to prevent failed transactions and other issues that can influence your users. Extending the application across a number of the servers provides redundancy. The redundancy ensures that if one of the servers fail, the users from that node will be automatically switched to the other instance of this Tomcat cluster. Thanks to the replication, the other instance already has all the sessions of the failed node, so end-users will never notice any changes.

In addition, the PostgreSQL database master-slave replication improves the performance and the fail-over capabilities of your environment.

A. Jelastic Environment Creation

Firstly, we need to prepare a basis for our application cluster – an environment with all of the required containers.

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

2. Click Create environment and select:

  • Tomcat 7 as your application server
  • PostgreSQL 9.3 as the database you want to use

Note: that you need to use a version of PostgreSQL not less than 9.3

cyclos environment

Next, enter your environment name, for example, cyclos, and click Create.

It will take just a minute for your environment to be created.

environment listed

B. Cyclos Deployment

Now, we are ready to deploy a Cyclos application.

1. To download the Cyclos package, navigate to the Cyclos web site and register if you haven’t done this before.

download button

register at cyclos

2. Confirm your account creation via the email received.

Sign in with your credentials and download the installation package.

Note: that here you can also use Jelastic one-click install button in order to get Cyclos automatically installed. It is recommended to install Cyclos manually if you want to set a clustered solution.


3. Extract the files from .zip package you have just downloaded.


4. Create a .WAR file from web folder content (cyclos-4.0.1/web/).

Just put the content of the web folder to another zip archive file, for example cyclos_4.zip, and rename it to cyclos_4.war or any other name with the .war extension.

5. Upload your Cyclos war package to the Deployment manager.

upload war file

5. Once the package is in Jelastic, deploy it to the environment you have just created.

deploy cyclos

C. Configure Database Replication

When your Cyclos application is deployed, you can proceed to the database settings. So let’s configure PostgreSQL master-slave replication in order to protect your application from downtime or data loss.

PostgreSQL in your environment with Cyclos deployed, will be used as the master database. For a slave database you need to create a separate environment.

Navigate to the Jelastic dashboard and create an environment with PostgreSQL node, which is going to be used as a slave database. Name your environment (e.g. cyclos-slave) and click Create.

postgresql environment

Master DB Configs

1. Find the environment with the master database in your environment list (with deployed Cyclos in our case). Click the Config button next to the PostgreSQL node.

3. Open conf > postgresql.conf file. Change the following settings for enabling streaming replication:

listen_address = ‘*’
wal_level = hot_standby
max_wal_senders = 10


4. Open the pg_hba.conf configuration file, which is located in the same conf folder.

5. Permit the standby database cluster connection by stating the following parameters:

host replication all {standby_ip_address}/32 trust

Note: that you need to add one additional line after the added settings.


6. Restart the database server to apply the settings.

Slave DB Configs

Find the environment with the standby database in your environment list.

1. Click Config icon next to the standby PostgreSQL database.

2. In the conf folder create a recovery.conf file with the following parameters:

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

User and password values should be taken from the email that you’ve received while creating environment with master PostgreSQL database.


3. Restart the database server to apply the settings.

After both of your databases are configured, log in to the admin panel of the master database (the one in the Cyclos environment) and create a new database:

  • enter the DB name (e.g. cyclos4)
  • choose template0 and UTF8 encoding from the drop-down lists
  • click Create


As a result, you’ll get a newly created database which will be replicated to the slave base also.


Navigate to the PostgreSQL Replication document to get more details on how to check if the database is replicated to the standby db.

D. Configure Cyclos

Now, we need to make the final configurations of our Cyclos application and then complete full clustering settings by switching on High Availability.

  1. Open the Jelastic dashboard and click Config button for Tomcat.

tomcat config

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

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

4. In the opened cyclos.properties file, specify your master PostgreSQL data:

  • in cyclos.datasource.jdbcUrl parameter state the host together with the name of database created while DB configuration:

  • database credentials you’ve received via email


Save the applied changes and Restart Tomcat.

3. Finally, let’s configure the cluster itself. Click on the Change environment topology button next to your Cyclos environment.

change topology

In the opened wizard enable High Availability. Set up the amount of resources for an automatically added NGINX-balancer node (it will handle and distribute all the requests in front of your cluster).


4. Click Open in browser and proceed to work.


Note: that the first Cyclos opening can take a few minutes, please be patient.

After opening, you need to go through several steps of the Cyclos configuration wizard using credentials you’ve registered at the Cyclos site previously.

cyclos credentials

That’s all! Now, you have your own highly-reliable Cyclos cluster in the cloud. This cluster ensures that no server is a single point of failure. And, the cloud ensures that one server failure doesn’t overload the rest of the servers. Feel free to leave a comment below about your Cyclos clustering experience and subscribe to our blog, to see more clustered solutions.

Now it's easier than ever to get started with MongoDB, the database that allows startups and enterprises alike to rapidly build planet-scale apps. Introducing MongoDB Atlas, the official hosted service for the database on AWS. Try it now! Brought to you in partnership with MongoDB.


Published at DZone with permission of Tetiana Fydorenchyk, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}