Creating and deploying custom cloud bundles

If you have decided to use the custom cloud bundle variant, your site is hosted in Magnolia Cloud and you, or your cloud partner, must create and deploy the custom bundle.

To successfully deploy custom bundles to Magnolia Cloud, certain best practices must be followed when creating your project and when deploying it the first time or continuously thereafter.

Creating your custom bundle

Magnolia provides a cloud-specific option in the Magnolia Maven Archetype to bootstrap a new project.

You receive your subscription-code and access keys during the Magnolia Cloud onboarding process.

The magnolia-cloud-project-archetype is supported with version 1.3+ of the Magnolia Maven Archetype.

Usage

  1. Run the following maven command:

    mvn archetype:generate -Dfilter=info.magnolia.maven.archetypes:magnolia
  2. Choose the magnolia-cloud-project-archetype option.

    ...
    6: https://nexus.magnolia-cms.com/content/repositories/magnolia.public.snapshots -> info.magnolia.maven.archetypes:magnolia-cloud-project-archetype
    
    Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 6
  3. Define the properties for the project.

    Define value for property 'groupId': : com.mycompany.project (1)
    Define value for property 'artifactId': : web-project-xyz (2)
    Define value for property 'version': 1.0-SNAPSHOT: : (3)
    Define value for property 'package': com.mycompany.project: : (4)
    Define value for property 'cloud-subscription-code': : mycompany-project (5)
    Define value for property 'magnolia-bundle-version': : 6.2.1 (6)
    Define value for property 'project-name': web-project-xyz: : (7)
    Confirm properties configuration:
    groupId: com.mycompany.project
    artifactId: web-project-xyz
    version: 1.0-SNAPSHOT
    package: com.mycompany.project
    cloud-subscription-code: mycompany-project
    magnolia-bundle-version: 6.2.1
    project-name: web-project-xyz
     Y : : Y
    
    [INFO] project created from Archetype in dir: /Users/user/dev/web-project-xyz
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 02:18 min
    [INFO] Finished at: 2020-04-23T13:12:46+02:00
    [INFO] ------------------------------------------------------------------------
Item Property Notes

1

groupId

Typically, this reflects the name or domain of your organization.

2

artifactId

Defines the project-specific identifier.

3

version

Specifies the version. When creating a new project, use the value suggested by Maven.

4

package

Package name for Java classes reflecting both your organization and the specific project.

This is typically the same as groupId.

5

cloud-subscription-code

Enter your cloud subscription code.

This is given to your during onboarding.

6

magnolia-bundle-version

Specify the version of Magnolia on which your bundle is built.

7

project-name

A human-readable version of the `artifactId`, Title case and spaces are allowed.

Further instructions and best practice information are provided in your project’s README.md.

Project Structure

The Magnolia Maven Archetype generates a best-practice project skeleton. Two default profiles are generated: dev and shared. These profiles have their own magnolia.properties files.

Structure
my-mgnl-cloud-webapp/
├── pom.xml
└── src
    └── main
        └── webapp
            └── WEB-INF
                └── config
                    └── dev                         (1)
                    │ └── README.md
                    │ └── magnolia.properties
                    └── shared                      (2)
                        └── README.md
                        └── magnolia.properties
Profile Notes

1 MAGNOLIA_PROFILE = dev

During packaging, the dev profile is excluded.

You can add local developer credentials to the dev profile to be used instead of the typical Magnolia superuser/superuser, which is disabled in the cloud.

2 MAGNOLIA_PROFILE = shared

During packaging, the shared profile is included.

In the shared profile, you can create specific .properties files for each cloud environment. This can be used, for example, to test the integration of a third-party tool in the UAT environment without affecting your Live environment.
Example 1. Shared properties

Format: magnolia_${env/INSTANCE_TYPE}_${env/CLOUD_ENVIRONMENT}.properties

Examples
  • Integration author: magnolia_author_integration.properties

  • Integration public: magnolia_public_integration.properties

  • UAT public: magnolia_public_uat.properties

  • Live author: magnolia_author_live.properties

If you created a custom bundle before Magnolia 6.2.1 with .properties file changes, please check your customizations carefully and adhere to the structure shown above.

Continuous integration and deployment of custom bundles

You must use the Magnolia Cloud Maven Plugin for the continuous integration and deployment (CI/CD) of custom bundles to Magnolia Cloud. The plugin validates and uploads your custom cloud bundle and deploys it to Magnolia’s pipelines.

Make sure you use the latest version of the Magnolia Cloud Maven Plugin when deploying a new bundle to Magnolia Cloud: v1.0-RC6.

More information can be found in the README.

Validating custom cloud bundle

The plugin performs validation checks against the built artifact (webapp) to ensure compatibility with the Magnolia Cloud infrastructure:

  • Checks for required configuration in the web.xml and magnolia.properties files.

  • Inspects required and blacklisted modules/jars.

Validate custom bundle
mvn verify -Pmagnolia-cloud-verify

Deploying the WAR file

The plugin uploads the built artifact to the entry point for Magnolia Cloud’s deployment pipelines. It also collects meta-information about the artifact for debugging purposes.

Currently, Magnolia Cloud only allows for incremental upgrades of the environment if the maven version is increased. The only alternative option at this time is to tear down the environment and set it up again.

Prerequisites

  • You must have a cloud subscription ID.

  • You must have the cloud access key.

  • You must have the cloud secret key.

Instructions

  1. In your parent pom.xml, add the following:

    <plugin>
        <groupId>info.magnolia.cloud</groupId>
        <artifactId>magnolia-cloud-maven-plugin</artifactId>
        <version>${magnolia-cloud-maven-plugin.version}</version>
    
    
        <!-- The following properties are provided during Magnolia Cloud onboarding -->
        <configuration>
        <region>eu-central-1</region> (1)
        <bucketName>magnolia-mgnl-prod-eu-central-1-custom-bundle</bucketName> (2)
        <subscriptionCode>SUBSCRIPTION-CODE</subscriptionCode> (3)
        <accessKey>ACCESS-KEY<accessKey> (4)
        <secretKey>SECRET-KEY</secretKey> (5)
        </configuration>
    </plugin>
    1. The S3 bucket region.

    2. The name of your S3 bucket.

    3. Your subscription code which was given to you during onboarding.

    4. You access key that was given to you during onboarding.

    5. You secret key that was given to you during onboarding.

  2. Deploy the WAR file:

    mvn verify -Pmagnolia-cloud-deploy

Pre-production test

Before you go live

Before you go live to production, you should do a final run-through using the Magnolia Cloud Simulator.

dev days event sign up
dev days event sign up
Feedback