Set up PaaS

This page guides you on setting up everything you need to set up a new PaaS project.

Check you have the correct prerequisites, create your project, and then get ready to deploy your PaaS project.

Prerequisites

There are a few things that you need before you can get started with developing for your PaaS project.

Java

Currently, the minimum supported Java version for PaaS is Java 11 (LTS).

Magnolia needs at least a Java Runtime Environment (JRE) to run. Check if there’s a version of Java already installed on your computer by opening the terminal or command prompt and typing java -version. If the system reports a version number, Java is installed on your computer.

See Certified stack to confirm that the version installed is supported.

Maven is a tool for managing project dependencies and building your Magnolia project.

This page describes how to configure Maven to download Magnolia modules and webapps from our Nexus server, with appropriate access credentials.

Install maven

Download and Install Maven. In order to verify Maven has been installed correctly:

  1. Open a terminal or a shell.

  2. Issue the command mvn -v. The command should produce an output similar to this:

    example
    mvn -v
    
    Apache Maven 3.9.1 (2e17850...cc58f8)
    Maven home: /usr/local/apache-maven-3.9.1
    Java version: <JAVA_VERSION>, vendor: Eclipse Adoptium, runtime: path/to/install
    Default locale: fr_FR, platform encoding: UTF-8
    OS name: "<OPERATING_SYSTEM>"
    Maven keeps your user configuration and local repository under the ${user.home}/.m2/ directory. For more details, see Configuring Maven.

Set up Magnolia repositories

For DX Core projects, or for community releases in maintenance mode, add the following repository to your project POM (or Maven settings profile), and follow the next sections to set up authentication.

DX Core
<repositories>
  <repository>
    <id>magnolia.nexus.enterprise</id>
    <url>https://nexus.magnolia-cms.com/repository/enterprise</url>
  </repository>
</repositories>

We recommend you create a master password. However, this is not mandatory.

For more details, see Maven’s Password Encryption.
  1. Run the following command.

    mvn --encrypt-master-password

    This command produces an encrypted version of the password similar to the example below:

    {jSMOWnoPFgsHVpMvz5VrIt5kRbzGpI8u+9EF1iFQyJQ=}
  2. Store the password in ~/.m2/settings-security.xml.

    <settingsSecurity>
      <master>{jSMOWnoPFgsHVpMvz5VrIt5kRbzGpI8u+9EF1iFQyJQ=}</master>
    </settingsSecurity>

Set up credentials in Maven settings

To set up or update your credentials for Maven:

  1. Log into Nexus with your regular credentials.

  2. Go to your profile. This is typically in the top corner with your username.

  3. Select User Token from the menu.

  4. Click Access user token.

    This prompts you to log in again. Upon successful login, your user tokens are displayed.

  5. If you have created a master password, encrypt your user token pass code:

    mvn --encrypt-password ${userTokenPassCode}
  6. Finally, store the token in the format shown here.

    <server>
      <id>magnolia.enterprise.releases</id> (1)
      <!-- Token, not actual username / password -->
      <username>{userTokenNameCode}</username> (2)
      <password>{userTokenPassCode}</password> (3)
    </server>
    1 The Magnolia enterprise Nexus repository. The id must match the repository id in your project POM or 'magnolia-repositories' profile in maven settings.
    2 Your name code user token from Nexus.
    3 Your pass code user token from Nexus. You may use your encrypted pass code token here.

After you have set up Password Encryption above, switch to your shell and run the following command:

mvn org.sonatype.plugins:nexus-m2settings-maven-plugin:1.6.5:download -DnexusUrl=link:https://nexus.magnolia-cms.com -DtemplateId=magnolia-enterprise

Testing Maven settings

A simple way to test your settings: Try to build a project with Maven which is dependent on a Magnolia Enterprise module. Try to build a DX Core bundle from the Magnolia official Maven archetypes:

mvn archetype:generate -Dfilter=info.magnolia.maven.archetypes:magnolia

Mirroring

