Serverless FirstSpirit with Google Cloud

Published on 8 Apr 2019

FirstSpirit and Google Cloud? No problem! In this article I would like to introduce a short concept on how to host FirstSpirit in a cloud environment and which features of the Google Cloud Platform we can leverage to get started with a serverless CMS.

Rafael Lopes das Dores

Consulting and Development

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

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:

Google Compute Engine

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.

Google Cloud - SQL

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.

Google Firebase - Hosting

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.

FirstSpirit Google Cloud Platform
FirstSpirit embedded in the architecture of Google Cloud Platform

Google Cloud - Pub/Sub

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.

Google Cloud - Functions

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.

Google Cloud - Scheduler

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.

facebook icon twitter icon xing icon linkedin icon
© 2019 aboutcontent GmbH