More and more services are on the move from on-premise solutions to become SaaS products. That applies to Content Management Systems like FirstSpirit, in particular because of its pre-generating hybrid CMS architecture which makes it perfect to be hosted on a cloud platform. In this article I would like to demonstrate an example architecture to run FirstSpirit serverless in the Cloud using Google’s Cloud Platform (GCP). We will cover the editing system itself as well as connected databases and even hosting.
Google Cloud Platform (GCP) is a collection of many different services covering the topics of Computing, BigData, Storage, AI and others. In the following I would like to give a short introduction to some of the services we would use in a concept to build a CMS architecture based on Google Cloud Platform services:
The heart of the architecture is what is called a Compute Engine. In simple terms we are talking about a virtual machine that is hosted by Google. We can set these up using a handful of different already configured Linux operating systems like Debian, RedHat, Ubuntu, CentOS etc. just to name a few. If you prefer Microsoft you could also opt for a Windows machine, however these come at a higher price point.
All of the VMs are billed based on their usage, which means you only pay exactly for the time the system is actually running which makes it perfect for an editing system like FirstSpirit. We only need to run this system, when editors are working on creating new content at the moment. Based on typical business hours we could potentially run this system for only 8-10 hours per day, dramatically reducing hosting and maintenance cost to a minimum.
This service provides different types of SQL databases with the click of a button. We will need a relational database for FirstSpirit to be able to properly work with the CMS’ internal data sources and table templates. Currently Google offers the most recent versions of MySQL and PostgreSQL. Google deals with everything related to uptime and providing these databases which saves us valuable time and money we can spend on different things instead of debugging a database. We must only create a database user and set permissions accordingly.
We use Firebase Hosting to deliver our static content we deploy from our CMS. Using this service we can configure our domains, offer additional Live functionality as well as control authentication on our website. Firebase assists in various ways as it makes hosting a lot easier for us, even dealing with security related tasks such as SSL encryption by default. Our task is to simply provide content from the CMS to the correct Firebase directory. For this, we use our own FirstSpirit Java module for Firebase Hosting.
Behind this name lies Google’s own messages middleware. Utilise this let different Google services and instances communicate with each other via messages. In this case we use Pub/Sub to automatically startup and shutdown our FirstSpirit VM instance based on a schedule.
The name is self-explanatory: Cloud Functions provides Functions-as-a-Service. Here we can develop and run our own functions in many different programming languages of our choice. There is a variety of triggers available to execute these functions, such as direct HTTP/HTTPS triggers or you could use the messages service Pub/Sub we mentioned before. We use Functions to startup and shutdown our FirstSpirit virtual machine, when advised to do so by Pub/Sub.
With Cloud Scheduler you can create UNIX cronjobs that execute certain tasks at the given time and date. It is the last piece of the puzzle in our example architecture to start and stop the FirstSpirit server at an exact time. Each time the schedule is active, it will trigger Pub/Sub, which will in turn run the assigned function.