Page tree
Skip to end of metadata
Go to start of metadata

In this step we set up Magnolia until to the point where the Magnolia instance:

  • Provides content apps with bootstrapped content.
  • Is ready to deliver json from these content apps which can be consumed via JavaScript on the client site.

Installation

Installing the base: - magnolia-community-demo-bundle

We will start by installing a typical Magnolia bundle that includes a Tomcat server. Download the bundle and install Magnolia. 

* magnolia-community-demo-bundle.zip

(warning) Do not start the Tomcat server yet, we will add some additional modules and change a Magnolia property first.

Adding additional modules

During the workshop we will need the following modules. These modules are not included in the webapp bundle we just downloaded, so we must add them now.

magnolia-rest-tools-2.0-bundle.zip

You must unzip and drop all the files from the resulting folder to the WEB-INF/lib folder(s)

 maven dependency

<dependency>
  <groupId>info.magnolia.rest</groupId>
  <artifactId>magnolia-rest-tools</artifactId>
  <version>2.0</version>
</dependency>

The magnolia-rest-tools module is not required on a productive system but is very useful during development.
 maven dependency

<dependency>
  <groupId>info.magnolia.documentation</groupId>
  <artifactId>camera-collection</artifactId>
  <version>1.0-SNAPSHOT</version>
</dependency>

This Magnolia Maven module contains two content apps and also provides bootstrapped content.
Optional
 maven dependency

<dependency>
  <groupId>info.magnolia.definitions</groupId>
  <artifactId>magnolia-definitions-app</artifactId>
  <version>1.1.1-SNAPSHOT</version>
</dependency>


Download the files and add them into the  $<your-magnolia-installation>/apache-tomcat-x.y/webapps/magnoliaAuthor/WEB-INF/lib  folder.

Setting the magnolia.resources.dir property

During the workshop we will create some lightmodules, they should reside within the directory which is set with the Magnolia property magnolia.resources.dir

You can use the default value which points to $<your-magnolia-installation>/apache-tomcat-x.y/webapps/<context> (where context is magnoliaAuthor or magnoliaPublic). However, it is better to change this value to point to another location such as:

  • Mac OS X /Users/johndoe/dev/lightmodules
  • Windows C:\Users\johndoe\dev\lightmodules

Starting Tomcat

Now we can start the Tomcat server. Note that the first time you start the Magnolia instance it installs a number of things itself.

Go to the magnolia-x.y/apache-tomcat-x.y/bin directory and type:

./magnolia_control.sh start

Note: In case you get an error due to a low "max open files" limit, you may try executing the command with
the --ignore-open-files-limit option:

./magnolia_control.sh start --ignore-open-files-limit

Detailed instructions:

 Mac OS X
  1. Open a terminal window in Applications > Utilities > Terminal.
  2. Go to the Magnolia installation directory

    cd /Applications/magnolia-x.y/apache-tomcat/bin
  3. Start Magnolia.

    ./magnolia_control.sh start &amp;&amp; tail -f ../logs/catalina.out

The first part of the startup command ./magnolia_control.sh start launches Magnolia. The second part && tail -f ../logs/catalina.out displays log messages written to /apache-tomcat/logs/catalina.out log file. This makes it easier to troubleshoot startup errors.

Magnolia reports startup information. If startup fails, look for the reason in the report. In a successful startup the last line reads: 
INFO: Server startup in 12345 ms.

To stop Magnolia, type CTRL + C, then ./magnolia_control.sh stop and press RETURN.

 Windows
  1. Open a command prompt and go to the Magnolia installation directory. 
    (To do this, type cd C:\Users\<username>\magnolia-x.y\apache-tomcat\bin)
  2. Type magnolia_control.bat start and press ENTER.
    Magnolia reports startup information in a new Tomcat window. If startup fails, look for the reason in the report. In a successful startup the last line reads: INFO: Server startup in 12345 ms

To stop Magnolia, type CTRL + C , then ./magnolia_control.bat stop and press ENTER.

 Linux
  1. Open a terminal window.
  2. Go to the Magnolia installation directory: 
    cd /home/<your account>/magnolia-x.y/apache-tomcat/bin 
    Your path may be different.
  3. Start Magnolia: 
    In bash shell: ./magnolia_control.sh start && tail -f ../logs/catalina.out
    In fish shell: ./magnolia_control.sh start; tail -f ../logs/catalina.out

The first part of the startup command ./magnolia_control.sh start launches Magnolia. The appended part tail -f ../logs/catalina.out displays log messages written to /apache-tomcat/logs/catalina.out log file. This makes it easier to troubleshoot startup errors.

Magnolia reports startup information. If startup fails, look for the reason in the report. In a successful startup the last line reads: 
INFO: Server startup in 12345 ms

To stop Magnolia, type CTRL + C , then ./magnolia_control.sh stop and press ENTER.

 Solaris
  1. Open a terminal window.
  2. Go to the Magnolia installation directory: 
    cd /home/userAccount/magnolia-x.y/apache-tomcat/bin 
    Your path may be different.
  3. Start Magnolia: 
    ./magnolia_control.sh start && tail -f ../logs/catalina.out

The first part of the startup command ./magnolia_control.sh start launches Magnolia. The second part && tail -f ../logs/catalina.out displays log messages written to /apache-tomcat/logs/catalina.out log file. This makes it easier to troubleshoot startup errors.

Magnolia reports startup information. If startup fails, look for the reason in the report. In a successful startup the last line reads: 
INFO: Server startup in 12345 ms

To stop Magnolia, type CTRL + C , then ./magnolia_control.sh stop and press ENTER.

If the "too many open files" error appears, use the following command to start the Tomcat server:

./magnolia_control.sh start --ignore-open-files-limit

Configuring REST

Set apiBasePath for magnolia-rest-tools

When using magnolia-rest-tools , we have to set the apiBasepath . The default value is most likely not correct for your Magnolia instance.

Grant permissions for the custom content app

The Camera-collection module bootstraps the camera-rest role.

Open the Security app, go to Roles and look at the camera-rest role.

Add the role:

  • to superuser in the author context.
  • to anonymous in the public context.






  • No labels