Enonic CMS in the cloud

Posted by

    cloud

    "Cloud" has become a very interesting word in the IT-business lately, but what does cloud really mean, and how can you use it to host your Enonic CMS installations?

    Cloud computing is basically hardware and software delivered as a service instead of a product. Instead of having to download and install Mozilla Thunderbird and set up your email account which is the product way of getting email, you could just sign up for Gmail and you have email directly in your browser. There are also a few key features that people relate to cloud computing;

    • Infinite resources
    • No commitment
    • Pay only for what you use

    Cloud services can be separated into three different types;

    • IaaS - Infrastructure as a Service
    • PaaS - Platform as a Service
    • SaaS - Software as a Service

    Enonic is currently not provided as a PaaS or SaaS service, but we are going to look into how we can set it up in the cloud using a IaaS service, Amazon AWS. 

    Amazon AWS is basically a collective term for many different cloud services which Amazon provides. The ones that are relevant when setting up an Enonic installation are;

    Elastic Compute Cloud (EC2)

    EC2 allows you to create virtual server instances from an image. An image is more or less a copy of a disk with preinstalled software. The software can be as little as a plain OS, or a fully functional webserver with reverse proxy, application server and a database. When creating an instance, images can either be selected from a list provided by Amazon which mostly contains different operating systems (Suse, Ubuntu, Windows ++), chosen among a list of images made public by other Amazon AWS users, or you can select an image you created yourself which is stored privately for you. EC2 instances can be launched with different hardware depending on your needs; 

    • Micro
    • Standard
    • High Memory
    • High CPU

    Elastic Block Store (EBS)

    Elastic Block Store is used as a storage for EC2. EBS allows you to create volumes from 1 GB to 1 TB and attach them to an EC2 instance. You can attach multiple EBS volumes to a single EC2 instance. It is also possible to demount them an attach them to another EC2 instance, which can be useful for recovering data if your instance crashes. 

    Relational Database Service (RDS)

    RDS gives you the possibility to launch a dedicated MySQL database server. Under the hood it's similar to an EC2 instance with MySQL preinstalled, but it has some other nice useful features such as automatic backups and software upgrades, easy scaling and automatic host replacement on hardware failure.

     

    Enough talk, now how do we start this cloud?! 

    To get started you will need an Amazon AWS account. You can sign up for this at http://aws.amazon.com once sign up is completed, you can follow this video guide on how to start a new instance.

    When your instance is up and running, you can use this guide to install all the necessary software. You now have a Enonic CMS installation running in the cloud! 

    More possibilities

    This is only one of the many possibilities you have using Amazon AWS to host Enonic CMS - one server containing database and application server. If you are expecting lots of traffic, one server (even though you chose the expensive one with lots of memory) isn't going to be enough. For a bigger site, you might want to consider having a dedicated database using RDS, and maybe 2 application servers aswell. Doing this is simple, the application servers can be created in a similar way as the server we created just now, only without installing MySQL, and instead setting it up to use an RDS instance as a database. Once you created the first server, just click the "Make Image" and after a short wait, you can start your second server from that image - no additional configuration needed. Now you have 2 instances (or more if you choose to) with 2 different DNS and you might think that you will need to setup some sort of loadbalancer. Fortunatly AWS has a built in loadbalancer with a one-click setup just add the instances and press start. In a few minutes, you can create a large cluster.

    Even more possibilities

    If you feel that the cluster is costing alot, and you only have traffic on certain times of the day, or certain days a month you can also set up autoscaling. Autoscaling allows you to create rules for a group of servers. For instance we can call one group "enonic application server", then give rules that this group should never contain less than 2 servers, and whenever the CPU load is above 80% it should add another server to the group. Setting up this type of autoscaling, allows amazon to add additional identical servers which are automatically connected to the database and loadbalancer whenever one or more of the requirements are met.

    Comments