Page tree
Skip to end of metadata
Go to start of metadata

Rationale

This is NOT Core split, this is instances split. This could also be considered as a headless instance without some under developing features.

Why micro public instance?

  • Because we are following a new agile world, smaller instances will have better performance, easier to manage, less conflicts, etc.
  • Because we don't need and don't want administration overhead (ui-framework and ui-admincentral) in our Public instances - we still want some administration involvements, not current overhead.
  • We would like to have micro-services Magnolia but the topic has so many constraints and risks, splitting core and analyzing current modules relationship by building micro public instances not only help us to clarify product services but also clarify current dependencies, simplify our architecture and defining future roadmap.

Why not micro author instance?

It would be useful in the future for a micro author instance when we successfully split author activities into different aspects such as content editor micro instance and administrator micro instance. Anyway at the moment we still need templating and rendering functions for preview functions and things like that from users point of view. So splitting or removing them doesn't help so much.

HOW we build it

In order to remove all UI Admin Central related stuffs, we need some patch and work around at the moment to fix / remove some 'form' and 'mail' related things. Sending mail and processing forms should be moved into separated support modules then we can get rid of this patch. Temporarily, sending email and form processing were 'patched' somehow in below modules:

magnolia-templating-kit-1.2.3-SNAPSHOT.jar

magnolia-templating-essentials-models-1.2.3-SNAPSHOT.jar

magnolia-templating-essentials-imaging-1.2.3-SNAPSHOT.jar

magnolia-module-observation-2.1.1-SNAPSHOT.jar

magnolia-module-javascript-models-1.1.2-SNAPSHOT.jar

Core group

By analyzing Magnolia Modules dependencies, we recognized that below core module group is mandatory for any magnolia instances:

  • core
  • webapp
  • magnolia-jaas
  • resource-loader
  • freemarker-support
  • configuration
  • observation

However below modules groups could server most of public instance services

REST group

Serving REST services, we excluded 'rest-content-delivery' from here and waiting for its upgrade to either splitting or cutting out UI related stuffs.

  • rest-client
  • rest-integration
  • rest-services
  • resteasy-integration

Publishing group

From public instances, we just listen and dispatch publish requests, we don't need 'publishing-sender' one.

  • publishing-core
  • publishing-receiver

Site and URI group

Support sites, multisites, URI resolving / rewrite, i18n.

  • site
  • virtual-uri
  • i18n

Imaging support group

  • imaging
  • imaging-support
  • imaging-compatibility

Resources group

  • resources
  • magnolia-resources-templating

DAM group

Digital asset management. This group of modules except dam-app support consuming of our assets besides our web-pages.

  • dam-core
  • dam-api
  • dam-compatibility
  • dam-jcr
  • dam-imaging
  • dam-tempating

Rendering and templating group

  • rendering
  • templating
  • templating-jsp
  • mtk
  • mte
  • mte-imaging
  • javascript-models

Form and email group

  • password-manager
  • form
  • mail

An overview of modules dependencies in our groups

Not listed all modules and core modules to simplified our view.



HOW it work

Custom bundle

If you build it properly you should have a clean instance with below modules to install in your installation screen:

Micro public instance modules
Magnolia Core Module  5.6.5 New 
Magnolia DAM Core  2.3.1 New 
Magnolia FreeMarker Support  5.6.5 New 
Magnolia DAM JCR-Provider  2.3.1 New 
Magnolia Imaging Support Module  3.4.0 New 
Magnolia Publishing Core  1.0.4 New 
Magnolia Resource Loader  5.6.5 New 
Magnolia REST Client Module  1.5.2 New 
Magnolia REST Integration  2.1.1 New 
Magnolia Configuration Framework  5.6.5 New 
Magnolia Internationalization Framework  5.6.5 New 
Magnolia Publishing Receiver  1.0.4 New 
Magnolia REST Services  2.1.1 New 
Magnolia Rendering Module  5.6.5 New 
Magnolia Virtual URI  5.6.5 New 
Magnolia Imaging Module  3.4.0 New 
Javascript Models Magnolia Module  1.1.2-SNAPSHOT New 
Magnolia Observation Module  2.1.0 New 
Magnolia RESTEasy client module  1.5.2 New 
Magnolia Templating Module  5.6.5 New 
Magnolia Imaging Module Compatibility  3.4.0 New 
Magnolia Resources Module  2.6.1 New 
Magnolia Site Module  1.2.2 New 
Magnolia DAM Imaging-Provider  2.3.1 New 
Magnolia DAM Templating  2.3.1 New 
Magnolia Templating Essentials Imaging Module  1.2.3-SNAPSHOT New 
Magnolia Templating Essentials Models Module  1.2.3-SNAPSHOT New 
Magnolia Templating Kit  1.2.3-SNAPSHOT New 
Magnolia Webapp Module  5.6.5 New 
Bootstraps the webapp upon first deployment.


Verify your build / bundle

Installation screen should be able to show up without any error occurs 

Custom login page

In order to have a proper login form without our ui-admincentral, we have to provide a custom login file in our webapp under src/main/resources/mgnl-resources/loginForm/login.html

Sample login file

Custom login for custom webapp
<!DOCTYPE HTML>

