Installing on Liferay Self-Hosted (Tomcat)
Follow these steps when Liferay is installed from a Tomcat bundle on a server you manage.
You need file access to the Liferay server, the required Liferay fixes installed with Liferay’s patching tool or their workarounds, and Liferay must have finished starting before you begin. In the steps below, <liferay-home> is the Liferay installation folder, the one that contains the osgi and routes folders.
- Step 1: Download the Release
- Step 2: Deploy the Batch
- Step 3: Deploy the Microservice’s Zip
- Step 4: Start the Microservice
- Step 5: Set Up Email Notifications
- Step 6: Create the Forum Sites
- Related Information
Step 1: Download the Release
From the latest release, download:
liferay-forums-batch.zipliferay-forums-etc-spring-boot.zipliferay-forums-site-initializer.zipgenerate-site-initializer-zips.sh, only to run several forum sites with the script; see Creating Forum Sites.
Step 2: Deploy the Batch
-
Copy
liferay-forums-batch.zipinto<liferay-home>/osgi/client-extensions. -
Wait until the Liferay log shows five lines containing
Finished batch engine import taskafter the copy. This takes about a minute.
Don’t continue until all five have finished. The microservice deployed in the next step only gets access to the parts of the forum that exist by then. Liferay also logs a few of these lines while it starts, so only count the ones after the copy.
Step 3: Deploy the Microservice’s Zip
Copy liferay-forums-etc-spring-boot.zip into <liferay-home>/osgi/client-extensions.
Liferay registers the microservice and writes its credentials to <liferay-home>/routes/default. Liferay doesn’t run the microservice itself; the next step starts it.
Step 4: Start the Microservice
The microservice must run whenever Liferay runs: posting, notifications, and moderation all depend on it. Run it on the Liferay machine if you can; it’s simpler.
On the Liferay Machine
-
Unzip
liferay-forums-etc-spring-boot.zipinto a folder of your choice, such as/opt/liferay-forums. -
From that folder, start it, with
LIFERAY_HOMEset to the Liferay installation folder. It finds Liferay’s address and its credentials there, so there’s nothing to configure.On Linux:
LIFERAY_HOME=/opt/liferay ./start.shOn Windows:
set LIFERAY_HOME=C:\liferay start.batIf it stops with a message that the routes don’t exist, its zip isn’t deployed to that Liferay yet, or
LIFERAY_HOMEpoints to the wrong folder. -
Check that it’s running. This prints
READY:curl http://localhost:58081/ready
To keep it running across reboots on Linux, run it as a system service. For example, a systemd unit at /etc/systemd/system/liferay-forums.service:
[Unit]
Description=Liferay Forums microservice
After=network.target
[Service]
User=liferay
Environment=LIFERAY_HOME=/opt/liferay
WorkingDirectory=/opt/liferay-forums
ExecStart=/opt/liferay-forums/start.sh
Restart=on-failure
[Install]
WantedBy=multi-user.target
Download liferay-forums.service
Then run sudo systemctl enable --now liferay-forums.
On Another Machine
Liferay always calls the microservice at localhost:58081, so port 58081 on the Liferay machine must be forwarded to the microservice’s machine.
-
On the microservice’s machine, unzip
liferay-forums-etc-spring-boot.zipinto a folder of your choice. -
In
application.properties, next to the jar, uncomment and fill in these four settings:com.liferay.lxc.dxp.mainDomain=liferay.example.com com.liferay.lxc.dxp.server.protocol=https liferay-forums-etc-spring-boot-oahs.oauth2.headless.server.client.id=<client ID> liferay-forums-etc-spring-boot-oahs.oauth2.headless.server.client.secret=<client secret>mainDomainandserver.protocolare how the microservice reaches Liferay; include the port inmainDomainunless it’s 80 or 443. The client ID and secret are those of Liferay Forums Etc Spring Boot OAuth Application Headless Server, in Control Panel → Security → OAuth 2 Administration. -
Start it without
LIFERAY_HOME:./start.shon Linux, orstart.baton Windows. -
On the Liferay machine, forward port
58081to the microservice’s machine, and keep the forward running as long as the microservice runs. Allow port58081through any firewall between the machines. Either runsocaton the Liferay machine:socat TCP-LISTEN:58081,bind=127.0.0.1,fork,reuseaddr TCP:<microservice-host>:58081Or open an SSH tunnel from the microservice’s machine:
ssh -N -R 58081:localhost:58081 <user>@<liferay-host> -
On the Liferay machine, check that the forward reaches the microservice. This prints
READY:curl http://localhost:58081/ready
Step 5: Set Up Email Notifications
The batch created two email templates with a placeholder sender address. Set real addresses, then restart the microservice, before members get email. See Email Notifications.
Step 6: Create the Forum Sites
Continue with Creating Forum Sites.