If you have your own Repository Manager, the following are the repositories you can mirror:

  1. You need a Magnolia account to access these repositories. For mirroring, please get a "robots" account with us.

  2. There are a few third-party artifacts that we have customized and released ourselves. We usually move back to regular releases when fixes are publicly released in these.

  3. A few artifacts Magnolia uses which are not available in the Maven Central Repository.

IDE

Make sure you have a Java IDE installed. It could be:

Create a project using the Maven archetype

Create a custom cloud bundle from the following Maven Archetypes:

mvn archetype:generate \
    -DarchetypeGroupId=info.magnolia.maven.archetypes \
    -DarchetypeArtifactId=magnolia-dx-core-custom-cloud-archetype \
    -DarchetypeVersion=1.9 \
    -DarchetypeRepository=https://nexus.magnolia-cms.com/content/repositories/magnolia.public.releases

You will be prompted to enter the following info:

  • groupId: The Maven groupId of your cloud bundle (ie: info.magnolia.demo)

  • artifactId: The Maven artifactId of your cloud bundle (ie: magnolia-demo-ecommerce)

  • version: The Maven version of your cloud bundle (ie: 1.0-SNAPSHOT). The final version is generated on release.

  • package: The Maven base package of your cloud bundle (usually same a the groupId)

  • magnolia-bundle-version: The Magnolia version to be used in your cloud bundle (ie: 6.2.24)

  • project-name: The project name (ie: magnolia-demo-ecommerce)

  • shortname: The name of the project to be used in the Magnolia URLs (ie: https://dev.shortname.magnolia-platform.com/author)

  • region: The AWS region the database backup bucket is located in (ie: eu-central-1)

The command will then create the Magnolia Java Webapp project.

The Java webapp in PaaS has a typical structure.

Webapp structure example
custom
├── .gitignore
├── .gitlab-ci.yml (1)
├── .m2
│   └── settings.xml
├── README.md
├── custom-webapp
│   ├── Dockerfile
│   ├── pom.xml
│   ├── src
│   └── target
├── pom.xml
└── values.yml (2)
1 The .gitlab-ci.yml file ensures your development changes are automatically picked up.
2 The values.yml file ensures your PaaS application is deployed to the your cluster.

On the first level you will find the pom.xml file which automatically contains the magnolia-dx-core-custom-cloud-parent artifact.

...

  <dependencyManagement>
    <dependencies>
      <!-- DX Core custom cloud dependency management -->
      <dependency>
        <groupId>info.magnolia.dx</groupId>
        <artifactId>magnolia-dx-core-custom-cloud-parent</artifactId> (1)
        <version>${magnolia.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

...
1 The magnolia-dx-core-custom-cloud-parent artifact.

Testing the project

Open a terminal and go to the newly created project and then execute the following Maven build command:

mvn clean package

Starting Magnolia locally

Load the project in your IDE and configure the Tomcat server with the following system variables.

-Xms1024m
-Xmx2048m
-Dmagnolia.develop=true
-Dmagnolia.superuser.enabled=true
-Dmagnolia.utf8.enabled=true
-Dmagnolia.update.auto=true
-Dmagnolia.resources.dir="/opt/magnolia/light-modules"
-Dmagnolia.repositories.home="/opt/magnolia/repositories"
-Dmagnolia.webapp="Goofy Author"
-Dmagnolia.inject.config="createPath:/modules/enterprise/license\;setProperty:/modules/enterprise/license,owner,
your_email\;setProperty:/modules/enterprise/license,key,your_license_hash“

Custom cloud parent project

The custom cloud parent project automatically excludes the following modules:

It includes the following modules:

  • Instrumentation: Exposes the Magnolia metrics to the monitoring service.

  • Configuration injection: Facilitates the customization of Magnolia.

Feedback

PaaS

×

Location

This widget lets you know where you are on the docs site.

You are currently perusing through the Magnolia PaaS docs.

Main doc sections

DX Core Headless PaaS Legacy Cloud Incubator modules