<html>
<head>
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta charset="utf-8" />
  <title>Magnolia 5</title>
  <meta name="description" content="" />
  <meta name="author" content="Magnolia International AG" />

  <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
  <meta name="apple-mobile-web-app-capable" content="yes" />
  <meta name="format-detection" content="telephone=no">

  <meta http-equiv="cache-control" content="no-cache"/>
  <meta http-equiv="pragma" content="no-cache"/>
  <meta name="ctxPath" content="${contextPath}"/>

  <link rel="stylesheet" type="text/css" media="screen" href="https://demo.magnolia-cms.com/.resources/defaultMagnoliaLoginForm/css/reset.css" />
  <link rel="stylesheet" type="text/css" media="screen" href="https://demo.magnolia-cms.com/.resources/defaultMagnoliaLoginForm/css/login.css" />
  <link rel="stylesheet" type="text/css" href="https://demo.magnolia-cms.com/.resources/defaultMagnoliaLoginForm/css/fonts.css" />

  <link rel="shortcut icon" type="image/ico" href="https://demo.magnolia-cms.com/.resources/defaultMagnoliaLoginForm/img/favicon.ico" />

</head>
<body>
<div id="content" style="top: 60px;">
  <div id="login" class="login-panel" style="display: block; opacity: 1; -webkit-transition: all 0s cubic-bezier(0.25, 0.1, 0.25, 1);" >
      <div class="header">
        <div class="tag-line">
        </div>
      </div>
          
      <form id="loginForm" action="" method="post" class="mgnl-form">
          <div id="login-divet" class="divet"></div>
          <div style="height:28px;"></div>
          <label for="login-username">user name</label>
          <input type="text" value="" id="login-username" name="mgnlUserId" tabindex="1"[#if loginError] class ="error"[/#if] autofocus autocorrect="off" autocapitalize="off">
          <br class="float-clear"/>
          <label for="login-password">password</label>
          <input type="password" id="login-password" value="" name="mgnlUserPSWD" tabindex="2"[#if loginError] class ="error"[/#if]><br class="float-clear"/>
          <div>
            <button class="btn-submit" id="login-button" style="float:right;" tabindex="3">login</button>
          </div>
          <br class="float-clear" />
      </form>
      [#if loginError]
      <div id="error-divet" class="divet"></div>
      <div id="error-message">
        <div class="icon-error"><img src="https://demo.magnolia-cms.com/.resources/defaultMagnoliaLoginForm/img/icon-error-white.png"/></div>
        <span>${errorString!}</span>
      </div>
      [/#if]


  </div>
  <div id="footer">
        [#if serviceContact?exists]
        ${serviceContact?html}
        <br/>
        [/#if]
        Magnolia is a registered trademark of Magnolia International Ltd.
        <br/>
         &copy; Copyright 2003-${.now?string['yyyy']}
        <a href="http://www.magnolia-cms.com" id="externallink" target="_blank">Magnolia International Ltd.</a>
      </div>
  <script type="text/javascript">
  document.ontouchmove = function(e){ e.preventDefault(); }
  var username = document.getElementById('login-username')
  var password = document.getElementById('login-password')
  function removeErrorClass() { this.removeAttribute('class')}
  //username.onfocus = function(e){ e.preventDefault(); }
  username.onblur = removeErrorClass
  password.onblur = removeErrorClass
  </script>
</div>
</body>
</html>

Doing administration stuffs

Since we totally removed all UI Admin Central related stuffs, now we just need to use our REST node endpoint API to read / write our configuration.

Get your installed modules

(using my localhost:8680/optimim-webapp host, port and context path)

http://localhost:8680/optimum-webapp/.rest/nodes/v1/config/modules/?depth=1

Set your config/server/defaultBaseUrl

Calling below 'curl' command (note that we have username and password parameter under '--user' option:

curl http://localhost:8680/optimum-webapp/.rest/nodes/v1/config/server \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -X POST \
  -v \
  --user superuser:superuser \
  --data \
'{
  "properties": [
    {
      "name": "defaultBaseUrl",
      "type": "String",
      "values": [ "http://localhost:8680/optimum-webapp/" ]
    }
  ]
}'

Similarly we need to

Set config/server/admin property to false

curl http://localhost:8680/optimum-webapp/.rest/nodes/v1/config/server \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -X POST \
  -v \
  --user superuser:superuser \
  --data \
'{
  "properties": [
    {
      "name": "admin",
      "type": "String",
      "values": ["false"]
    }
  ]
}'


Posting your config/server/activation/publicKey

(using your author publication key to publish your content from author to public instance - please replace below YOUR_NEW_GENERATED_KEY using your author provided one)

curl http://localhost:8680/optimum-webapp/.rest/nodes/v1/config/server/activation \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -X POST \
  -v \
  --user superuser:superuser \
  --data \
'{
  "properties": [
    {
      "name": "publicKey",
      "type": "String",
      "values": ["YOUR_NEW_GENERATED_KEY"]
    }
  ]
}'


Verification step

Create a new page, publish it to your micro public instance, wait a bit, then open your public page to verify its rendition.

Important notes

This is a referenced implementation but not a production grade supported one. For long time support, let's wait for more information from Magnolia CMS International Ltd.


  • No labels