Set up Magnolia PaaS
This page guides you on setting up everything you need to set up a new Magnolia PaaS project.
Check you have the correct prerequisites, create your project, and then get ready to deploy your Magnolia PaaS project.
Prerequisites
There are a few things that you need before you can get started with developing for your Magnolia PaaS project.
Java
Currently, the minimum supported Java version for Magnolia 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 page to confirm that the version installed is supported. |
Maven
Download and Install Maven 3. Follow the OS-specific installation instructions from the Maven website (e.g. setting PATH environment variable).
In order to verify Maven has been installed correctly:
Open a terminal or a shell and run:
`mvn -v`
Maven keeps your user configuration and local repository under th ${user.home}/.m2/ directory .
|
Setting up credentials
To encrypt your Nexus credentials, execute the following command in your terminal or shell
mkdir -p ~/.m2 ; read -s -p 'Please enter your master Maven password: ' MASTPASS && \
echo "<settingsSecurity><master>`mvn --encrypt-master-password $MASTPASS`</master></settingsSecurity>" > ~/.m2/settings-security.xml ; \
unset MASTPASS
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:
|
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.8 \
-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 thegroupId
) -
magnolia-bundle-version
: The Magnolia version to be used in your cloud bundle (ie: 6.2.42) -
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 Magnolia PaaS has a typical structure.
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 Magnolia 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:
-
Backup module: It will be part of an outside feature.
It includes the following modules:
-
Instrumentation: Exposes the Magnolia metrics to the monitoring service.
-
Configuration injection: Facilitates the customization of Magnolia.