Set up DX Cloud
This page guides you on setting up everything you need to set up a new DX Cloud project.
Check you have the correct prerequisites, create your project, and then get ready to deploy your DX Cloud project.
Prerequisites
There are a few things that you need before you can get started with developing for your DX Cloud project.
Java
Currently, the minimum supported Java version for DX Cloud 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. For local development, use
|
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
-
Open a terminal or a shell.
-
Issue the command
mvn -v
. The command should produce an output similar to this:examplemvn -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.
For more details, see Maven: Setting up Multiple Repositories.
<repositories>
<repository>
<id>magnolia.nexus.enterprise</id>
<url>https://nexus.magnolia-cms.com/repository/enterprise</url>
</repository>
</repositories>
Create a master password (recommended)
We recommend you create a master password. However, this is not mandatory.
For more details, see Maven’s Password Encryption. |
-
Run the following command.
mvn --encrypt-master-password
This command produces an encrypted version of the password similar to the example below:
{jSMOWnoPFgsHVpMvz5VrIt5kRbzGpI8u+9EF1iFQyJQ=}
-
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:
-
Log into Nexus with your regular credentials.
-
Go to your profile. This is typically in the top corner with your username.
-
Select User Token from the menu.
-
Click Access user token.
This prompts you to log in again. Upon successful login, your user tokens are displayed.
-
If you have created a master password, encrypt your user token pass code:
mvn --encrypt-password ${userTokenPassCode}
-
Finally, store the token in the format shown here.
<server> <id>magnolia.nexus.enterprise</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=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.10 \
-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.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 DX Cloud 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 DX Cloud 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.