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 going with our Hello PaaS tutorial.
Prerequisites
There are a few things that you need before you can get started with developing for your Magnolia PaaS project.
Java
Magnolia needs at least a Java Runtime Environment (JRE) to run. Type java -version
in a terminal or command prompt. If the system reports a version number, Java is installed on your computer.
See the Certified stack page to confirm that the version installed is supported. |
If you don’t have Java, install it.
Windows users
On Windows you need a Java SE Development Kit (JDK). The Java Runtime Environment (JRE) is not enough because the Tomcat application server does not recognize it.
What is the difference?
-
JRE is for users who run Java programs on their computer.
-
JDK is for developers who write Java-based applications.
Download and install JDK. By default JDK is installed at C:\Program Files\Java\jdk-<version>\
. You can choose another location.
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:
-
https://nexus.magnolia-cms.com/content/repositories/magnolia.public.releases/
-
https://nexus.magnolia-cms.com/content/repositories/magnolia.public.snapshots/
-
https://nexus.magnolia-cms.com/content/repositories/magnolia.public.maintenance.releases/
-
https://nexus.magnolia-cms.com/content/repositories/magnolia.public.maintenance.snapshots/
-
https://nexus.magnolia-cms.com/content/repositories/magnolia.enterprise.releases/
-
https://nexus.magnolia-cms.com/content/repositories/magnolia.enterprise.snapshots/
-
https://nexus.magnolia-cms.com/content/repositories/thirdparty.customized/
-
https://nexus.magnolia-cms.com/content/repositories/thirdparty.licensed/
-
https://nexus.magnolia-cms.com/content/repositories/magnolia.forge.releases/
-
https://nexus.magnolia-cms.com/content/repositories/magnolia.forge.snapshots/
-
https://nexus.magnolia-cms.com/content/repositories/magnolia.addons.releases/
-
https://nexus.magnolia-cms.com/content/repositories/magnolia.incubator.releases/
|
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.3 \
-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.19) -
project-name
: The project name (ie: magnolia-demo-ecommerce)
When you generate your project with the Maven Archetype, it creates 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.
-
Periscope ranker: This is excluded for performance reasons.
-
- It includes the following modules
-
-
Instrumentation: To expose the Magnolia metrics to the monitoring service
-
Configuration injection: To facilitate the customization of Magnolia
-